From 59de0fde1e2dd9aa4f8ad7feba0826541b557332 Mon Sep 17 00:00:00 2001 From: arithmetic1728 Date: Tue, 14 Jul 2020 15:26:34 -0700 Subject: [PATCH] feat!: migrate to use microgenerator --- README.rst | 13 +- UPGRADING.md | 146 + docs/UPGRADING.md | 1 + docs/cloudbuild_v1/services.rst | 6 + docs/cloudbuild_v1/types.rst | 5 + docs/gapic/v1/api.rst | 6 - docs/gapic/v1/types.rst | 5 - docs/index.rst | 15 +- google/cloud/devtools/__init__.py | 24 - google/cloud/devtools/cloudbuild.py | 29 - google/cloud/devtools/cloudbuild/__init__.py | 124 + google/cloud/devtools/cloudbuild/py.typed | 2 + .../cloud/devtools/cloudbuild_v1/__init__.py | 116 +- .../cloudbuild_v1/gapic/cloud_build_client.py | 1410 ---- .../gapic/cloud_build_client_config.py | 103 - .../devtools/cloudbuild_v1/gapic/enums.py | 189 - .../gapic/transports/__init__.py | 0 .../transports/cloud_build_grpc_transport.py | 382 - .../devtools/cloudbuild_v1/proto/__init__.py | 0 .../cloudbuild_v1/proto/cloudbuild.proto | 4 +- .../cloudbuild_v1/proto/cloudbuild_pb2.py | 6905 ----------------- .../proto/cloudbuild_pb2_grpc.py | 378 - google/cloud/devtools/cloudbuild_v1/py.typed | 2 + .../cloudbuild_v1/services}/__init__.py | 14 +- .../services/cloud_build}/__init__.py | 18 +- .../services/cloud_build/async_client.py | 1428 ++++ .../services/cloud_build/client.py | 1551 ++++ .../services/cloud_build/pagers.py | 276 + .../cloud_build/transports/__init__.py | 36 + .../services/cloud_build/transports/base.py | 246 + .../services/cloud_build/transports/grpc.py | 700 ++ .../cloud_build/transports/grpc_asyncio.py | 711 ++ google/cloud/devtools/cloudbuild_v1/types.py | 58 - .../devtools/cloudbuild_v1/types/__init__.py | 109 + .../cloudbuild_v1/types/cloudbuild.py | 1548 ++++ noxfile.py | 10 +- samples/AUTHORING_GUIDE.md | 1 + samples/CONTRIBUTING.md | 1 + scripts/fixup_cloudbuild_v1_keywords.py | 192 + setup.py | 15 +- synth.metadata | 12 +- synth.py | 57 +- .../unit/gapic/cloudbuild_v1}/__init__.py | 0 .../gapic/cloudbuild_v1/test_cloud_build.py | 3137 ++++++++ .../gapic/v1/test_cloud_build_client_v1.py | 833 -- 45 files changed, 10409 insertions(+), 10409 deletions(-) create mode 100644 UPGRADING.md create mode 120000 docs/UPGRADING.md create mode 100644 docs/cloudbuild_v1/services.rst create mode 100644 docs/cloudbuild_v1/types.rst delete mode 100644 docs/gapic/v1/api.rst delete mode 100644 docs/gapic/v1/types.rst delete mode 100644 google/cloud/devtools/__init__.py delete mode 100644 google/cloud/devtools/cloudbuild.py create mode 100644 google/cloud/devtools/cloudbuild/__init__.py create mode 100644 google/cloud/devtools/cloudbuild/py.typed delete mode 100644 google/cloud/devtools/cloudbuild_v1/gapic/cloud_build_client.py delete mode 100644 google/cloud/devtools/cloudbuild_v1/gapic/cloud_build_client_config.py delete mode 100644 google/cloud/devtools/cloudbuild_v1/gapic/enums.py delete mode 100644 google/cloud/devtools/cloudbuild_v1/gapic/transports/__init__.py delete mode 100644 google/cloud/devtools/cloudbuild_v1/gapic/transports/cloud_build_grpc_transport.py delete mode 100644 google/cloud/devtools/cloudbuild_v1/proto/__init__.py delete mode 100644 google/cloud/devtools/cloudbuild_v1/proto/cloudbuild_pb2.py delete mode 100644 google/cloud/devtools/cloudbuild_v1/proto/cloudbuild_pb2_grpc.py create mode 100644 google/cloud/devtools/cloudbuild_v1/py.typed rename google/cloud/{ => devtools/cloudbuild_v1/services}/__init__.py (71%) rename google/{ => cloud/devtools/cloudbuild_v1/services/cloud_build}/__init__.py (71%) create mode 100644 google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py create mode 100644 google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py create mode 100644 google/cloud/devtools/cloudbuild_v1/services/cloud_build/pagers.py create mode 100644 google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/__init__.py create mode 100644 google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py create mode 100644 google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py create mode 100644 google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py delete mode 100644 google/cloud/devtools/cloudbuild_v1/types.py create mode 100644 google/cloud/devtools/cloudbuild_v1/types/__init__.py create mode 100644 google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py create mode 100644 samples/AUTHORING_GUIDE.md create mode 100644 samples/CONTRIBUTING.md create mode 100644 scripts/fixup_cloudbuild_v1_keywords.py rename {google/cloud/devtools/cloudbuild_v1/gapic => tests/unit/gapic/cloudbuild_v1}/__init__.py (100%) create mode 100644 tests/unit/gapic/cloudbuild_v1/test_cloud_build.py delete mode 100644 tests/unit/gapic/v1/test_cloud_build_client_v1.py diff --git a/README.rst b/README.rst index f802c4f0..8fcf1f13 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ Python Client for Cloud Build API (`GA`_) ============================================ -|ga| |pypi| |versions| +|ga| |pypi| |versions| `Cloud Build API`_: Creates and manages builds on Google Cloud Platform. @@ -48,6 +48,15 @@ dependencies. .. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ +Supported Python Versions +^^^^^^^^^^^^^^^^^^^^^^^^^ +Python >= 3.6 + +Deprecated Python Versions +^^^^^^^^^^^^^^^^^^^^^^^^^^ +Python == 2.7. + +The last version of this library compatible with Python 2.7 is google-cloud-build==1.1.0. Mac/Linux ^^^^^^^^^ @@ -81,4 +90,4 @@ Next Steps APIs that we cover. .. _Cloud Build API Product documentation: https://cloud.google.com/cloud-build -.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst \ No newline at end of file +.. _repository’s main README: https://github.com/googleapis/google-cloud-python/blob/master/README.rst diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 00000000..8851d300 --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,146 @@ +# 2.0.0 Migration Guide + +The 2.0 release of the `google-cloud-build` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage. + +If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-cloudbuild/issues). + +## Supported Python Versions + +> **WARNING**: Breaking change + +The 2.0.0 release requires Python 3.6+. + + +## Method Calls + +> **WARNING**: Breaking change + +Methods expect request objects. We provide a script that will convert most common use cases. + +* Install the library + +```py +python3 -m pip install google-cloud-build +``` + +* The script `fixup_cloudbuild_v1_keywords.py` is shipped with the library. It expects +an input directory (with the code to convert) and an empty destination directory. + +```sh +$ fixup_cloudbuild_v1_keywords.py --input-directory .samples/ --output-directory samples/ +``` + +**Before:** +```py +from google.cloud.devtools import cloudbuild + +client = cloudbuild.CloudBuildClient() + +build = client.get_build("project_id") +``` + + +**After:** +```py +from google.cloud.devtools import cloudbuild + +client = cloudbuild.CloudBuildClient() + +build = client.get_build(request = {'project_id': "project_id"}) +``` + +### More Details + +In `google-cloud-build<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters. + +**Before:** +```py + def list_builds( + self, + project_id, + page_size=None, + filter_=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): +``` + +In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional. + +Some methods have additional keyword only parameters. The available parameters depend on the [`google.api.method_signature` annotation](https://github.com/googleapis/googleapis/blob/master/google/devtools/cloudbuild/v1/cloudbuild.proto#L82) specified by the API producer. + + +**After:** +```py + def list_builds( + self, + request: cloudbuild.ListBuildsRequest = None, + *, + project_id: str = None, + filter: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListBuildsPager: +``` + +> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive. +> Passing both will result in an error. + + +Both of these calls are valid: + +```py +response = client.list_builds( + request={ + "project_id": project_id, + "filter": filter, + } +) +``` + +```py +response = client.list_builds( + project_id=project_id, + filter=filter, +) +``` + +This call is invalid because it mixes `request` with a keyword argument `filter`. Executing this code +will result in an error. + +```py +response = client.list_builds( + request={ + "project_id": project_id, + }, + filter=filter +) +``` + + + +## Enums and Types + + +> **WARNING**: Breaking change + +The submodules `enums` and `types` have been removed. + +**Before:** +```py +from google.cloud.devtools import cloudbuild + +build_status = cloudbuild.enums.Build.Status.SUCCESS +built_image = cloudbuild.types.BuiltImage(name="name") +``` + + +**After:** +```py +from google.cloud.devtools import cloudbuild + +build_status = cloudbuild.Build.Status.SUCCESS +built_image = cloudbuild.BuiltImage(name="name") +``` diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md new file mode 120000 index 00000000..01097c8c --- /dev/null +++ b/docs/UPGRADING.md @@ -0,0 +1 @@ +../UPGRADING.md \ No newline at end of file diff --git a/docs/cloudbuild_v1/services.rst b/docs/cloudbuild_v1/services.rst new file mode 100644 index 00000000..6e93f6b3 --- /dev/null +++ b/docs/cloudbuild_v1/services.rst @@ -0,0 +1,6 @@ +Services for Google Devtools Cloudbuild v1 API +============================================== + +.. automodule:: google.cloud.devtools.cloudbuild_v1.services.cloud_build + :members: + :inherited-members: diff --git a/docs/cloudbuild_v1/types.rst b/docs/cloudbuild_v1/types.rst new file mode 100644 index 00000000..efe8ce72 --- /dev/null +++ b/docs/cloudbuild_v1/types.rst @@ -0,0 +1,5 @@ +Types for Google Devtools Cloudbuild v1 API +=========================================== + +.. automodule:: google.cloud.devtools.cloudbuild_v1.types + :members: diff --git a/docs/gapic/v1/api.rst b/docs/gapic/v1/api.rst deleted file mode 100644 index b73769d5..00000000 --- a/docs/gapic/v1/api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Client for Cloud Build API -========================== - -.. automodule:: google.cloud.devtools.cloudbuild_v1 - :members: - :inherited-members: \ No newline at end of file diff --git a/docs/gapic/v1/types.rst b/docs/gapic/v1/types.rst deleted file mode 100644 index db501043..00000000 --- a/docs/gapic/v1/types.rst +++ /dev/null @@ -1,5 +0,0 @@ -Types for Cloud Build API Client -================================ - -.. automodule:: google.cloud.devtools.cloudbuild_v1.types - :members: \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 21ccc199..95805052 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,8 +9,19 @@ API Reference .. toctree:: :maxdepth: 2 - gapic/v1/api - gapic/v1/types + cloudbuild_v1/services + cloudbuild_v1/types + + +Migration Guide +--------------- + +See the guide below for instructions on migrating to the 2.x release of this library. + +.. toctree:: + :maxdepth: 2 + + UPGRADING Changelog diff --git a/google/cloud/devtools/__init__.py b/google/cloud/devtools/__init__.py deleted file mode 100644 index 8fcc60e2..00000000 --- a/google/cloud/devtools/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.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. - -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - - __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/google/cloud/devtools/cloudbuild.py b/google/cloud/devtools/cloudbuild.py deleted file mode 100644 index 45cdbff2..00000000 --- a/google/cloud/devtools/cloudbuild.py +++ /dev/null @@ -1,29 +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. - - -from __future__ import absolute_import - -from google.cloud.devtools.cloudbuild_v1 import CloudBuildClient -from google.cloud.devtools.cloudbuild_v1 import enums -from google.cloud.devtools.cloudbuild_v1 import types - - -__all__ = ( - "enums", - "types", - "CloudBuildClient", -) diff --git a/google/cloud/devtools/cloudbuild/__init__.py b/google/cloud/devtools/cloudbuild/__init__.py new file mode 100644 index 00000000..a8ad9f88 --- /dev/null +++ b/google/cloud/devtools/cloudbuild/__init__.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from google.cloud.devtools.cloudbuild_v1.services.cloud_build.async_client import ( + CloudBuildAsyncClient, +) +from google.cloud.devtools.cloudbuild_v1.services.cloud_build.client import ( + CloudBuildClient, +) +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ArtifactResult +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Artifacts +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Build +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import BuildOperationMetadata +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import BuildOptions +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import BuildStep +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import BuildTrigger +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import BuiltImage +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import CancelBuildRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import CreateBuildRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ( + CreateBuildTriggerRequest, +) +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import CreateWorkerPoolRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ( + DeleteBuildTriggerRequest, +) +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import DeleteWorkerPoolRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import FileHashes +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GetBuildRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GetBuildTriggerRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GetWorkerPoolRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GitHubEventsConfig +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Hash +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ( + ListBuildTriggersRequest, +) +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ( + ListBuildTriggersResponse, +) +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ListBuildsRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ListBuildsResponse +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ListWorkerPoolsRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ListWorkerPoolsResponse +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Network +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import PullRequestFilter +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import PushFilter +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import RepoSource +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Results +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import RetryBuildRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import RunBuildTriggerRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Secret +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Source +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import SourceProvenance +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import StorageSource +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import TimeSpan +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import ( + UpdateBuildTriggerRequest, +) +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import UpdateWorkerPoolRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Volume +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import WorkerConfig +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import WorkerPool + +__all__ = ( + "ArtifactResult", + "Artifacts", + "Build", + "BuildOperationMetadata", + "BuildOptions", + "BuildStep", + "BuildTrigger", + "BuiltImage", + "CancelBuildRequest", + "CloudBuildAsyncClient", + "CloudBuildClient", + "CreateBuildRequest", + "CreateBuildTriggerRequest", + "CreateWorkerPoolRequest", + "DeleteBuildTriggerRequest", + "DeleteWorkerPoolRequest", + "FileHashes", + "GetBuildRequest", + "GetBuildTriggerRequest", + "GetWorkerPoolRequest", + "GitHubEventsConfig", + "Hash", + "ListBuildTriggersRequest", + "ListBuildTriggersResponse", + "ListBuildsRequest", + "ListBuildsResponse", + "ListWorkerPoolsRequest", + "ListWorkerPoolsResponse", + "Network", + "PullRequestFilter", + "PushFilter", + "RepoSource", + "Results", + "RetryBuildRequest", + "RunBuildTriggerRequest", + "Secret", + "Source", + "SourceProvenance", + "StorageSource", + "TimeSpan", + "UpdateBuildTriggerRequest", + "UpdateWorkerPoolRequest", + "Volume", + "WorkerConfig", + "WorkerPool", +) diff --git a/google/cloud/devtools/cloudbuild/py.typed b/google/cloud/devtools/cloudbuild/py.typed new file mode 100644 index 00000000..076585a1 --- /dev/null +++ b/google/cloud/devtools/cloudbuild/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-devtools-cloudbuild package uses inline types. diff --git a/google/cloud/devtools/cloudbuild_v1/__init__.py b/google/cloud/devtools/cloudbuild_v1/__init__.py index 9071d832..59a2ac89 100644 --- a/google/cloud/devtools/cloudbuild_v1/__init__.py +++ b/google/cloud/devtools/cloudbuild_v1/__init__.py @@ -1,45 +1,109 @@ # -*- 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 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# - -from __future__ import absolute_import -import sys -import warnings - -from google.cloud.devtools.cloudbuild_v1 import types -from google.cloud.devtools.cloudbuild_v1.gapic import cloud_build_client -from google.cloud.devtools.cloudbuild_v1.gapic import enums - - -if sys.version_info[:2] == (2, 7): - message = ( - "A future version of this library will drop support for Python 2.7. " - "More details about Python 2 support for Google Cloud Client Libraries " - "can be found at https://cloud.google.com/python/docs/python2-sunset/" - ) - warnings.warn(message, DeprecationWarning) - - -class CloudBuildClient(cloud_build_client.CloudBuildClient): - __doc__ = cloud_build_client.CloudBuildClient.__doc__ - enums = enums +from .services.cloud_build import CloudBuildClient +from .types.cloudbuild import ArtifactResult +from .types.cloudbuild import Artifacts +from .types.cloudbuild import Build +from .types.cloudbuild import BuildOperationMetadata +from .types.cloudbuild import BuildOptions +from .types.cloudbuild import BuildStep +from .types.cloudbuild import BuildTrigger +from .types.cloudbuild import BuiltImage +from .types.cloudbuild import CancelBuildRequest +from .types.cloudbuild import CreateBuildRequest +from .types.cloudbuild import CreateBuildTriggerRequest +from .types.cloudbuild import CreateWorkerPoolRequest +from .types.cloudbuild import DeleteBuildTriggerRequest +from .types.cloudbuild import DeleteWorkerPoolRequest +from .types.cloudbuild import FileHashes +from .types.cloudbuild import GetBuildRequest +from .types.cloudbuild import GetBuildTriggerRequest +from .types.cloudbuild import GetWorkerPoolRequest +from .types.cloudbuild import GitHubEventsConfig +from .types.cloudbuild import Hash +from .types.cloudbuild import ListBuildTriggersRequest +from .types.cloudbuild import ListBuildTriggersResponse +from .types.cloudbuild import ListBuildsRequest +from .types.cloudbuild import ListBuildsResponse +from .types.cloudbuild import ListWorkerPoolsRequest +from .types.cloudbuild import ListWorkerPoolsResponse +from .types.cloudbuild import Network +from .types.cloudbuild import PullRequestFilter +from .types.cloudbuild import PushFilter +from .types.cloudbuild import RepoSource +from .types.cloudbuild import Results +from .types.cloudbuild import RetryBuildRequest +from .types.cloudbuild import RunBuildTriggerRequest +from .types.cloudbuild import Secret +from .types.cloudbuild import Source +from .types.cloudbuild import SourceProvenance +from .types.cloudbuild import StorageSource +from .types.cloudbuild import TimeSpan +from .types.cloudbuild import UpdateBuildTriggerRequest +from .types.cloudbuild import UpdateWorkerPoolRequest +from .types.cloudbuild import Volume +from .types.cloudbuild import WorkerConfig +from .types.cloudbuild import WorkerPool __all__ = ( - "enums", - "types", + "ArtifactResult", + "Artifacts", + "Build", + "BuildOperationMetadata", + "BuildOptions", + "BuildStep", + "BuildTrigger", + "BuiltImage", + "CancelBuildRequest", + "CreateBuildRequest", + "CreateBuildTriggerRequest", + "CreateWorkerPoolRequest", + "DeleteBuildTriggerRequest", + "DeleteWorkerPoolRequest", + "FileHashes", + "GetBuildRequest", + "GetBuildTriggerRequest", + "GetWorkerPoolRequest", + "GitHubEventsConfig", + "Hash", + "ListBuildTriggersRequest", + "ListBuildTriggersResponse", + "ListBuildsRequest", + "ListBuildsResponse", + "ListWorkerPoolsRequest", + "ListWorkerPoolsResponse", + "Network", + "PullRequestFilter", + "PushFilter", + "RepoSource", + "Results", + "RetryBuildRequest", + "RunBuildTriggerRequest", + "Secret", + "Source", + "SourceProvenance", + "StorageSource", + "TimeSpan", + "UpdateBuildTriggerRequest", + "UpdateWorkerPoolRequest", + "Volume", + "WorkerConfig", + "WorkerPool", "CloudBuildClient", ) diff --git a/google/cloud/devtools/cloudbuild_v1/gapic/cloud_build_client.py b/google/cloud/devtools/cloudbuild_v1/gapic/cloud_build_client.py deleted file mode 100644 index 455bf095..00000000 --- a/google/cloud/devtools/cloudbuild_v1/gapic/cloud_build_client.py +++ /dev/null @@ -1,1410 +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. - -"""Accesses the google.devtools.cloudbuild.v1 CloudBuild API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import grpc - -from google.cloud.devtools.cloudbuild_v1.gapic import cloud_build_client_config -from google.cloud.devtools.cloudbuild_v1.gapic import enums -from google.cloud.devtools.cloudbuild_v1.gapic.transports import ( - cloud_build_grpc_transport, -) -from google.cloud.devtools.cloudbuild_v1.proto import cloudbuild_pb2 -from google.cloud.devtools.cloudbuild_v1.proto import cloudbuild_pb2_grpc -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-build",).version - - -class CloudBuildClient(object): - """ - Creates and manages builds on Google Cloud Platform. - - The main concept used by this API is a ``Build``, which describes the - location of the source to build, how to build the source, and where to - store the built artifacts, if any. - - A user can list previously-requested builds or get builds by their ID to - determine the status of the build. - """ - - SERVICE_ADDRESS = "cloudbuild.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.devtools.cloudbuild.v1.CloudBuild" - - @classmethod - def from_service_account_file(cls, filename, *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: - CloudBuildClient: 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 - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.CloudBuildGrpcTransport, - Callable[[~.Credentials, type], ~.CloudBuildGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.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. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is 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. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = cloud_build_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=cloud_build_grpc_transport.CloudBuildGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = cloud_build_grpc_transport.CloudBuildGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION, - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME], - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def list_builds( - self, - project_id, - page_size=None, - filter_=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Lists previously requested builds. - - Previously requested builds may still be in-progress, or may have finished - successfully or unsuccessfully. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_builds(project_id): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_builds(project_id).pages: - ... for element in page: - ... # process element - ... pass - - Args: - project_id (str): Required. ID of the project. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - filter_ (str): The raw filter text to constrain the results. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.devtools.cloudbuild_v1.types.Build` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_builds" not in self._inner_api_calls: - self._inner_api_calls[ - "list_builds" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_builds, - default_retry=self._method_configs["ListBuilds"].retry, - default_timeout=self._method_configs["ListBuilds"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.ListBuildsRequest( - project_id=project_id, page_size=page_size, filter=filter_, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("project_id", project_id)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_builds"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="builds", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def delete_build_trigger( - self, - project_id, - trigger_id, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes a ``BuildTrigger`` by its project ID and trigger ID. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `trigger_id`: - >>> trigger_id = '' - >>> - >>> client.delete_build_trigger(project_id, trigger_id) - - Args: - project_id (str): Required. ID of the project that owns the trigger. - trigger_id (str): Required. ID of the ``BuildTrigger`` to delete. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_build_trigger" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_build_trigger" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_build_trigger, - default_retry=self._method_configs["DeleteBuildTrigger"].retry, - default_timeout=self._method_configs["DeleteBuildTrigger"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.DeleteBuildTriggerRequest( - project_id=project_id, trigger_id=trigger_id, - ) - self._inner_api_calls["delete_build_trigger"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def create_build( - self, - project_id, - build, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Starts a build with the specified configuration. - - This method returns a long-running ``Operation``, which includes the - build ID. Pass the build ID to ``GetBuild`` to determine the build - status (such as ``SUCCESS`` or ``FAILURE``). - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `build`: - >>> build = {} - >>> - >>> response = client.create_build(project_id, build) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - project_id (str): Required. ID of the project. - build (Union[dict, ~google.cloud.devtools.cloudbuild_v1.types.Build]): Required. Build resource to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.devtools.cloudbuild_v1.types.Build` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_build" not in self._inner_api_calls: - self._inner_api_calls[ - "create_build" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_build, - default_retry=self._method_configs["CreateBuild"].retry, - default_timeout=self._method_configs["CreateBuild"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.CreateBuildRequest(project_id=project_id, build=build,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("project_id", project_id)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["create_build"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - cloudbuild_pb2.Build, - metadata_type=cloudbuild_pb2.BuildOperationMetadata, - ) - - def get_build( - self, - project_id, - id_, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns information about a previously requested build. - - The ``Build`` that is returned includes its status (such as ``SUCCESS``, - ``FAILURE``, or ``WORKING``), and timing information. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `id_`: - >>> id_ = '' - >>> - >>> response = client.get_build(project_id, id_) - - Args: - project_id (str): Required. ID of the project. - id_ (str): Required. ID of the build. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.Build` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_build" not in self._inner_api_calls: - self._inner_api_calls[ - "get_build" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_build, - default_retry=self._method_configs["GetBuild"].retry, - default_timeout=self._method_configs["GetBuild"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.GetBuildRequest(project_id=project_id, id=id_,) - return self._inner_api_calls["get_build"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def cancel_build( - self, - project_id, - id_, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Cancels a build in progress. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `id_`: - >>> id_ = '' - >>> - >>> response = client.cancel_build(project_id, id_) - - Args: - project_id (str): Required. ID of the project. - id_ (str): Required. ID of the build. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.Build` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "cancel_build" not in self._inner_api_calls: - self._inner_api_calls[ - "cancel_build" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.cancel_build, - default_retry=self._method_configs["CancelBuild"].retry, - default_timeout=self._method_configs["CancelBuild"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.CancelBuildRequest(project_id=project_id, id=id_,) - return self._inner_api_calls["cancel_build"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def retry_build( - self, - project_id, - id_, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a new build based on the specified build. - - This method creates a new build using the original build request, which - may or may not result in an identical build. - - For triggered builds: - - - Triggered builds resolve to a precise revision; therefore a retry of - a triggered build will result in a build that uses the same revision. - - For non-triggered builds that specify ``RepoSource``: - - - If the original build built from the tip of a branch, the retried - build will build from the tip of that branch, which may not be the - same revision as the original build. - - If the original build specified a commit sha or revision ID, the - retried build will use the identical source. - - For builds that specify ``StorageSource``: - - - If the original build pulled source from Google Cloud Storage without - specifying the generation of the object, the new build will use the - current object, which may be different from the original build - source. - - If the original build pulled source from Cloud Storage and specified - the generation of the object, the new build will attempt to use the - same object, which may or may not be available depending on the - bucket's lifecycle management settings. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `id_`: - >>> id_ = '' - >>> - >>> response = client.retry_build(project_id, id_) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - project_id (str): Required. ID of the project. - id_ (str): Required. Build ID of the original build. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "retry_build" not in self._inner_api_calls: - self._inner_api_calls[ - "retry_build" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.retry_build, - default_retry=self._method_configs["RetryBuild"].retry, - default_timeout=self._method_configs["RetryBuild"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.RetryBuildRequest(project_id=project_id, id=id_,) - operation = self._inner_api_calls["retry_build"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - cloudbuild_pb2.Build, - metadata_type=cloudbuild_pb2.BuildOperationMetadata, - ) - - def create_build_trigger( - self, - project_id, - trigger, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a new ``BuildTrigger``. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `trigger`: - >>> trigger = {} - >>> - >>> response = client.create_build_trigger(project_id, trigger) - - Args: - project_id (str): Required. ID of the project for which to configure automatic builds. - trigger (Union[dict, ~google.cloud.devtools.cloudbuild_v1.types.BuildTrigger]): Required. ``BuildTrigger`` to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.devtools.cloudbuild_v1.types.BuildTrigger` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.BuildTrigger` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_build_trigger" not in self._inner_api_calls: - self._inner_api_calls[ - "create_build_trigger" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_build_trigger, - default_retry=self._method_configs["CreateBuildTrigger"].retry, - default_timeout=self._method_configs["CreateBuildTrigger"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.CreateBuildTriggerRequest( - project_id=project_id, trigger=trigger, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("project_id", project_id)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_build_trigger"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def get_build_trigger( - self, - project_id, - trigger_id, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns information about a ``BuildTrigger``. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `trigger_id`: - >>> trigger_id = '' - >>> - >>> response = client.get_build_trigger(project_id, trigger_id) - - Args: - project_id (str): Required. ID of the project that owns the trigger. - trigger_id (str): Required. Identifier (``id`` or ``name``) of the ``BuildTrigger`` to - get. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.BuildTrigger` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_build_trigger" not in self._inner_api_calls: - self._inner_api_calls[ - "get_build_trigger" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_build_trigger, - default_retry=self._method_configs["GetBuildTrigger"].retry, - default_timeout=self._method_configs["GetBuildTrigger"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.GetBuildTriggerRequest( - project_id=project_id, trigger_id=trigger_id, - ) - return self._inner_api_calls["get_build_trigger"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def list_build_triggers( - self, - project_id, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Lists existing ``BuildTrigger``\ s. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_build_triggers(project_id): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_build_triggers(project_id).pages: - ... for element in page: - ... # process element - ... pass - - Args: - project_id (str): Required. ID of the project for which to list BuildTriggers. - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.devtools.cloudbuild_v1.types.BuildTrigger` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_build_triggers" not in self._inner_api_calls: - self._inner_api_calls[ - "list_build_triggers" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_build_triggers, - default_retry=self._method_configs["ListBuildTriggers"].retry, - default_timeout=self._method_configs["ListBuildTriggers"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.ListBuildTriggersRequest( - project_id=project_id, page_size=page_size, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("project_id", project_id)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_build_triggers"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="triggers", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def update_build_trigger( - self, - project_id, - trigger_id, - trigger, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates a ``BuildTrigger`` by its project ID and trigger ID. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `trigger_id`: - >>> trigger_id = '' - >>> - >>> # TODO: Initialize `trigger`: - >>> trigger = {} - >>> - >>> response = client.update_build_trigger(project_id, trigger_id, trigger) - - Args: - project_id (str): Required. ID of the project that owns the trigger. - trigger_id (str): Required. ID of the ``BuildTrigger`` to update. - trigger (Union[dict, ~google.cloud.devtools.cloudbuild_v1.types.BuildTrigger]): Required. ``BuildTrigger`` to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.devtools.cloudbuild_v1.types.BuildTrigger` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.BuildTrigger` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_build_trigger" not in self._inner_api_calls: - self._inner_api_calls[ - "update_build_trigger" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_build_trigger, - default_retry=self._method_configs["UpdateBuildTrigger"].retry, - default_timeout=self._method_configs["UpdateBuildTrigger"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.UpdateBuildTriggerRequest( - project_id=project_id, trigger_id=trigger_id, trigger=trigger, - ) - return self._inner_api_calls["update_build_trigger"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def run_build_trigger( - self, - project_id, - trigger_id, - source, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Runs a ``BuildTrigger`` at a particular source revision. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> # TODO: Initialize `project_id`: - >>> project_id = '' - >>> - >>> # TODO: Initialize `trigger_id`: - >>> trigger_id = '' - >>> - >>> # TODO: Initialize `source`: - >>> source = {} - >>> - >>> response = client.run_build_trigger(project_id, trigger_id, source) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - project_id (str): Required. ID of the project. - trigger_id (str): Required. ID of the trigger. - source (Union[dict, ~google.cloud.devtools.cloudbuild_v1.types.RepoSource]): Required. Source to build against this trigger. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.devtools.cloudbuild_v1.types.RepoSource` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "run_build_trigger" not in self._inner_api_calls: - self._inner_api_calls[ - "run_build_trigger" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.run_build_trigger, - default_retry=self._method_configs["RunBuildTrigger"].retry, - default_timeout=self._method_configs["RunBuildTrigger"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.RunBuildTriggerRequest( - project_id=project_id, trigger_id=trigger_id, source=source, - ) - operation = self._inner_api_calls["run_build_trigger"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - cloudbuild_pb2.Build, - metadata_type=cloudbuild_pb2.BuildOperationMetadata, - ) - - def create_worker_pool( - self, - parent=None, - worker_pool=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a ``WorkerPool`` to run the builds, and returns the new - worker pool. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> response = client.create_worker_pool() - - Args: - parent (str): ID of the parent project. - worker_pool (Union[dict, ~google.cloud.devtools.cloudbuild_v1.types.WorkerPool]): ``WorkerPool`` resource to create. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.devtools.cloudbuild_v1.types.WorkerPool` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.WorkerPool` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_worker_pool" not in self._inner_api_calls: - self._inner_api_calls[ - "create_worker_pool" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_worker_pool, - default_retry=self._method_configs["CreateWorkerPool"].retry, - default_timeout=self._method_configs["CreateWorkerPool"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.CreateWorkerPoolRequest( - parent=parent, worker_pool=worker_pool, - ) - return self._inner_api_calls["create_worker_pool"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def get_worker_pool( - self, - name=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Returns information about a ``WorkerPool``. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> response = client.get_worker_pool() - - Args: - name (str): The field will contain name of the resource requested, for example: - "projects/project-1/workerPools/workerpool-name" - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.WorkerPool` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_worker_pool" not in self._inner_api_calls: - self._inner_api_calls[ - "get_worker_pool" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_worker_pool, - default_retry=self._method_configs["GetWorkerPool"].retry, - default_timeout=self._method_configs["GetWorkerPool"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.GetWorkerPoolRequest(name=name,) - return self._inner_api_calls["get_worker_pool"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_worker_pool( - self, - name=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes a ``WorkerPool`` by its project ID and WorkerPool name. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> client.delete_worker_pool() - - Args: - name (str): The field will contain name of the resource requested, for example: - "projects/project-1/workerPools/workerpool-name" - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_worker_pool" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_worker_pool" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_worker_pool, - default_retry=self._method_configs["DeleteWorkerPool"].retry, - default_timeout=self._method_configs["DeleteWorkerPool"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.DeleteWorkerPoolRequest(name=name,) - self._inner_api_calls["delete_worker_pool"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_worker_pool( - self, - name=None, - worker_pool=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Update a ``WorkerPool``. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> response = client.update_worker_pool() - - Args: - name (str): The field will contain name of the resource requested, for example: - "projects/project-1/workerPools/workerpool-name" - worker_pool (Union[dict, ~google.cloud.devtools.cloudbuild_v1.types.WorkerPool]): ``WorkerPool`` resource to update. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.devtools.cloudbuild_v1.types.WorkerPool` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.WorkerPool` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_worker_pool" not in self._inner_api_calls: - self._inner_api_calls[ - "update_worker_pool" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_worker_pool, - default_retry=self._method_configs["UpdateWorkerPool"].retry, - default_timeout=self._method_configs["UpdateWorkerPool"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.UpdateWorkerPoolRequest( - name=name, worker_pool=worker_pool, - ) - return self._inner_api_calls["update_worker_pool"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def list_worker_pools( - self, - parent=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - List project's ``WorkerPool``\ s. - - This API is experimental. - - Example: - >>> from google.cloud.devtools import cloudbuild_v1 - >>> - >>> client = cloudbuild_v1.CloudBuildClient() - >>> - >>> response = client.list_worker_pools() - - Args: - parent (str): ID of the parent project. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.devtools.cloudbuild_v1.types.ListWorkerPoolsResponse` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_worker_pools" not in self._inner_api_calls: - self._inner_api_calls[ - "list_worker_pools" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_worker_pools, - default_retry=self._method_configs["ListWorkerPools"].retry, - default_timeout=self._method_configs["ListWorkerPools"].timeout, - client_info=self._client_info, - ) - - request = cloudbuild_pb2.ListWorkerPoolsRequest(parent=parent,) - return self._inner_api_calls["list_worker_pools"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/google/cloud/devtools/cloudbuild_v1/gapic/cloud_build_client_config.py b/google/cloud/devtools/cloudbuild_v1/gapic/cloud_build_client_config.py deleted file mode 100644 index abd20894..00000000 --- a/google/cloud/devtools/cloudbuild_v1/gapic/cloud_build_client_config.py +++ /dev/null @@ -1,103 +0,0 @@ -config = { - "interfaces": { - "google.devtools.cloudbuild.v1.CloudBuild": { - "retry_codes": { - "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "non_idempotent": [], - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 20000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 20000, - "total_timeout_millis": 600000, - } - }, - "methods": { - "ListBuilds": { - "timeout_millis": 20000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", - }, - "DeleteBuildTrigger": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", - }, - "CreateBuild": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "GetBuild": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", - }, - "CancelBuild": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "RetryBuild": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "CreateBuildTrigger": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "GetBuildTrigger": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", - }, - "ListBuildTriggers": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", - }, - "UpdateBuildTrigger": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "RunBuildTrigger": { - "timeout_millis": 180000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "CreateWorkerPool": { - "timeout_millis": 320000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "GetWorkerPool": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "DeleteWorkerPool": { - "timeout_millis": 320000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "UpdateWorkerPool": { - "timeout_millis": 20000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - "ListWorkerPools": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", - }, - }, - } - } -} diff --git a/google/cloud/devtools/cloudbuild_v1/gapic/enums.py b/google/cloud/devtools/cloudbuild_v1/gapic/enums.py deleted file mode 100644 index f49b47d2..00000000 --- a/google/cloud/devtools/cloudbuild_v1/gapic/enums.py +++ /dev/null @@ -1,189 +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. - -"""Wrappers for protocol buffer enum types.""" - -import enum - - -class Build(object): - class Status(enum.IntEnum): - """ - Possible status of a build or build step. - - Attributes: - STATUS_UNKNOWN (int): Status of the build is unknown. - QUEUED (int): Build or step is queued; work has not yet begun. - WORKING (int): Build or step is being executed. - SUCCESS (int): Build or step finished successfully. - FAILURE (int): Build or step failed to complete successfully. - INTERNAL_ERROR (int): Build or step failed due to an internal cause. - TIMEOUT (int): Build or step took longer than was allowed. - CANCELLED (int): Build or step was canceled by a user. - EXPIRED (int): Build was enqueued for longer than the value of ``queue_ttl``. - """ - - STATUS_UNKNOWN = 0 - QUEUED = 1 - WORKING = 2 - SUCCESS = 3 - FAILURE = 4 - INTERNAL_ERROR = 5 - TIMEOUT = 6 - CANCELLED = 7 - EXPIRED = 9 - - -class BuildOptions(object): - class LogStreamingOption(enum.IntEnum): - """ - Specifies the behavior when writing build logs to Google Cloud Storage. - - Attributes: - STREAM_DEFAULT (int): Service may automatically determine build log streaming behavior. - STREAM_ON (int): Build logs should be streamed to Google Cloud Storage. - STREAM_OFF (int): Build logs should not be streamed to Google Cloud Storage; they will be - written when the build is completed. - """ - - STREAM_DEFAULT = 0 - STREAM_ON = 1 - STREAM_OFF = 2 - - class LoggingMode(enum.IntEnum): - """ - Specifies the logging mode. - - Attributes: - LOGGING_UNSPECIFIED (int): The service determines the logging mode. The default is ``LEGACY``. - Do not rely on the default logging behavior as it may change in the - future. - LEGACY (int): Stackdriver logging and Cloud Storage logging are enabled. - GCS_ONLY (int): Only Cloud Storage logging is enabled. - """ - - LOGGING_UNSPECIFIED = 0 - LEGACY = 1 - GCS_ONLY = 2 - - class MachineType(enum.IntEnum): - """ - Supported VM sizes. - - Attributes: - UNSPECIFIED (int): Standard machine type. - N1_HIGHCPU_8 (int): Highcpu machine with 8 CPUs. - N1_HIGHCPU_32 (int): Highcpu machine with 32 CPUs. - """ - - UNSPECIFIED = 0 - N1_HIGHCPU_8 = 1 - N1_HIGHCPU_32 = 2 - - class SubstitutionOption(enum.IntEnum): - """ - Specifies the behavior when there is an error in the substitution checks. - - Attributes: - MUST_MATCH (int): Fails the build if error in substitutions checks, like missing - a substitution in the template or in the map. - ALLOW_LOOSE (int): Do not fail the build if error in substitutions checks. - """ - - MUST_MATCH = 0 - ALLOW_LOOSE = 1 - - class VerifyOption(enum.IntEnum): - """ - Specifies the manner in which the build should be verified, if at all. - - Attributes: - NOT_VERIFIED (int): Not a verifiable build. (default) - VERIFIED (int): Verified build. - """ - - NOT_VERIFIED = 0 - VERIFIED = 1 - - -class Hash(object): - class HashType(enum.IntEnum): - """ - Specifies the hash algorithm, if any. - - Attributes: - NONE (int): No hash requested. - SHA256 (int): Use a sha256 hash. - MD5 (int): Use a md5 hash. - """ - - NONE = 0 - SHA256 = 1 - MD5 = 2 - - -class PullRequestFilter(object): - class CommentControl(enum.IntEnum): - """ - Controls behavior of Pull Request comments. - - Attributes: - COMMENTS_DISABLED (int): Do not require comments on Pull Requests before builds are triggered. - COMMENTS_ENABLED (int): Enforce that repository owners or collaborators must comment on Pull - Requests before builds are triggered. - """ - - COMMENTS_DISABLED = 0 - COMMENTS_ENABLED = 1 - - -class WorkerPool(object): - class Region(enum.IntEnum): - """ - Supported GCP regions to create the ``WorkerPool``. - - Attributes: - REGION_UNSPECIFIED (int): no region - US_CENTRAL1 (int): us-central1 region - US_WEST1 (int): us-west1 region - US_EAST1 (int): us-east1 region - US_EAST4 (int): us-east4 region - """ - - REGION_UNSPECIFIED = 0 - US_CENTRAL1 = 1 - US_WEST1 = 2 - US_EAST1 = 3 - US_EAST4 = 4 - - class Status(enum.IntEnum): - """ - ``WorkerPool`` status - - Attributes: - STATUS_UNSPECIFIED (int): Status of the ``WorkerPool`` is unknown. - CREATING (int): ``WorkerPool`` is being created. - RUNNING (int): ``WorkerPool`` is running. - DELETING (int): ``WorkerPool`` is being deleted: cancelling builds and draining - workers. - DELETED (int): ``WorkerPool`` is deleted. - """ - - STATUS_UNSPECIFIED = 0 - CREATING = 1 - RUNNING = 2 - DELETING = 3 - DELETED = 4 diff --git a/google/cloud/devtools/cloudbuild_v1/gapic/transports/__init__.py b/google/cloud/devtools/cloudbuild_v1/gapic/transports/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/google/cloud/devtools/cloudbuild_v1/gapic/transports/cloud_build_grpc_transport.py b/google/cloud/devtools/cloudbuild_v1/gapic/transports/cloud_build_grpc_transport.py deleted file mode 100644 index 9bec8296..00000000 --- a/google/cloud/devtools/cloudbuild_v1/gapic/transports/cloud_build_grpc_transport.py +++ /dev/null @@ -1,382 +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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from google.cloud.devtools.cloudbuild_v1.proto import cloudbuild_pb2_grpc - - -class CloudBuildGrpcTransport(object): - """gRPC transport class providing stubs for - google.devtools.cloudbuild.v1 CloudBuild API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) - - def __init__( - self, channel=None, credentials=None, address="cloudbuild.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.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. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive.", - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "cloud_build_stub": cloudbuild_pb2_grpc.CloudBuildStub(channel), - } - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="cloudbuild.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.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. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def list_builds(self): - """Return the gRPC stub for :meth:`CloudBuildClient.list_builds`. - - Lists previously requested builds. - - Previously requested builds may still be in-progress, or may have finished - successfully or unsuccessfully. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].ListBuilds - - @property - def delete_build_trigger(self): - """Return the gRPC stub for :meth:`CloudBuildClient.delete_build_trigger`. - - Deletes a ``BuildTrigger`` by its project ID and trigger ID. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].DeleteBuildTrigger - - @property - def create_build(self): - """Return the gRPC stub for :meth:`CloudBuildClient.create_build`. - - Starts a build with the specified configuration. - - This method returns a long-running ``Operation``, which includes the - build ID. Pass the build ID to ``GetBuild`` to determine the build - status (such as ``SUCCESS`` or ``FAILURE``). - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].CreateBuild - - @property - def get_build(self): - """Return the gRPC stub for :meth:`CloudBuildClient.get_build`. - - Returns information about a previously requested build. - - The ``Build`` that is returned includes its status (such as ``SUCCESS``, - ``FAILURE``, or ``WORKING``), and timing information. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].GetBuild - - @property - def cancel_build(self): - """Return the gRPC stub for :meth:`CloudBuildClient.cancel_build`. - - Cancels a build in progress. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].CancelBuild - - @property - def retry_build(self): - """Return the gRPC stub for :meth:`CloudBuildClient.retry_build`. - - Creates a new build based on the specified build. - - This method creates a new build using the original build request, which - may or may not result in an identical build. - - For triggered builds: - - - Triggered builds resolve to a precise revision; therefore a retry of - a triggered build will result in a build that uses the same revision. - - For non-triggered builds that specify ``RepoSource``: - - - If the original build built from the tip of a branch, the retried - build will build from the tip of that branch, which may not be the - same revision as the original build. - - If the original build specified a commit sha or revision ID, the - retried build will use the identical source. - - For builds that specify ``StorageSource``: - - - If the original build pulled source from Google Cloud Storage without - specifying the generation of the object, the new build will use the - current object, which may be different from the original build - source. - - If the original build pulled source from Cloud Storage and specified - the generation of the object, the new build will attempt to use the - same object, which may or may not be available depending on the - bucket's lifecycle management settings. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].RetryBuild - - @property - def create_build_trigger(self): - """Return the gRPC stub for :meth:`CloudBuildClient.create_build_trigger`. - - Creates a new ``BuildTrigger``. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].CreateBuildTrigger - - @property - def get_build_trigger(self): - """Return the gRPC stub for :meth:`CloudBuildClient.get_build_trigger`. - - Returns information about a ``BuildTrigger``. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].GetBuildTrigger - - @property - def list_build_triggers(self): - """Return the gRPC stub for :meth:`CloudBuildClient.list_build_triggers`. - - Lists existing ``BuildTrigger``\ s. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].ListBuildTriggers - - @property - def update_build_trigger(self): - """Return the gRPC stub for :meth:`CloudBuildClient.update_build_trigger`. - - Updates a ``BuildTrigger`` by its project ID and trigger ID. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].UpdateBuildTrigger - - @property - def run_build_trigger(self): - """Return the gRPC stub for :meth:`CloudBuildClient.run_build_trigger`. - - Runs a ``BuildTrigger`` at a particular source revision. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].RunBuildTrigger - - @property - def create_worker_pool(self): - """Return the gRPC stub for :meth:`CloudBuildClient.create_worker_pool`. - - Creates a ``WorkerPool`` to run the builds, and returns the new - worker pool. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].CreateWorkerPool - - @property - def get_worker_pool(self): - """Return the gRPC stub for :meth:`CloudBuildClient.get_worker_pool`. - - Returns information about a ``WorkerPool``. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].GetWorkerPool - - @property - def delete_worker_pool(self): - """Return the gRPC stub for :meth:`CloudBuildClient.delete_worker_pool`. - - Deletes a ``WorkerPool`` by its project ID and WorkerPool name. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].DeleteWorkerPool - - @property - def update_worker_pool(self): - """Return the gRPC stub for :meth:`CloudBuildClient.update_worker_pool`. - - Update a ``WorkerPool``. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].UpdateWorkerPool - - @property - def list_worker_pools(self): - """Return the gRPC stub for :meth:`CloudBuildClient.list_worker_pools`. - - List project's ``WorkerPool``\ s. - - This API is experimental. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["cloud_build_stub"].ListWorkerPools diff --git a/google/cloud/devtools/cloudbuild_v1/proto/__init__.py b/google/cloud/devtools/cloudbuild_v1/proto/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild.proto b/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild.proto index 40692c3e..1f06623f 100644 --- a/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild.proto +++ b/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild.proto @@ -219,7 +219,7 @@ service CloudBuild { // This API is experimental. rpc UpdateWorkerPool(UpdateWorkerPoolRequest) returns (WorkerPool) {} - // List project's `WorkerPool`s. + // List project's `WorkerPools`. // // This API is experimental. rpc ListWorkerPools(ListWorkerPoolsRequest) @@ -1328,7 +1328,7 @@ message UpdateWorkerPoolRequest { WorkerPool worker_pool = 3; } -// Request to list `WorkerPool`s. +// Request to list `WorkerPools`. message ListWorkerPoolsRequest { // ID of the parent project. string parent = 1; diff --git a/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild_pb2.py b/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild_pb2.py deleted file mode 100644 index 573dd9a1..00000000 --- a/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild_pb2.py +++ /dev/null @@ -1,6905 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/devtools/cloudbuild_v1/proto/cloudbuild.proto - -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/devtools/cloudbuild_v1/proto/cloudbuild.proto", - package="google.devtools.cloudbuild.v1", - syntax="proto3", - serialized_options=b"\n\030com.google.cloudbuild.v1P\001ZGgoogle.golang.org/genproto/googleapis/devtools/cloudbuild/v1;cloudbuild\242\002\003GCB\352\002\030Google::Cloud::Build::V1", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n:google/cloud/devtools/cloudbuild_v1/proto/cloudbuild.proto\x12\x1dgoogle.devtools.cloudbuild.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a#google/longrunning/operations.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto"=\n\x11RetryBuildRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0f\n\x02id\x18\x02 \x01(\tB\x03\xe0\x41\x02"\x8a\x01\n\x16RunBuildTriggerRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\ntrigger_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12>\n\x06source\x18\x03 \x01(\x0b\x32).google.devtools.cloudbuild.v1.RepoSourceB\x03\xe0\x41\x02"C\n\rStorageSource\x12\x0e\n\x06\x62ucket\x18\x01 \x01(\t\x12\x0e\n\x06object\x18\x02 \x01(\t\x12\x12\n\ngeneration\x18\x03 \x01(\x03"\xae\x02\n\nRepoSource\x12\x12\n\nproject_id\x18\x01 \x01(\t\x12\x11\n\trepo_name\x18\x02 \x01(\t\x12\x15\n\x0b\x62ranch_name\x18\x03 \x01(\tH\x00\x12\x12\n\x08tag_name\x18\x04 \x01(\tH\x00\x12\x14\n\ncommit_sha\x18\x05 \x01(\tH\x00\x12\x0b\n\x03\x64ir\x18\x07 \x01(\t\x12\x14\n\x0cinvert_regex\x18\x08 \x01(\x08\x12S\n\rsubstitutions\x18\t \x03(\x0b\x32<.google.devtools.cloudbuild.v1.RepoSource.SubstitutionsEntry\x1a\x34\n\x12SubstitutionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\n\n\x08revision"\x9c\x01\n\x06Source\x12\x46\n\x0estorage_source\x18\x02 \x01(\x0b\x32,.google.devtools.cloudbuild.v1.StorageSourceH\x00\x12@\n\x0brepo_source\x18\x03 \x01(\x0b\x32).google.devtools.cloudbuild.v1.RepoSourceH\x00\x42\x08\n\x06source"m\n\nBuiltImage\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06\x64igest\x18\x03 \x01(\t\x12\x41\n\x0bpush_timing\x18\x04 \x01(\x0b\x32\'.google.devtools.cloudbuild.v1.TimeSpanB\x03\xe0\x41\x03"\xa4\x03\n\tBuildStep\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0b\n\x03\x65nv\x18\x02 \x03(\t\x12\x0c\n\x04\x61rgs\x18\x03 \x03(\t\x12\x0b\n\x03\x64ir\x18\x04 \x01(\t\x12\n\n\x02id\x18\x05 \x01(\t\x12\x10\n\x08wait_for\x18\x06 \x03(\t\x12\x12\n\nentrypoint\x18\x07 \x01(\t\x12\x12\n\nsecret_env\x18\x08 \x03(\t\x12\x36\n\x07volumes\x18\t \x03(\x0b\x32%.google.devtools.cloudbuild.v1.Volume\x12<\n\x06timing\x18\n \x01(\x0b\x32\'.google.devtools.cloudbuild.v1.TimeSpanB\x03\xe0\x41\x03\x12<\n\x0bpull_timing\x18\r \x01(\x0b\x32\'.google.devtools.cloudbuild.v1.TimeSpan\x12*\n\x07timeout\x18\x0b \x01(\x0b\x32\x19.google.protobuf.Duration\x12;\n\x06status\x18\x0c \x01(\x0e\x32+.google.devtools.cloudbuild.v1.Build.Status"$\n\x06Volume\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\t"\xef\x01\n\x07Results\x12\x39\n\x06images\x18\x02 \x03(\x0b\x32).google.devtools.cloudbuild.v1.BuiltImage\x12\x19\n\x11\x62uild_step_images\x18\x03 \x03(\t\x12\x19\n\x11\x61rtifact_manifest\x18\x04 \x01(\t\x12\x15\n\rnum_artifacts\x18\x05 \x01(\x03\x12\x1a\n\x12\x62uild_step_outputs\x18\x06 \x03(\x0c\x12@\n\x0f\x61rtifact_timing\x18\x07 \x01(\x0b\x32\'.google.devtools.cloudbuild.v1.TimeSpan"`\n\x0e\x41rtifactResult\x12\x10\n\x08location\x18\x01 \x01(\t\x12<\n\tfile_hash\x18\x02 \x03(\x0b\x32).google.devtools.cloudbuild.v1.FileHashes"\xc4\n\n\x05\x42uild\x12\x0f\n\x02id\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x17\n\nproject_id\x18\x10 \x01(\tB\x03\xe0\x41\x03\x12;\n\x06status\x18\x02 \x01(\x0e\x32+.google.devtools.cloudbuild.v1.Build.Status\x12\x15\n\rstatus_detail\x18\x18 \x01(\t\x12\x35\n\x06source\x18\x03 \x01(\x0b\x32%.google.devtools.cloudbuild.v1.Source\x12\x37\n\x05steps\x18\x0b \x03(\x0b\x32(.google.devtools.cloudbuild.v1.BuildStep\x12<\n\x07results\x18\n \x01(\x0b\x32&.google.devtools.cloudbuild.v1.ResultsB\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x33\n\nstart_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0b\x66inish_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12*\n\x07timeout\x18\x0c \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0e\n\x06images\x18\r \x03(\t\x12,\n\tqueue_ttl\x18( \x01(\x0b\x32\x19.google.protobuf.Duration\x12;\n\tartifacts\x18% \x01(\x0b\x32(.google.devtools.cloudbuild.v1.Artifacts\x12\x13\n\x0blogs_bucket\x18\x13 \x01(\t\x12J\n\x11source_provenance\x18\x15 \x01(\x0b\x32/.google.devtools.cloudbuild.v1.SourceProvenance\x12\x18\n\x10\x62uild_trigger_id\x18\x16 \x01(\t\x12<\n\x07options\x18\x17 \x01(\x0b\x32+.google.devtools.cloudbuild.v1.BuildOptions\x12\x14\n\x07log_url\x18\x19 \x01(\tB\x03\xe0\x41\x03\x12N\n\rsubstitutions\x18\x1d \x03(\x0b\x32\x37.google.devtools.cloudbuild.v1.Build.SubstitutionsEntry\x12\x0c\n\x04tags\x18\x1f \x03(\t\x12\x36\n\x07secrets\x18 \x03(\x0b\x32%.google.devtools.cloudbuild.v1.Secret\x12\x45\n\x06timing\x18! \x03(\x0b\x32\x30.google.devtools.cloudbuild.v1.Build.TimingEntryB\x03\xe0\x41\x03\x1a\x34\n\x12SubstitutionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1aV\n\x0bTimingEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.devtools.cloudbuild.v1.TimeSpan:\x02\x38\x01"\x8c\x01\n\x06Status\x12\x12\n\x0eSTATUS_UNKNOWN\x10\x00\x12\n\n\x06QUEUED\x10\x01\x12\x0b\n\x07WORKING\x10\x02\x12\x0b\n\x07SUCCESS\x10\x03\x12\x0b\n\x07\x46\x41ILURE\x10\x04\x12\x12\n\x0eINTERNAL_ERROR\x10\x05\x12\x0b\n\x07TIMEOUT\x10\x06\x12\r\n\tCANCELLED\x10\x07\x12\x0b\n\x07\x45XPIRED\x10\t"\xd3\x01\n\tArtifacts\x12\x0e\n\x06images\x18\x01 \x03(\t\x12I\n\x07objects\x18\x02 \x01(\x0b\x32\x38.google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects\x1ak\n\x0f\x41rtifactObjects\x12\x10\n\x08location\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12\x37\n\x06timing\x18\x03 \x01(\x0b\x32\'.google.devtools.cloudbuild.v1.TimeSpan"h\n\x08TimeSpan\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"M\n\x16\x42uildOperationMetadata\x12\x33\n\x05\x62uild\x18\x01 \x01(\x0b\x32$.google.devtools.cloudbuild.v1.Build"\xe3\x02\n\x10SourceProvenance\x12M\n\x17resolved_storage_source\x18\x03 \x01(\x0b\x32,.google.devtools.cloudbuild.v1.StorageSource\x12G\n\x14resolved_repo_source\x18\x06 \x01(\x0b\x32).google.devtools.cloudbuild.v1.RepoSource\x12Y\n\x0b\x66ile_hashes\x18\x04 \x03(\x0b\x32?.google.devtools.cloudbuild.v1.SourceProvenance.FileHashesEntryB\x03\xe0\x41\x03\x1a\\\n\x0f\x46ileHashesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).google.devtools.cloudbuild.v1.FileHashes:\x02\x38\x01"D\n\nFileHashes\x12\x36\n\tfile_hash\x18\x01 \x03(\x0b\x32#.google.devtools.cloudbuild.v1.Hash"|\n\x04Hash\x12:\n\x04type\x18\x01 \x01(\x0e\x32,.google.devtools.cloudbuild.v1.Hash.HashType\x12\r\n\x05value\x18\x02 \x01(\x0c")\n\x08HashType\x12\x08\n\x04NONE\x10\x00\x12\n\n\x06SHA256\x10\x01\x12\x07\n\x03MD5\x10\x02"\x9a\x01\n\x06Secret\x12\x14\n\x0ckms_key_name\x18\x01 \x01(\t\x12H\n\nsecret_env\x18\x03 \x03(\x0b\x32\x34.google.devtools.cloudbuild.v1.Secret.SecretEnvEntry\x1a\x30\n\x0eSecretEnvEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01"g\n\x12\x43reateBuildRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x38\n\x05\x62uild\x18\x02 \x01(\x0b\x32$.google.devtools.cloudbuild.v1.BuildB\x03\xe0\x41\x02";\n\x0fGetBuildRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0f\n\x02id\x18\x02 \x01(\tB\x03\xe0\x41\x02"c\n\x11ListBuildsRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x08 \x01(\t"c\n\x12ListBuildsResponse\x12\x34\n\x06\x62uilds\x18\x01 \x03(\x0b\x32$.google.devtools.cloudbuild.v1.Build\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t">\n\x12\x43\x61ncelBuildRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0f\n\x02id\x18\x02 \x01(\tB\x03\xe0\x41\x02"\xb9\x04\n\x0c\x42uildTrigger\x12\x0f\n\x02id\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x13\n\x0b\x64\x65scription\x18\n \x01(\t\x12\x0c\n\x04name\x18\x15 \x01(\t\x12\x0c\n\x04tags\x18\x13 \x03(\t\x12\x43\n\x10trigger_template\x18\x07 \x01(\x0b\x32).google.devtools.cloudbuild.v1.RepoSource\x12\x41\n\x06github\x18\r \x01(\x0b\x32\x31.google.devtools.cloudbuild.v1.GitHubEventsConfig\x12\x35\n\x05\x62uild\x18\x04 \x01(\x0b\x32$.google.devtools.cloudbuild.v1.BuildH\x00\x12\x12\n\x08\x66ilename\x18\x08 \x01(\tH\x00\x12\x34\n\x0b\x63reate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x10\n\x08\x64isabled\x18\t \x01(\x08\x12U\n\rsubstitutions\x18\x0b \x03(\x0b\x32>.google.devtools.cloudbuild.v1.BuildTrigger.SubstitutionsEntry\x12\x15\n\rignored_files\x18\x0f \x03(\t\x12\x16\n\x0eincluded_files\x18\x10 \x03(\t\x1a\x34\n\x12SubstitutionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x10\n\x0e\x62uild_template"\xdc\x01\n\x12GitHubEventsConfig\x12\x1b\n\x0finstallation_id\x18\x01 \x01(\x03\x42\x02\x18\x01\x12\r\n\x05owner\x18\x06 \x01(\t\x12\x0c\n\x04name\x18\x07 \x01(\t\x12H\n\x0cpull_request\x18\x04 \x01(\x0b\x32\x30.google.devtools.cloudbuild.v1.PullRequestFilterH\x00\x12\x39\n\x04push\x18\x05 \x01(\x0b\x32).google.devtools.cloudbuild.v1.PushFilterH\x00\x42\x07\n\x05\x65vent"\xdf\x01\n\x11PullRequestFilter\x12\x10\n\x06\x62ranch\x18\x02 \x01(\tH\x00\x12X\n\x0f\x63omment_control\x18\x05 \x01(\x0e\x32?.google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl\x12\x14\n\x0cinvert_regex\x18\x06 \x01(\x08"=\n\x0e\x43ommentControl\x12\x15\n\x11\x43OMMENTS_DISABLED\x10\x00\x12\x14\n\x10\x43OMMENTS_ENABLED\x10\x01\x42\t\n\x07git_ref"N\n\nPushFilter\x12\x10\n\x06\x62ranch\x18\x02 \x01(\tH\x00\x12\r\n\x03tag\x18\x03 \x01(\tH\x00\x12\x14\n\x0cinvert_regex\x18\x04 \x01(\x08\x42\t\n\x07git_ref"w\n\x19\x43reateBuildTriggerRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x41\n\x07trigger\x18\x02 \x01(\x0b\x32+.google.devtools.cloudbuild.v1.BuildTriggerB\x03\xe0\x41\x02"J\n\x16GetBuildTriggerRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\ntrigger_id\x18\x02 \x01(\tB\x03\xe0\x41\x02"Z\n\x18ListBuildTriggersRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"s\n\x19ListBuildTriggersResponse\x12=\n\x08triggers\x18\x01 \x03(\x0b\x32+.google.devtools.cloudbuild.v1.BuildTrigger\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"M\n\x19\x44\x65leteBuildTriggerRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\ntrigger_id\x18\x02 \x01(\tB\x03\xe0\x41\x02"\x90\x01\n\x19UpdateBuildTriggerRequest\x12\x17\n\nproject_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\ntrigger_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x41\n\x07trigger\x18\x03 \x01(\x0b\x32+.google.devtools.cloudbuild.v1.BuildTriggerB\x03\xe0\x41\x02"\xc6\x07\n\x0c\x42uildOptions\x12L\n\x16source_provenance_hash\x18\x01 \x03(\x0e\x32,.google.devtools.cloudbuild.v1.Hash.HashType\x12Y\n\x17requested_verify_option\x18\x02 \x01(\x0e\x32\x38.google.devtools.cloudbuild.v1.BuildOptions.VerifyOption\x12M\n\x0cmachine_type\x18\x03 \x01(\x0e\x32\x37.google.devtools.cloudbuild.v1.BuildOptions.MachineType\x12\x14\n\x0c\x64isk_size_gb\x18\x06 \x01(\x03\x12[\n\x13substitution_option\x18\x04 \x01(\x0e\x32>.google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption\x12\\\n\x14log_streaming_option\x18\x05 \x01(\x0e\x32>.google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption\x12\x13\n\x0bworker_pool\x18\x07 \x01(\t\x12H\n\x07logging\x18\x0b \x01(\x0e\x32\x37.google.devtools.cloudbuild.v1.BuildOptions.LoggingMode\x12\x0b\n\x03\x65nv\x18\x0c \x03(\t\x12\x12\n\nsecret_env\x18\r \x03(\t\x12\x36\n\x07volumes\x18\x0e \x03(\x0b\x32%.google.devtools.cloudbuild.v1.Volume".\n\x0cVerifyOption\x12\x10\n\x0cNOT_VERIFIED\x10\x00\x12\x0c\n\x08VERIFIED\x10\x01"C\n\x0bMachineType\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x10\n\x0cN1_HIGHCPU_8\x10\x01\x12\x11\n\rN1_HIGHCPU_32\x10\x02"5\n\x12SubstitutionOption\x12\x0e\n\nMUST_MATCH\x10\x00\x12\x0f\n\x0b\x41LLOW_LOOSE\x10\x01"G\n\x12LogStreamingOption\x12\x12\n\x0eSTREAM_DEFAULT\x10\x00\x12\r\n\tSTREAM_ON\x10\x01\x12\x0e\n\nSTREAM_OFF\x10\x02"@\n\x0bLoggingMode\x12\x17\n\x13LOGGING_UNSPECIFIED\x10\x00\x12\n\n\x06LEGACY\x10\x01\x12\x0c\n\x08GCS_ONLY\x10\x02"\xf4\x04\n\nWorkerPool\x12\x0c\n\x04name\x18\x0e \x01(\t\x12\x12\n\nproject_id\x18\x02 \x01(\t\x12\x1d\n\x15service_account_email\x18\x03 \x01(\t\x12\x14\n\x0cworker_count\x18\x04 \x01(\x03\x12\x42\n\rworker_config\x18\x10 \x01(\x0b\x32+.google.devtools.cloudbuild.v1.WorkerConfig\x12\x41\n\x07regions\x18\t \x03(\x0e\x32\x30.google.devtools.cloudbuild.v1.WorkerPool.Region\x12/\n\x0b\x63reate_time\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x11 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x64\x65lete_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12@\n\x06status\x18\r \x01(\x0e\x32\x30.google.devtools.cloudbuild.v1.WorkerPool.Status"[\n\x06Region\x12\x16\n\x12REGION_UNSPECIFIED\x10\x00\x12\x0f\n\x0bUS_CENTRAL1\x10\x01\x12\x0c\n\x08US_WEST1\x10\x02\x12\x0c\n\x08US_EAST1\x10\x03\x12\x0c\n\x08US_EAST4\x10\x04"V\n\x06Status\x12\x16\n\x12STATUS_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43REATING\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\x0c\n\x08\x44\x45LETING\x10\x03\x12\x0b\n\x07\x44\x45LETED\x10\x04"\x80\x01\n\x0cWorkerConfig\x12\x14\n\x0cmachine_type\x18\x01 \x01(\t\x12\x14\n\x0c\x64isk_size_gb\x18\x02 \x01(\x03\x12\x37\n\x07network\x18\x03 \x01(\x0b\x32&.google.devtools.cloudbuild.v1.Network\x12\x0b\n\x03tag\x18\x04 \x01(\t"B\n\x07Network\x12\x12\n\nproject_id\x18\x01 \x01(\t\x12\x0f\n\x07network\x18\x02 \x01(\t\x12\x12\n\nsubnetwork\x18\x03 \x01(\t"i\n\x17\x43reateWorkerPoolRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12>\n\x0bworker_pool\x18\x02 \x01(\x0b\x32).google.devtools.cloudbuild.v1.WorkerPool"$\n\x14GetWorkerPoolRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\'\n\x17\x44\x65leteWorkerPoolRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"g\n\x17UpdateWorkerPoolRequest\x12\x0c\n\x04name\x18\x02 \x01(\t\x12>\n\x0bworker_pool\x18\x03 \x01(\x0b\x32).google.devtools.cloudbuild.v1.WorkerPool"(\n\x16ListWorkerPoolsRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t"Z\n\x17ListWorkerPoolsResponse\x12?\n\x0cworker_pools\x18\x01 \x03(\x0b\x32).google.devtools.cloudbuild.v1.WorkerPool2\xa1\x16\n\nCloudBuild\x12\xc5\x01\n\x0b\x43reateBuild\x12\x31.google.devtools.cloudbuild.v1.CreateBuildRequest\x1a\x1d.google.longrunning.Operation"d\x82\xd3\xe4\x93\x02)" /v1/projects/{project_id}/builds:\x05\x62uild\xda\x41\x10project_id,build\xca\x41\x1f\n\x05\x42uild\x12\x16\x42uildOperationMetadata\x12\x9f\x01\n\x08GetBuild\x12..google.devtools.cloudbuild.v1.GetBuildRequest\x1a$.google.devtools.cloudbuild.v1.Build"=\x82\xd3\xe4\x93\x02\'\x12%/v1/projects/{project_id}/builds/{id}\xda\x41\rproject_id,id\x12\xaf\x01\n\nListBuilds\x12\x30.google.devtools.cloudbuild.v1.ListBuildsRequest\x1a\x31.google.devtools.cloudbuild.v1.ListBuildsResponse"<\x82\xd3\xe4\x93\x02"\x12 /v1/projects/{project_id}/builds\xda\x41\x11project_id,filter\x12\xaf\x01\n\x0b\x43\x61ncelBuild\x12\x31.google.devtools.cloudbuild.v1.CancelBuildRequest\x1a$.google.devtools.cloudbuild.v1.Build"G\x82\xd3\xe4\x93\x02\x31",/v1/projects/{project_id}/builds/{id}:cancel:\x01*\xda\x41\rproject_id,id\x12\xc7\x01\n\nRetryBuild\x12\x30.google.devtools.cloudbuild.v1.RetryBuildRequest\x1a\x1d.google.longrunning.Operation"h\x82\xd3\xe4\x93\x02\x30"+/v1/projects/{project_id}/builds/{id}:retry:\x01*\xda\x41\rproject_id,id\xca\x41\x1f\n\x05\x42uild\x12\x16\x42uildOperationMetadata\x12\xc5\x01\n\x12\x43reateBuildTrigger\x12\x38.google.devtools.cloudbuild.v1.CreateBuildTriggerRequest\x1a+.google.devtools.cloudbuild.v1.BuildTrigger"H\x82\xd3\xe4\x93\x02-""/v1/projects/{project_id}/triggers:\x07trigger\xda\x41\x12project_id,trigger\x12\xc6\x01\n\x0fGetBuildTrigger\x12\x35.google.devtools.cloudbuild.v1.GetBuildTriggerRequest\x1a+.google.devtools.cloudbuild.v1.BuildTrigger"O\x82\xd3\xe4\x93\x02\x31\x12//v1/projects/{project_id}/triggers/{trigger_id}\xda\x41\x15project_id,trigger_id\x12\xbf\x01\n\x11ListBuildTriggers\x12\x37.google.devtools.cloudbuild.v1.ListBuildTriggersRequest\x1a\x38.google.devtools.cloudbuild.v1.ListBuildTriggersResponse"7\x82\xd3\xe4\x93\x02$\x12"/v1/projects/{project_id}/triggers\xda\x41\nproject_id\x12\xb7\x01\n\x12\x44\x65leteBuildTrigger\x12\x38.google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest\x1a\x16.google.protobuf.Empty"O\x82\xd3\xe4\x93\x02\x31*//v1/projects/{project_id}/triggers/{trigger_id}\xda\x41\x15project_id,trigger_id\x12\xdd\x01\n\x12UpdateBuildTrigger\x12\x38.google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest\x1a+.google.devtools.cloudbuild.v1.BuildTrigger"`\x82\xd3\xe4\x93\x02:2//v1/projects/{project_id}/triggers/{trigger_id}:\x07trigger\xda\x41\x1dproject_id,trigger_id,trigger\x12\xee\x01\n\x0fRunBuildTrigger\x12\x35.google.devtools.cloudbuild.v1.RunBuildTriggerRequest\x1a\x1d.google.longrunning.Operation"\x84\x01\x82\xd3\xe4\x93\x02="3/v1/projects/{project_id}/triggers/{trigger_id}:run:\x06source\xda\x41\x1cproject_id,trigger_id,source\xca\x41\x1f\n\x05\x42uild\x12\x16\x42uildOperationMetadata\x12w\n\x10\x43reateWorkerPool\x12\x36.google.devtools.cloudbuild.v1.CreateWorkerPoolRequest\x1a).google.devtools.cloudbuild.v1.WorkerPool"\x00\x12q\n\rGetWorkerPool\x12\x33.google.devtools.cloudbuild.v1.GetWorkerPoolRequest\x1a).google.devtools.cloudbuild.v1.WorkerPool"\x00\x12\x64\n\x10\x44\x65leteWorkerPool\x12\x36.google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest\x1a\x16.google.protobuf.Empty"\x00\x12w\n\x10UpdateWorkerPool\x12\x36.google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest\x1a).google.devtools.cloudbuild.v1.WorkerPool"\x00\x12\x82\x01\n\x0fListWorkerPools\x12\x35.google.devtools.cloudbuild.v1.ListWorkerPoolsRequest\x1a\x36.google.devtools.cloudbuild.v1.ListWorkerPoolsResponse"\x00\x1aM\xca\x41\x19\x63loudbuild.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x86\x01\n\x18\x63om.google.cloudbuild.v1P\x01ZGgoogle.golang.org/genproto/googleapis/devtools/cloudbuild/v1;cloudbuild\xa2\x02\x03GCB\xea\x02\x18Google::Cloud::Build::V1b\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - ], -) - - -_BUILD_STATUS = _descriptor.EnumDescriptor( - name="Status", - full_name="google.devtools.cloudbuild.v1.Build.Status", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="STATUS_UNKNOWN", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="QUEUED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WORKING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SUCCESS", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FAILURE", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INTERNAL_ERROR", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TIMEOUT", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CANCELLED", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EXPIRED", - index=8, - number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3170, - serialized_end=3310, -) -_sym_db.RegisterEnumDescriptor(_BUILD_STATUS) - -_HASH_HASHTYPE = _descriptor.EnumDescriptor( - name="HashType", - full_name="google.devtools.cloudbuild.v1.Hash.HashType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="NONE", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SHA256", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MD5", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=4222, - serialized_end=4263, -) -_sym_db.RegisterEnumDescriptor(_HASH_HASHTYPE) - -_PULLREQUESTFILTER_COMMENTCONTROL = _descriptor.EnumDescriptor( - name="CommentControl", - full_name="google.devtools.cloudbuild.v1.PullRequestFilter.CommentControl", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="COMMENTS_DISABLED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="COMMENTS_ENABLED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=5801, - serialized_end=5862, -) -_sym_db.RegisterEnumDescriptor(_PULLREQUESTFILTER_COMMENTCONTROL) - -_BUILDOPTIONS_VERIFYOPTION = _descriptor.EnumDescriptor( - name="VerifyOption", - full_name="google.devtools.cloudbuild.v1.BuildOptions.VerifyOption", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="NOT_VERIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VERIFIED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=7245, - serialized_end=7291, -) -_sym_db.RegisterEnumDescriptor(_BUILDOPTIONS_VERIFYOPTION) - -_BUILDOPTIONS_MACHINETYPE = _descriptor.EnumDescriptor( - name="MachineType", - full_name="google.devtools.cloudbuild.v1.BuildOptions.MachineType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="N1_HIGHCPU_8", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="N1_HIGHCPU_32", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=7293, - serialized_end=7360, -) -_sym_db.RegisterEnumDescriptor(_BUILDOPTIONS_MACHINETYPE) - -_BUILDOPTIONS_SUBSTITUTIONOPTION = _descriptor.EnumDescriptor( - name="SubstitutionOption", - full_name="google.devtools.cloudbuild.v1.BuildOptions.SubstitutionOption", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="MUST_MATCH", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ALLOW_LOOSE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=7362, - serialized_end=7415, -) -_sym_db.RegisterEnumDescriptor(_BUILDOPTIONS_SUBSTITUTIONOPTION) - -_BUILDOPTIONS_LOGSTREAMINGOPTION = _descriptor.EnumDescriptor( - name="LogStreamingOption", - full_name="google.devtools.cloudbuild.v1.BuildOptions.LogStreamingOption", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="STREAM_DEFAULT", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="STREAM_ON", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="STREAM_OFF", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=7417, - serialized_end=7488, -) -_sym_db.RegisterEnumDescriptor(_BUILDOPTIONS_LOGSTREAMINGOPTION) - -_BUILDOPTIONS_LOGGINGMODE = _descriptor.EnumDescriptor( - name="LoggingMode", - full_name="google.devtools.cloudbuild.v1.BuildOptions.LoggingMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="LOGGING_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LEGACY", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="GCS_ONLY", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=7490, - serialized_end=7554, -) -_sym_db.RegisterEnumDescriptor(_BUILDOPTIONS_LOGGINGMODE) - -_WORKERPOOL_REGION = _descriptor.EnumDescriptor( - name="Region", - full_name="google.devtools.cloudbuild.v1.WorkerPool.Region", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="REGION_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="US_CENTRAL1", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="US_WEST1", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="US_EAST1", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="US_EAST4", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=8006, - serialized_end=8097, -) -_sym_db.RegisterEnumDescriptor(_WORKERPOOL_REGION) - -_WORKERPOOL_STATUS = _descriptor.EnumDescriptor( - name="Status", - full_name="google.devtools.cloudbuild.v1.WorkerPool.Status", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="STATUS_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CREATING", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="RUNNING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DELETING", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DELETED", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=8099, - serialized_end=8185, -) -_sym_db.RegisterEnumDescriptor(_WORKERPOOL_STATUS) - - -_RETRYBUILDREQUEST = _descriptor.Descriptor( - name="RetryBuildRequest", - full_name="google.devtools.cloudbuild.v1.RetryBuildRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.RetryBuildRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="id", - full_name="google.devtools.cloudbuild.v1.RetryBuildRequest.id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=312, - serialized_end=373, -) - - -_RUNBUILDTRIGGERREQUEST = _descriptor.Descriptor( - name="RunBuildTriggerRequest", - full_name="google.devtools.cloudbuild.v1.RunBuildTriggerRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.RunBuildTriggerRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="trigger_id", - full_name="google.devtools.cloudbuild.v1.RunBuildTriggerRequest.trigger_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="source", - full_name="google.devtools.cloudbuild.v1.RunBuildTriggerRequest.source", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=376, - serialized_end=514, -) - - -_STORAGESOURCE = _descriptor.Descriptor( - name="StorageSource", - full_name="google.devtools.cloudbuild.v1.StorageSource", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="bucket", - full_name="google.devtools.cloudbuild.v1.StorageSource.bucket", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="object", - full_name="google.devtools.cloudbuild.v1.StorageSource.object", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="generation", - full_name="google.devtools.cloudbuild.v1.StorageSource.generation", - index=2, - number=3, - type=3, - cpp_type=2, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=516, - serialized_end=583, -) - - -_REPOSOURCE_SUBSTITUTIONSENTRY = _descriptor.Descriptor( - name="SubstitutionsEntry", - full_name="google.devtools.cloudbuild.v1.RepoSource.SubstitutionsEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.devtools.cloudbuild.v1.RepoSource.SubstitutionsEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.devtools.cloudbuild.v1.RepoSource.SubstitutionsEntry.value", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=824, - serialized_end=876, -) - -_REPOSOURCE = _descriptor.Descriptor( - name="RepoSource", - full_name="google.devtools.cloudbuild.v1.RepoSource", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.RepoSource.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="repo_name", - full_name="google.devtools.cloudbuild.v1.RepoSource.repo_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="branch_name", - full_name="google.devtools.cloudbuild.v1.RepoSource.branch_name", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="tag_name", - full_name="google.devtools.cloudbuild.v1.RepoSource.tag_name", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="commit_sha", - full_name="google.devtools.cloudbuild.v1.RepoSource.commit_sha", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="dir", - full_name="google.devtools.cloudbuild.v1.RepoSource.dir", - index=5, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="invert_regex", - full_name="google.devtools.cloudbuild.v1.RepoSource.invert_regex", - index=6, - number=8, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="substitutions", - full_name="google.devtools.cloudbuild.v1.RepoSource.substitutions", - index=7, - number=9, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_REPOSOURCE_SUBSTITUTIONSENTRY,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="revision", - full_name="google.devtools.cloudbuild.v1.RepoSource.revision", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=586, - serialized_end=888, -) - - -_SOURCE = _descriptor.Descriptor( - name="Source", - full_name="google.devtools.cloudbuild.v1.Source", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="storage_source", - full_name="google.devtools.cloudbuild.v1.Source.storage_source", - index=0, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="repo_source", - full_name="google.devtools.cloudbuild.v1.Source.repo_source", - index=1, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="source", - full_name="google.devtools.cloudbuild.v1.Source.source", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=891, - serialized_end=1047, -) - - -_BUILTIMAGE = _descriptor.Descriptor( - name="BuiltImage", - full_name="google.devtools.cloudbuild.v1.BuiltImage", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.BuiltImage.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="digest", - full_name="google.devtools.cloudbuild.v1.BuiltImage.digest", - index=1, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="push_timing", - full_name="google.devtools.cloudbuild.v1.BuiltImage.push_timing", - index=2, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1049, - serialized_end=1158, -) - - -_BUILDSTEP = _descriptor.Descriptor( - name="BuildStep", - full_name="google.devtools.cloudbuild.v1.BuildStep", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.BuildStep.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="env", - full_name="google.devtools.cloudbuild.v1.BuildStep.env", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="args", - full_name="google.devtools.cloudbuild.v1.BuildStep.args", - index=2, - number=3, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="dir", - full_name="google.devtools.cloudbuild.v1.BuildStep.dir", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="id", - full_name="google.devtools.cloudbuild.v1.BuildStep.id", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="wait_for", - full_name="google.devtools.cloudbuild.v1.BuildStep.wait_for", - index=5, - number=6, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="entrypoint", - full_name="google.devtools.cloudbuild.v1.BuildStep.entrypoint", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="secret_env", - full_name="google.devtools.cloudbuild.v1.BuildStep.secret_env", - index=7, - number=8, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="volumes", - full_name="google.devtools.cloudbuild.v1.BuildStep.volumes", - index=8, - number=9, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="timing", - full_name="google.devtools.cloudbuild.v1.BuildStep.timing", - index=9, - number=10, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="pull_timing", - full_name="google.devtools.cloudbuild.v1.BuildStep.pull_timing", - index=10, - number=13, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="timeout", - full_name="google.devtools.cloudbuild.v1.BuildStep.timeout", - index=11, - number=11, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="status", - full_name="google.devtools.cloudbuild.v1.BuildStep.status", - index=12, - number=12, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1161, - serialized_end=1581, -) - - -_VOLUME = _descriptor.Descriptor( - name="Volume", - full_name="google.devtools.cloudbuild.v1.Volume", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.Volume.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="path", - full_name="google.devtools.cloudbuild.v1.Volume.path", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1583, - serialized_end=1619, -) - - -_RESULTS = _descriptor.Descriptor( - name="Results", - full_name="google.devtools.cloudbuild.v1.Results", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="images", - full_name="google.devtools.cloudbuild.v1.Results.images", - index=0, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="build_step_images", - full_name="google.devtools.cloudbuild.v1.Results.build_step_images", - index=1, - number=3, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="artifact_manifest", - full_name="google.devtools.cloudbuild.v1.Results.artifact_manifest", - index=2, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="num_artifacts", - full_name="google.devtools.cloudbuild.v1.Results.num_artifacts", - index=3, - number=5, - type=3, - cpp_type=2, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="build_step_outputs", - full_name="google.devtools.cloudbuild.v1.Results.build_step_outputs", - index=4, - number=6, - type=12, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="artifact_timing", - full_name="google.devtools.cloudbuild.v1.Results.artifact_timing", - index=5, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1622, - serialized_end=1861, -) - - -_ARTIFACTRESULT = _descriptor.Descriptor( - name="ArtifactResult", - full_name="google.devtools.cloudbuild.v1.ArtifactResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="location", - full_name="google.devtools.cloudbuild.v1.ArtifactResult.location", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="file_hash", - full_name="google.devtools.cloudbuild.v1.ArtifactResult.file_hash", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1863, - serialized_end=1959, -) - - -_BUILD_SUBSTITUTIONSENTRY = _descriptor.Descriptor( - name="SubstitutionsEntry", - full_name="google.devtools.cloudbuild.v1.Build.SubstitutionsEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.devtools.cloudbuild.v1.Build.SubstitutionsEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.devtools.cloudbuild.v1.Build.SubstitutionsEntry.value", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=824, - serialized_end=876, -) - -_BUILD_TIMINGENTRY = _descriptor.Descriptor( - name="TimingEntry", - full_name="google.devtools.cloudbuild.v1.Build.TimingEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.devtools.cloudbuild.v1.Build.TimingEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.devtools.cloudbuild.v1.Build.TimingEntry.value", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3081, - serialized_end=3167, -) - -_BUILD = _descriptor.Descriptor( - name="Build", - full_name="google.devtools.cloudbuild.v1.Build", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="id", - full_name="google.devtools.cloudbuild.v1.Build.id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.Build.project_id", - index=1, - number=16, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="status", - full_name="google.devtools.cloudbuild.v1.Build.status", - index=2, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="status_detail", - full_name="google.devtools.cloudbuild.v1.Build.status_detail", - index=3, - number=24, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="source", - full_name="google.devtools.cloudbuild.v1.Build.source", - index=4, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="steps", - full_name="google.devtools.cloudbuild.v1.Build.steps", - index=5, - number=11, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="results", - full_name="google.devtools.cloudbuild.v1.Build.results", - index=6, - number=10, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="create_time", - full_name="google.devtools.cloudbuild.v1.Build.create_time", - index=7, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="start_time", - full_name="google.devtools.cloudbuild.v1.Build.start_time", - index=8, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="finish_time", - full_name="google.devtools.cloudbuild.v1.Build.finish_time", - index=9, - number=8, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="timeout", - full_name="google.devtools.cloudbuild.v1.Build.timeout", - index=10, - number=12, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="images", - full_name="google.devtools.cloudbuild.v1.Build.images", - index=11, - number=13, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="queue_ttl", - full_name="google.devtools.cloudbuild.v1.Build.queue_ttl", - index=12, - number=40, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="artifacts", - full_name="google.devtools.cloudbuild.v1.Build.artifacts", - index=13, - number=37, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="logs_bucket", - full_name="google.devtools.cloudbuild.v1.Build.logs_bucket", - index=14, - number=19, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="source_provenance", - full_name="google.devtools.cloudbuild.v1.Build.source_provenance", - index=15, - number=21, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="build_trigger_id", - full_name="google.devtools.cloudbuild.v1.Build.build_trigger_id", - index=16, - number=22, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="options", - full_name="google.devtools.cloudbuild.v1.Build.options", - index=17, - number=23, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="log_url", - full_name="google.devtools.cloudbuild.v1.Build.log_url", - index=18, - number=25, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="substitutions", - full_name="google.devtools.cloudbuild.v1.Build.substitutions", - index=19, - number=29, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="tags", - full_name="google.devtools.cloudbuild.v1.Build.tags", - index=20, - number=31, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="secrets", - full_name="google.devtools.cloudbuild.v1.Build.secrets", - index=21, - number=32, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="timing", - full_name="google.devtools.cloudbuild.v1.Build.timing", - index=22, - number=33, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_BUILD_SUBSTITUTIONSENTRY, _BUILD_TIMINGENTRY,], - enum_types=[_BUILD_STATUS,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1962, - serialized_end=3310, -) - - -_ARTIFACTS_ARTIFACTOBJECTS = _descriptor.Descriptor( - name="ArtifactObjects", - full_name="google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="location", - full_name="google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects.location", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="paths", - full_name="google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects.paths", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="timing", - full_name="google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects.timing", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3417, - serialized_end=3524, -) - -_ARTIFACTS = _descriptor.Descriptor( - name="Artifacts", - full_name="google.devtools.cloudbuild.v1.Artifacts", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="images", - full_name="google.devtools.cloudbuild.v1.Artifacts.images", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="objects", - full_name="google.devtools.cloudbuild.v1.Artifacts.objects", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_ARTIFACTS_ARTIFACTOBJECTS,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3313, - serialized_end=3524, -) - - -_TIMESPAN = _descriptor.Descriptor( - name="TimeSpan", - full_name="google.devtools.cloudbuild.v1.TimeSpan", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="start_time", - full_name="google.devtools.cloudbuild.v1.TimeSpan.start_time", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_time", - full_name="google.devtools.cloudbuild.v1.TimeSpan.end_time", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3526, - serialized_end=3630, -) - - -_BUILDOPERATIONMETADATA = _descriptor.Descriptor( - name="BuildOperationMetadata", - full_name="google.devtools.cloudbuild.v1.BuildOperationMetadata", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="build", - full_name="google.devtools.cloudbuild.v1.BuildOperationMetadata.build", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3632, - serialized_end=3709, -) - - -_SOURCEPROVENANCE_FILEHASHESENTRY = _descriptor.Descriptor( - name="FileHashesEntry", - full_name="google.devtools.cloudbuild.v1.SourceProvenance.FileHashesEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.devtools.cloudbuild.v1.SourceProvenance.FileHashesEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.devtools.cloudbuild.v1.SourceProvenance.FileHashesEntry.value", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3975, - serialized_end=4067, -) - -_SOURCEPROVENANCE = _descriptor.Descriptor( - name="SourceProvenance", - full_name="google.devtools.cloudbuild.v1.SourceProvenance", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="resolved_storage_source", - full_name="google.devtools.cloudbuild.v1.SourceProvenance.resolved_storage_source", - index=0, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="resolved_repo_source", - full_name="google.devtools.cloudbuild.v1.SourceProvenance.resolved_repo_source", - index=1, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="file_hashes", - full_name="google.devtools.cloudbuild.v1.SourceProvenance.file_hashes", - index=2, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_SOURCEPROVENANCE_FILEHASHESENTRY,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3712, - serialized_end=4067, -) - - -_FILEHASHES = _descriptor.Descriptor( - name="FileHashes", - full_name="google.devtools.cloudbuild.v1.FileHashes", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="file_hash", - full_name="google.devtools.cloudbuild.v1.FileHashes.file_hash", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4069, - serialized_end=4137, -) - - -_HASH = _descriptor.Descriptor( - name="Hash", - full_name="google.devtools.cloudbuild.v1.Hash", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="type", - full_name="google.devtools.cloudbuild.v1.Hash.type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.devtools.cloudbuild.v1.Hash.value", - index=1, - number=2, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_HASH_HASHTYPE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4139, - serialized_end=4263, -) - - -_SECRET_SECRETENVENTRY = _descriptor.Descriptor( - name="SecretEnvEntry", - full_name="google.devtools.cloudbuild.v1.Secret.SecretEnvEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.devtools.cloudbuild.v1.Secret.SecretEnvEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.devtools.cloudbuild.v1.Secret.SecretEnvEntry.value", - index=1, - number=2, - type=12, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"", - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4372, - serialized_end=4420, -) - -_SECRET = _descriptor.Descriptor( - name="Secret", - full_name="google.devtools.cloudbuild.v1.Secret", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="kms_key_name", - full_name="google.devtools.cloudbuild.v1.Secret.kms_key_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="secret_env", - full_name="google.devtools.cloudbuild.v1.Secret.secret_env", - index=1, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_SECRET_SECRETENVENTRY,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4266, - serialized_end=4420, -) - - -_CREATEBUILDREQUEST = _descriptor.Descriptor( - name="CreateBuildRequest", - full_name="google.devtools.cloudbuild.v1.CreateBuildRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.CreateBuildRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="build", - full_name="google.devtools.cloudbuild.v1.CreateBuildRequest.build", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4422, - serialized_end=4525, -) - - -_GETBUILDREQUEST = _descriptor.Descriptor( - name="GetBuildRequest", - full_name="google.devtools.cloudbuild.v1.GetBuildRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.GetBuildRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="id", - full_name="google.devtools.cloudbuild.v1.GetBuildRequest.id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4527, - serialized_end=4586, -) - - -_LISTBUILDSREQUEST = _descriptor.Descriptor( - name="ListBuildsRequest", - full_name="google.devtools.cloudbuild.v1.ListBuildsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.ListBuildsRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.devtools.cloudbuild.v1.ListBuildsRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.devtools.cloudbuild.v1.ListBuildsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filter", - full_name="google.devtools.cloudbuild.v1.ListBuildsRequest.filter", - index=3, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4588, - serialized_end=4687, -) - - -_LISTBUILDSRESPONSE = _descriptor.Descriptor( - name="ListBuildsResponse", - full_name="google.devtools.cloudbuild.v1.ListBuildsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="builds", - full_name="google.devtools.cloudbuild.v1.ListBuildsResponse.builds", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.devtools.cloudbuild.v1.ListBuildsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4689, - serialized_end=4788, -) - - -_CANCELBUILDREQUEST = _descriptor.Descriptor( - name="CancelBuildRequest", - full_name="google.devtools.cloudbuild.v1.CancelBuildRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.CancelBuildRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="id", - full_name="google.devtools.cloudbuild.v1.CancelBuildRequest.id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4790, - serialized_end=4852, -) - - -_BUILDTRIGGER_SUBSTITUTIONSENTRY = _descriptor.Descriptor( - name="SubstitutionsEntry", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.SubstitutionsEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.SubstitutionsEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.SubstitutionsEntry.value", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=824, - serialized_end=876, -) - -_BUILDTRIGGER = _descriptor.Descriptor( - name="BuildTrigger", - full_name="google.devtools.cloudbuild.v1.BuildTrigger", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="id", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.description", - index=1, - number=10, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.name", - index=2, - number=21, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="tags", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.tags", - index=3, - number=19, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="trigger_template", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.trigger_template", - index=4, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="github", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.github", - index=5, - number=13, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="build", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.build", - index=6, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filename", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.filename", - index=7, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="create_time", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.create_time", - index=8, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="disabled", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.disabled", - index=9, - number=9, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="substitutions", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.substitutions", - index=10, - number=11, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ignored_files", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.ignored_files", - index=11, - number=15, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="included_files", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.included_files", - index=12, - number=16, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_BUILDTRIGGER_SUBSTITUTIONSENTRY,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="build_template", - full_name="google.devtools.cloudbuild.v1.BuildTrigger.build_template", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=4855, - serialized_end=5424, -) - - -_GITHUBEVENTSCONFIG = _descriptor.Descriptor( - name="GitHubEventsConfig", - full_name="google.devtools.cloudbuild.v1.GitHubEventsConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="installation_id", - full_name="google.devtools.cloudbuild.v1.GitHubEventsConfig.installation_id", - index=0, - number=1, - type=3, - cpp_type=2, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="owner", - full_name="google.devtools.cloudbuild.v1.GitHubEventsConfig.owner", - index=1, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.GitHubEventsConfig.name", - index=2, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="pull_request", - full_name="google.devtools.cloudbuild.v1.GitHubEventsConfig.pull_request", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="push", - full_name="google.devtools.cloudbuild.v1.GitHubEventsConfig.push", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="event", - full_name="google.devtools.cloudbuild.v1.GitHubEventsConfig.event", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=5427, - serialized_end=5647, -) - - -_PULLREQUESTFILTER = _descriptor.Descriptor( - name="PullRequestFilter", - full_name="google.devtools.cloudbuild.v1.PullRequestFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="branch", - full_name="google.devtools.cloudbuild.v1.PullRequestFilter.branch", - index=0, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="comment_control", - full_name="google.devtools.cloudbuild.v1.PullRequestFilter.comment_control", - index=1, - number=5, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="invert_regex", - full_name="google.devtools.cloudbuild.v1.PullRequestFilter.invert_regex", - index=2, - number=6, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_PULLREQUESTFILTER_COMMENTCONTROL,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="git_ref", - full_name="google.devtools.cloudbuild.v1.PullRequestFilter.git_ref", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=5650, - serialized_end=5873, -) - - -_PUSHFILTER = _descriptor.Descriptor( - name="PushFilter", - full_name="google.devtools.cloudbuild.v1.PushFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="branch", - full_name="google.devtools.cloudbuild.v1.PushFilter.branch", - index=0, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="tag", - full_name="google.devtools.cloudbuild.v1.PushFilter.tag", - index=1, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="invert_regex", - full_name="google.devtools.cloudbuild.v1.PushFilter.invert_regex", - index=2, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="git_ref", - full_name="google.devtools.cloudbuild.v1.PushFilter.git_ref", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=5875, - serialized_end=5953, -) - - -_CREATEBUILDTRIGGERREQUEST = _descriptor.Descriptor( - name="CreateBuildTriggerRequest", - full_name="google.devtools.cloudbuild.v1.CreateBuildTriggerRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.CreateBuildTriggerRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="trigger", - full_name="google.devtools.cloudbuild.v1.CreateBuildTriggerRequest.trigger", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5955, - serialized_end=6074, -) - - -_GETBUILDTRIGGERREQUEST = _descriptor.Descriptor( - name="GetBuildTriggerRequest", - full_name="google.devtools.cloudbuild.v1.GetBuildTriggerRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.GetBuildTriggerRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="trigger_id", - full_name="google.devtools.cloudbuild.v1.GetBuildTriggerRequest.trigger_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6076, - serialized_end=6150, -) - - -_LISTBUILDTRIGGERSREQUEST = _descriptor.Descriptor( - name="ListBuildTriggersRequest", - full_name="google.devtools.cloudbuild.v1.ListBuildTriggersRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.ListBuildTriggersRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.devtools.cloudbuild.v1.ListBuildTriggersRequest.page_size", - index=1, - number=2, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.devtools.cloudbuild.v1.ListBuildTriggersRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6152, - serialized_end=6242, -) - - -_LISTBUILDTRIGGERSRESPONSE = _descriptor.Descriptor( - name="ListBuildTriggersResponse", - full_name="google.devtools.cloudbuild.v1.ListBuildTriggersResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="triggers", - full_name="google.devtools.cloudbuild.v1.ListBuildTriggersResponse.triggers", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.devtools.cloudbuild.v1.ListBuildTriggersResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6244, - serialized_end=6359, -) - - -_DELETEBUILDTRIGGERREQUEST = _descriptor.Descriptor( - name="DeleteBuildTriggerRequest", - full_name="google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="trigger_id", - full_name="google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest.trigger_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6361, - serialized_end=6438, -) - - -_UPDATEBUILDTRIGGERREQUEST = _descriptor.Descriptor( - name="UpdateBuildTriggerRequest", - full_name="google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="trigger_id", - full_name="google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.trigger_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="trigger", - full_name="google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest.trigger", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6441, - serialized_end=6585, -) - - -_BUILDOPTIONS = _descriptor.Descriptor( - name="BuildOptions", - full_name="google.devtools.cloudbuild.v1.BuildOptions", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="source_provenance_hash", - full_name="google.devtools.cloudbuild.v1.BuildOptions.source_provenance_hash", - index=0, - number=1, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="requested_verify_option", - full_name="google.devtools.cloudbuild.v1.BuildOptions.requested_verify_option", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="machine_type", - full_name="google.devtools.cloudbuild.v1.BuildOptions.machine_type", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="disk_size_gb", - full_name="google.devtools.cloudbuild.v1.BuildOptions.disk_size_gb", - index=3, - number=6, - type=3, - cpp_type=2, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="substitution_option", - full_name="google.devtools.cloudbuild.v1.BuildOptions.substitution_option", - index=4, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="log_streaming_option", - full_name="google.devtools.cloudbuild.v1.BuildOptions.log_streaming_option", - index=5, - number=5, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="worker_pool", - full_name="google.devtools.cloudbuild.v1.BuildOptions.worker_pool", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="logging", - full_name="google.devtools.cloudbuild.v1.BuildOptions.logging", - index=7, - number=11, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="env", - full_name="google.devtools.cloudbuild.v1.BuildOptions.env", - index=8, - number=12, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="secret_env", - full_name="google.devtools.cloudbuild.v1.BuildOptions.secret_env", - index=9, - number=13, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="volumes", - full_name="google.devtools.cloudbuild.v1.BuildOptions.volumes", - index=10, - number=14, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[ - _BUILDOPTIONS_VERIFYOPTION, - _BUILDOPTIONS_MACHINETYPE, - _BUILDOPTIONS_SUBSTITUTIONOPTION, - _BUILDOPTIONS_LOGSTREAMINGOPTION, - _BUILDOPTIONS_LOGGINGMODE, - ], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=6588, - serialized_end=7554, -) - - -_WORKERPOOL = _descriptor.Descriptor( - name="WorkerPool", - full_name="google.devtools.cloudbuild.v1.WorkerPool", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.WorkerPool.name", - index=0, - number=14, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.WorkerPool.project_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="service_account_email", - full_name="google.devtools.cloudbuild.v1.WorkerPool.service_account_email", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="worker_count", - full_name="google.devtools.cloudbuild.v1.WorkerPool.worker_count", - index=3, - number=4, - type=3, - cpp_type=2, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="worker_config", - full_name="google.devtools.cloudbuild.v1.WorkerPool.worker_config", - index=4, - number=16, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="regions", - full_name="google.devtools.cloudbuild.v1.WorkerPool.regions", - index=5, - number=9, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="create_time", - full_name="google.devtools.cloudbuild.v1.WorkerPool.create_time", - index=6, - number=11, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_time", - full_name="google.devtools.cloudbuild.v1.WorkerPool.update_time", - index=7, - number=17, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="delete_time", - full_name="google.devtools.cloudbuild.v1.WorkerPool.delete_time", - index=8, - number=12, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="status", - full_name="google.devtools.cloudbuild.v1.WorkerPool.status", - index=9, - number=13, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_WORKERPOOL_REGION, _WORKERPOOL_STATUS,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=7557, - serialized_end=8185, -) - - -_WORKERCONFIG = _descriptor.Descriptor( - name="WorkerConfig", - full_name="google.devtools.cloudbuild.v1.WorkerConfig", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="machine_type", - full_name="google.devtools.cloudbuild.v1.WorkerConfig.machine_type", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="disk_size_gb", - full_name="google.devtools.cloudbuild.v1.WorkerConfig.disk_size_gb", - index=1, - number=2, - type=3, - cpp_type=2, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="network", - full_name="google.devtools.cloudbuild.v1.WorkerConfig.network", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="tag", - full_name="google.devtools.cloudbuild.v1.WorkerConfig.tag", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8188, - serialized_end=8316, -) - - -_NETWORK = _descriptor.Descriptor( - name="Network", - full_name="google.devtools.cloudbuild.v1.Network", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="project_id", - full_name="google.devtools.cloudbuild.v1.Network.project_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="network", - full_name="google.devtools.cloudbuild.v1.Network.network", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="subnetwork", - full_name="google.devtools.cloudbuild.v1.Network.subnetwork", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8318, - serialized_end=8384, -) - - -_CREATEWORKERPOOLREQUEST = _descriptor.Descriptor( - name="CreateWorkerPoolRequest", - full_name="google.devtools.cloudbuild.v1.CreateWorkerPoolRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.devtools.cloudbuild.v1.CreateWorkerPoolRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="worker_pool", - full_name="google.devtools.cloudbuild.v1.CreateWorkerPoolRequest.worker_pool", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8386, - serialized_end=8491, -) - - -_GETWORKERPOOLREQUEST = _descriptor.Descriptor( - name="GetWorkerPoolRequest", - full_name="google.devtools.cloudbuild.v1.GetWorkerPoolRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.GetWorkerPoolRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8493, - serialized_end=8529, -) - - -_DELETEWORKERPOOLREQUEST = _descriptor.Descriptor( - name="DeleteWorkerPoolRequest", - full_name="google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8531, - serialized_end=8570, -) - - -_UPDATEWORKERPOOLREQUEST = _descriptor.Descriptor( - name="UpdateWorkerPoolRequest", - full_name="google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest.name", - index=0, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="worker_pool", - full_name="google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest.worker_pool", - index=1, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8572, - serialized_end=8675, -) - - -_LISTWORKERPOOLSREQUEST = _descriptor.Descriptor( - name="ListWorkerPoolsRequest", - full_name="google.devtools.cloudbuild.v1.ListWorkerPoolsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.devtools.cloudbuild.v1.ListWorkerPoolsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8677, - serialized_end=8717, -) - - -_LISTWORKERPOOLSRESPONSE = _descriptor.Descriptor( - name="ListWorkerPoolsResponse", - full_name="google.devtools.cloudbuild.v1.ListWorkerPoolsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="worker_pools", - full_name="google.devtools.cloudbuild.v1.ListWorkerPoolsResponse.worker_pools", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=8719, - serialized_end=8809, -) - -_RUNBUILDTRIGGERREQUEST.fields_by_name["source"].message_type = _REPOSOURCE -_REPOSOURCE_SUBSTITUTIONSENTRY.containing_type = _REPOSOURCE -_REPOSOURCE.fields_by_name[ - "substitutions" -].message_type = _REPOSOURCE_SUBSTITUTIONSENTRY -_REPOSOURCE.oneofs_by_name["revision"].fields.append( - _REPOSOURCE.fields_by_name["branch_name"] -) -_REPOSOURCE.fields_by_name["branch_name"].containing_oneof = _REPOSOURCE.oneofs_by_name[ - "revision" -] -_REPOSOURCE.oneofs_by_name["revision"].fields.append( - _REPOSOURCE.fields_by_name["tag_name"] -) -_REPOSOURCE.fields_by_name["tag_name"].containing_oneof = _REPOSOURCE.oneofs_by_name[ - "revision" -] -_REPOSOURCE.oneofs_by_name["revision"].fields.append( - _REPOSOURCE.fields_by_name["commit_sha"] -) -_REPOSOURCE.fields_by_name["commit_sha"].containing_oneof = _REPOSOURCE.oneofs_by_name[ - "revision" -] -_SOURCE.fields_by_name["storage_source"].message_type = _STORAGESOURCE -_SOURCE.fields_by_name["repo_source"].message_type = _REPOSOURCE -_SOURCE.oneofs_by_name["source"].fields.append(_SOURCE.fields_by_name["storage_source"]) -_SOURCE.fields_by_name["storage_source"].containing_oneof = _SOURCE.oneofs_by_name[ - "source" -] -_SOURCE.oneofs_by_name["source"].fields.append(_SOURCE.fields_by_name["repo_source"]) -_SOURCE.fields_by_name["repo_source"].containing_oneof = _SOURCE.oneofs_by_name[ - "source" -] -_BUILTIMAGE.fields_by_name["push_timing"].message_type = _TIMESPAN -_BUILDSTEP.fields_by_name["volumes"].message_type = _VOLUME -_BUILDSTEP.fields_by_name["timing"].message_type = _TIMESPAN -_BUILDSTEP.fields_by_name["pull_timing"].message_type = _TIMESPAN -_BUILDSTEP.fields_by_name[ - "timeout" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_BUILDSTEP.fields_by_name["status"].enum_type = _BUILD_STATUS -_RESULTS.fields_by_name["images"].message_type = _BUILTIMAGE -_RESULTS.fields_by_name["artifact_timing"].message_type = _TIMESPAN -_ARTIFACTRESULT.fields_by_name["file_hash"].message_type = _FILEHASHES -_BUILD_SUBSTITUTIONSENTRY.containing_type = _BUILD -_BUILD_TIMINGENTRY.fields_by_name["value"].message_type = _TIMESPAN -_BUILD_TIMINGENTRY.containing_type = _BUILD -_BUILD.fields_by_name["status"].enum_type = _BUILD_STATUS -_BUILD.fields_by_name["source"].message_type = _SOURCE -_BUILD.fields_by_name["steps"].message_type = _BUILDSTEP -_BUILD.fields_by_name["results"].message_type = _RESULTS -_BUILD.fields_by_name[ - "create_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_BUILD.fields_by_name[ - "start_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_BUILD.fields_by_name[ - "finish_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_BUILD.fields_by_name[ - "timeout" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_BUILD.fields_by_name[ - "queue_ttl" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_BUILD.fields_by_name["artifacts"].message_type = _ARTIFACTS -_BUILD.fields_by_name["source_provenance"].message_type = _SOURCEPROVENANCE -_BUILD.fields_by_name["options"].message_type = _BUILDOPTIONS -_BUILD.fields_by_name["substitutions"].message_type = _BUILD_SUBSTITUTIONSENTRY -_BUILD.fields_by_name["secrets"].message_type = _SECRET -_BUILD.fields_by_name["timing"].message_type = _BUILD_TIMINGENTRY -_BUILD_STATUS.containing_type = _BUILD -_ARTIFACTS_ARTIFACTOBJECTS.fields_by_name["timing"].message_type = _TIMESPAN -_ARTIFACTS_ARTIFACTOBJECTS.containing_type = _ARTIFACTS -_ARTIFACTS.fields_by_name["objects"].message_type = _ARTIFACTS_ARTIFACTOBJECTS -_TIMESPAN.fields_by_name[ - "start_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_TIMESPAN.fields_by_name[ - "end_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_BUILDOPERATIONMETADATA.fields_by_name["build"].message_type = _BUILD -_SOURCEPROVENANCE_FILEHASHESENTRY.fields_by_name["value"].message_type = _FILEHASHES -_SOURCEPROVENANCE_FILEHASHESENTRY.containing_type = _SOURCEPROVENANCE -_SOURCEPROVENANCE.fields_by_name[ - "resolved_storage_source" -].message_type = _STORAGESOURCE -_SOURCEPROVENANCE.fields_by_name["resolved_repo_source"].message_type = _REPOSOURCE -_SOURCEPROVENANCE.fields_by_name[ - "file_hashes" -].message_type = _SOURCEPROVENANCE_FILEHASHESENTRY -_FILEHASHES.fields_by_name["file_hash"].message_type = _HASH -_HASH.fields_by_name["type"].enum_type = _HASH_HASHTYPE -_HASH_HASHTYPE.containing_type = _HASH -_SECRET_SECRETENVENTRY.containing_type = _SECRET -_SECRET.fields_by_name["secret_env"].message_type = _SECRET_SECRETENVENTRY -_CREATEBUILDREQUEST.fields_by_name["build"].message_type = _BUILD -_LISTBUILDSRESPONSE.fields_by_name["builds"].message_type = _BUILD -_BUILDTRIGGER_SUBSTITUTIONSENTRY.containing_type = _BUILDTRIGGER -_BUILDTRIGGER.fields_by_name["trigger_template"].message_type = _REPOSOURCE -_BUILDTRIGGER.fields_by_name["github"].message_type = _GITHUBEVENTSCONFIG -_BUILDTRIGGER.fields_by_name["build"].message_type = _BUILD -_BUILDTRIGGER.fields_by_name[ - "create_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_BUILDTRIGGER.fields_by_name[ - "substitutions" -].message_type = _BUILDTRIGGER_SUBSTITUTIONSENTRY -_BUILDTRIGGER.oneofs_by_name["build_template"].fields.append( - _BUILDTRIGGER.fields_by_name["build"] -) -_BUILDTRIGGER.fields_by_name["build"].containing_oneof = _BUILDTRIGGER.oneofs_by_name[ - "build_template" -] -_BUILDTRIGGER.oneofs_by_name["build_template"].fields.append( - _BUILDTRIGGER.fields_by_name["filename"] -) -_BUILDTRIGGER.fields_by_name[ - "filename" -].containing_oneof = _BUILDTRIGGER.oneofs_by_name["build_template"] -_GITHUBEVENTSCONFIG.fields_by_name["pull_request"].message_type = _PULLREQUESTFILTER -_GITHUBEVENTSCONFIG.fields_by_name["push"].message_type = _PUSHFILTER -_GITHUBEVENTSCONFIG.oneofs_by_name["event"].fields.append( - _GITHUBEVENTSCONFIG.fields_by_name["pull_request"] -) -_GITHUBEVENTSCONFIG.fields_by_name[ - "pull_request" -].containing_oneof = _GITHUBEVENTSCONFIG.oneofs_by_name["event"] -_GITHUBEVENTSCONFIG.oneofs_by_name["event"].fields.append( - _GITHUBEVENTSCONFIG.fields_by_name["push"] -) -_GITHUBEVENTSCONFIG.fields_by_name[ - "push" -].containing_oneof = _GITHUBEVENTSCONFIG.oneofs_by_name["event"] -_PULLREQUESTFILTER.fields_by_name[ - "comment_control" -].enum_type = _PULLREQUESTFILTER_COMMENTCONTROL -_PULLREQUESTFILTER_COMMENTCONTROL.containing_type = _PULLREQUESTFILTER -_PULLREQUESTFILTER.oneofs_by_name["git_ref"].fields.append( - _PULLREQUESTFILTER.fields_by_name["branch"] -) -_PULLREQUESTFILTER.fields_by_name[ - "branch" -].containing_oneof = _PULLREQUESTFILTER.oneofs_by_name["git_ref"] -_PUSHFILTER.oneofs_by_name["git_ref"].fields.append( - _PUSHFILTER.fields_by_name["branch"] -) -_PUSHFILTER.fields_by_name["branch"].containing_oneof = _PUSHFILTER.oneofs_by_name[ - "git_ref" -] -_PUSHFILTER.oneofs_by_name["git_ref"].fields.append(_PUSHFILTER.fields_by_name["tag"]) -_PUSHFILTER.fields_by_name["tag"].containing_oneof = _PUSHFILTER.oneofs_by_name[ - "git_ref" -] -_CREATEBUILDTRIGGERREQUEST.fields_by_name["trigger"].message_type = _BUILDTRIGGER -_LISTBUILDTRIGGERSRESPONSE.fields_by_name["triggers"].message_type = _BUILDTRIGGER -_UPDATEBUILDTRIGGERREQUEST.fields_by_name["trigger"].message_type = _BUILDTRIGGER -_BUILDOPTIONS.fields_by_name["source_provenance_hash"].enum_type = _HASH_HASHTYPE -_BUILDOPTIONS.fields_by_name[ - "requested_verify_option" -].enum_type = _BUILDOPTIONS_VERIFYOPTION -_BUILDOPTIONS.fields_by_name["machine_type"].enum_type = _BUILDOPTIONS_MACHINETYPE -_BUILDOPTIONS.fields_by_name[ - "substitution_option" -].enum_type = _BUILDOPTIONS_SUBSTITUTIONOPTION -_BUILDOPTIONS.fields_by_name[ - "log_streaming_option" -].enum_type = _BUILDOPTIONS_LOGSTREAMINGOPTION -_BUILDOPTIONS.fields_by_name["logging"].enum_type = _BUILDOPTIONS_LOGGINGMODE -_BUILDOPTIONS.fields_by_name["volumes"].message_type = _VOLUME -_BUILDOPTIONS_VERIFYOPTION.containing_type = _BUILDOPTIONS -_BUILDOPTIONS_MACHINETYPE.containing_type = _BUILDOPTIONS -_BUILDOPTIONS_SUBSTITUTIONOPTION.containing_type = _BUILDOPTIONS -_BUILDOPTIONS_LOGSTREAMINGOPTION.containing_type = _BUILDOPTIONS -_BUILDOPTIONS_LOGGINGMODE.containing_type = _BUILDOPTIONS -_WORKERPOOL.fields_by_name["worker_config"].message_type = _WORKERCONFIG -_WORKERPOOL.fields_by_name["regions"].enum_type = _WORKERPOOL_REGION -_WORKERPOOL.fields_by_name[ - "create_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_WORKERPOOL.fields_by_name[ - "update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_WORKERPOOL.fields_by_name[ - "delete_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_WORKERPOOL.fields_by_name["status"].enum_type = _WORKERPOOL_STATUS -_WORKERPOOL_REGION.containing_type = _WORKERPOOL -_WORKERPOOL_STATUS.containing_type = _WORKERPOOL -_WORKERCONFIG.fields_by_name["network"].message_type = _NETWORK -_CREATEWORKERPOOLREQUEST.fields_by_name["worker_pool"].message_type = _WORKERPOOL -_UPDATEWORKERPOOLREQUEST.fields_by_name["worker_pool"].message_type = _WORKERPOOL -_LISTWORKERPOOLSRESPONSE.fields_by_name["worker_pools"].message_type = _WORKERPOOL -DESCRIPTOR.message_types_by_name["RetryBuildRequest"] = _RETRYBUILDREQUEST -DESCRIPTOR.message_types_by_name["RunBuildTriggerRequest"] = _RUNBUILDTRIGGERREQUEST -DESCRIPTOR.message_types_by_name["StorageSource"] = _STORAGESOURCE -DESCRIPTOR.message_types_by_name["RepoSource"] = _REPOSOURCE -DESCRIPTOR.message_types_by_name["Source"] = _SOURCE -DESCRIPTOR.message_types_by_name["BuiltImage"] = _BUILTIMAGE -DESCRIPTOR.message_types_by_name["BuildStep"] = _BUILDSTEP -DESCRIPTOR.message_types_by_name["Volume"] = _VOLUME -DESCRIPTOR.message_types_by_name["Results"] = _RESULTS -DESCRIPTOR.message_types_by_name["ArtifactResult"] = _ARTIFACTRESULT -DESCRIPTOR.message_types_by_name["Build"] = _BUILD -DESCRIPTOR.message_types_by_name["Artifacts"] = _ARTIFACTS -DESCRIPTOR.message_types_by_name["TimeSpan"] = _TIMESPAN -DESCRIPTOR.message_types_by_name["BuildOperationMetadata"] = _BUILDOPERATIONMETADATA -DESCRIPTOR.message_types_by_name["SourceProvenance"] = _SOURCEPROVENANCE -DESCRIPTOR.message_types_by_name["FileHashes"] = _FILEHASHES -DESCRIPTOR.message_types_by_name["Hash"] = _HASH -DESCRIPTOR.message_types_by_name["Secret"] = _SECRET -DESCRIPTOR.message_types_by_name["CreateBuildRequest"] = _CREATEBUILDREQUEST -DESCRIPTOR.message_types_by_name["GetBuildRequest"] = _GETBUILDREQUEST -DESCRIPTOR.message_types_by_name["ListBuildsRequest"] = _LISTBUILDSREQUEST -DESCRIPTOR.message_types_by_name["ListBuildsResponse"] = _LISTBUILDSRESPONSE -DESCRIPTOR.message_types_by_name["CancelBuildRequest"] = _CANCELBUILDREQUEST -DESCRIPTOR.message_types_by_name["BuildTrigger"] = _BUILDTRIGGER -DESCRIPTOR.message_types_by_name["GitHubEventsConfig"] = _GITHUBEVENTSCONFIG -DESCRIPTOR.message_types_by_name["PullRequestFilter"] = _PULLREQUESTFILTER -DESCRIPTOR.message_types_by_name["PushFilter"] = _PUSHFILTER -DESCRIPTOR.message_types_by_name[ - "CreateBuildTriggerRequest" -] = _CREATEBUILDTRIGGERREQUEST -DESCRIPTOR.message_types_by_name["GetBuildTriggerRequest"] = _GETBUILDTRIGGERREQUEST -DESCRIPTOR.message_types_by_name["ListBuildTriggersRequest"] = _LISTBUILDTRIGGERSREQUEST -DESCRIPTOR.message_types_by_name[ - "ListBuildTriggersResponse" -] = _LISTBUILDTRIGGERSRESPONSE -DESCRIPTOR.message_types_by_name[ - "DeleteBuildTriggerRequest" -] = _DELETEBUILDTRIGGERREQUEST -DESCRIPTOR.message_types_by_name[ - "UpdateBuildTriggerRequest" -] = _UPDATEBUILDTRIGGERREQUEST -DESCRIPTOR.message_types_by_name["BuildOptions"] = _BUILDOPTIONS -DESCRIPTOR.message_types_by_name["WorkerPool"] = _WORKERPOOL -DESCRIPTOR.message_types_by_name["WorkerConfig"] = _WORKERCONFIG -DESCRIPTOR.message_types_by_name["Network"] = _NETWORK -DESCRIPTOR.message_types_by_name["CreateWorkerPoolRequest"] = _CREATEWORKERPOOLREQUEST -DESCRIPTOR.message_types_by_name["GetWorkerPoolRequest"] = _GETWORKERPOOLREQUEST -DESCRIPTOR.message_types_by_name["DeleteWorkerPoolRequest"] = _DELETEWORKERPOOLREQUEST -DESCRIPTOR.message_types_by_name["UpdateWorkerPoolRequest"] = _UPDATEWORKERPOOLREQUEST -DESCRIPTOR.message_types_by_name["ListWorkerPoolsRequest"] = _LISTWORKERPOOLSREQUEST -DESCRIPTOR.message_types_by_name["ListWorkerPoolsResponse"] = _LISTWORKERPOOLSRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -RetryBuildRequest = _reflection.GeneratedProtocolMessageType( - "RetryBuildRequest", - (_message.Message,), - { - "DESCRIPTOR": _RETRYBUILDREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Specifies a build to retry. - - Attributes: - project_id: - Required. ID of the project. - id: - Required. Build ID of the original build. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.RetryBuildRequest) - }, -) -_sym_db.RegisterMessage(RetryBuildRequest) - -RunBuildTriggerRequest = _reflection.GeneratedProtocolMessageType( - "RunBuildTriggerRequest", - (_message.Message,), - { - "DESCRIPTOR": _RUNBUILDTRIGGERREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Specifies a build trigger to run and the source to use. - - Attributes: - project_id: - Required. ID of the project. - trigger_id: - Required. ID of the trigger. - source: - Required. Source to build against this trigger. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.RunBuildTriggerRequest) - }, -) -_sym_db.RegisterMessage(RunBuildTriggerRequest) - -StorageSource = _reflection.GeneratedProtocolMessageType( - "StorageSource", - (_message.Message,), - { - "DESCRIPTOR": _STORAGESOURCE, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Location of the source in an archive file in Google Cloud Storage. - - Attributes: - bucket: - Google Cloud Storage bucket containing the source (see `Bucket - Name Requirements - `__). - object: - Google Cloud Storage object containing the source. This - object must be a gzipped archive file (``.tar.gz``) containing - source to build. - generation: - Google Cloud Storage generation for the object. If the - generation is omitted, the latest generation will be used. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.StorageSource) - }, -) -_sym_db.RegisterMessage(StorageSource) - -RepoSource = _reflection.GeneratedProtocolMessageType( - "RepoSource", - (_message.Message,), - { - "SubstitutionsEntry": _reflection.GeneratedProtocolMessageType( - "SubstitutionsEntry", - (_message.Message,), - { - "DESCRIPTOR": _REPOSOURCE_SUBSTITUTIONSENTRY, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2" - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.RepoSource.SubstitutionsEntry) - }, - ), - "DESCRIPTOR": _REPOSOURCE, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Location of the source in a Google Cloud Source Repository. - - Attributes: - project_id: - ID of the project that owns the Cloud Source Repository. If - omitted, the project ID requesting the build is assumed. - repo_name: - Required. Name of the Cloud Source Repository. - revision: - A revision within the Cloud Source Repository must be - specified in one of these ways. - branch_name: - Regex matching branches to build. The syntax of the regular - expressions accepted is the syntax accepted by RE2 and - described at https://github.com/google/re2/wiki/Syntax - tag_name: - Regex matching tags to build. The syntax of the regular - expressions accepted is the syntax accepted by RE2 and - described at https://github.com/google/re2/wiki/Syntax - commit_sha: - Explicit commit SHA to build. - dir: - Directory, relative to the source root, in which to run the - build. This must be a relative path. If a step’s ``dir`` is - specified and is an absolute path, this value is ignored for - that step’s execution. - invert_regex: - Only trigger a build if the revision regex does NOT match the - revision regex. - substitutions: - Substitutions to use in a triggered build. Should only be used - with RunBuildTrigger - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.RepoSource) - }, -) -_sym_db.RegisterMessage(RepoSource) -_sym_db.RegisterMessage(RepoSource.SubstitutionsEntry) - -Source = _reflection.GeneratedProtocolMessageType( - "Source", - (_message.Message,), - { - "DESCRIPTOR": _SOURCE, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Location of the source in a supported storage service. - - Attributes: - source: - Location of source. - storage_source: - If provided, get the source from this location in Google Cloud - Storage. - repo_source: - If provided, get the source from this location in a Cloud - Source Repository. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Source) - }, -) -_sym_db.RegisterMessage(Source) - -BuiltImage = _reflection.GeneratedProtocolMessageType( - "BuiltImage", - (_message.Message,), - { - "DESCRIPTOR": _BUILTIMAGE, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """An image built by the pipeline. - - Attributes: - name: - Name used to push the container image to Google Container - Registry, as presented to ``docker push``. - digest: - Docker Registry 2.0 digest. - push_timing: - Output only. Stores timing information for pushing the - specified image. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.BuiltImage) - }, -) -_sym_db.RegisterMessage(BuiltImage) - -BuildStep = _reflection.GeneratedProtocolMessageType( - "BuildStep", - (_message.Message,), - { - "DESCRIPTOR": _BUILDSTEP, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """A step in the build pipeline. - - Attributes: - name: - Required. The name of the container image that will run this - particular build step. If the image is available in the - host’s Docker daemon’s cache, it will be run directly. If not, - the host will attempt to pull the image first, using the - builder service account’s credentials if necessary. The - Docker daemon’s cache will already have the latest versions of - all of the officially supported build steps - (https://github.com/GoogleCloudPlatform/cloud-builders). The - Docker daemon will also have cached many of the layers for - some popular images, like “ubuntu”, “debian”, but they will be - refreshed at the time you attempt to use them. If you built - an image in a previous build step, it will be stored in the - host’s Docker daemon’s cache and is available to use as the - name for a later build step. - env: - A list of environment variable definitions to be used when - running a step. The elements are of the form “KEY=VALUE” for - the environment variable “KEY” being given the value “VALUE”. - args: - A list of arguments that will be presented to the step when it - is started. If the image used to run the step’s container has - an entrypoint, the ``args`` are used as arguments to that - entrypoint. If the image does not define an entrypoint, the - first element in args is used as the entrypoint, and the - remainder will be used as arguments. - dir: - Working directory to use when running this step’s container. - If this value is a relative path, it is relative to the - build’s working directory. If this value is absolute, it may - be outside the build’s working directory, in which case the - contents of the path may not be persisted across build step - executions, unless a ``volume`` for that path is specified. - If the build specifies a ``RepoSource`` with ``dir`` and a - step with a ``dir``, which specifies an absolute path, the - ``RepoSource`` ``dir`` is ignored for the step’s execution. - id: - Unique identifier for this build step, used in ``wait_for`` to - reference this build step as a dependency. - wait_for: - The ID(s) of the step(s) that this build step depends on. This - build step will not start until all the build steps in - ``wait_for`` have completed successfully. If ``wait_for`` is - empty, this build step will start when all previous build - steps in the ``Build.Steps`` list have completed successfully. - entrypoint: - Entrypoint to be used instead of the build step image’s - default entrypoint. If unset, the image’s default entrypoint - is used. - secret_env: - A list of environment variables which are encrypted using a - Cloud Key Management Service crypto key. These values must be - specified in the build’s ``Secret``. - volumes: - List of volumes to mount into the build step. Each volume is - created as an empty volume prior to execution of the build - step. Upon completion of the build, volumes and their contents - are discarded. Using a named volume in only one step is not - valid as it is indicative of a build request with an incorrect - configuration. - timing: - Output only. Stores timing information for executing this - build step. - pull_timing: - Output only. Stores timing information for pulling this build - step’s builder image only. - timeout: - Time limit for executing this build step. If not defined, the - step has no time limit and will be allowed to continue to run - until either it completes or the build itself times out. - status: - Output only. Status of the build step. At this time, build - step status is only updated on build completion; step status - is not updated in real-time as the build progresses. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.BuildStep) - }, -) -_sym_db.RegisterMessage(BuildStep) - -Volume = _reflection.GeneratedProtocolMessageType( - "Volume", - (_message.Message,), - { - "DESCRIPTOR": _VOLUME, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Volume describes a Docker container volume which is mounted into build - steps in order to persist files across build step execution. - - Attributes: - name: - Name of the volume to mount. Volume names must be unique per - build step and must be valid names for Docker volumes. Each - named volume must be used by at least two build steps. - path: - Path at which to mount the volume. Paths must be absolute and - cannot conflict with other volume paths on the same build step - or with certain reserved volume paths. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Volume) - }, -) -_sym_db.RegisterMessage(Volume) - -Results = _reflection.GeneratedProtocolMessageType( - "Results", - (_message.Message,), - { - "DESCRIPTOR": _RESULTS, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Artifacts created by the build pipeline. - - Attributes: - images: - Container images that were built as a part of the build. - build_step_images: - List of build step digests, in the order corresponding to - build step indices. - artifact_manifest: - Path to the artifact manifest. Only populated when artifacts - are uploaded. - num_artifacts: - Number of artifacts uploaded. Only populated when artifacts - are uploaded. - build_step_outputs: - List of build step outputs, produced by builder images, in the - order corresponding to build step indices. `Cloud Builders - `__ - can produce this output by writing to - ``$BUILDER_OUTPUT/output``. Only the first 4KB of data is - stored. - artifact_timing: - Time to push all non-container artifacts. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Results) - }, -) -_sym_db.RegisterMessage(Results) - -ArtifactResult = _reflection.GeneratedProtocolMessageType( - "ArtifactResult", - (_message.Message,), - { - "DESCRIPTOR": _ARTIFACTRESULT, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """An artifact that was uploaded during a build. This is a single record - in the artifact manifest JSON file. - - Attributes: - location: - The path of an artifact in a Google Cloud Storage bucket, with - the generation number. For example, - ``gs://mybucket/path/to/output.jar#generation``. - file_hash: - The file hash of the artifact. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.ArtifactResult) - }, -) -_sym_db.RegisterMessage(ArtifactResult) - -Build = _reflection.GeneratedProtocolMessageType( - "Build", - (_message.Message,), - { - "SubstitutionsEntry": _reflection.GeneratedProtocolMessageType( - "SubstitutionsEntry", - (_message.Message,), - { - "DESCRIPTOR": _BUILD_SUBSTITUTIONSENTRY, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2" - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Build.SubstitutionsEntry) - }, - ), - "TimingEntry": _reflection.GeneratedProtocolMessageType( - "TimingEntry", - (_message.Message,), - { - "DESCRIPTOR": _BUILD_TIMINGENTRY, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2" - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Build.TimingEntry) - }, - ), - "DESCRIPTOR": _BUILD, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """A build resource in the Cloud Build API. At a high level, a ``Build`` - describes where to find source code, how to build it (for example, the - builder image to run on the source), and where to store the built - artifacts. Fields can include the following variables, which will be - expanded when the build is created: - $PROJECT_ID: the project ID of - the build. - $BUILD_ID: the autogenerated ID of the build. - - $REPO_NAME: the source repository name specified by RepoSource. - - $BRANCH_NAME: the branch name specified by RepoSource. - $TAG_NAME: - the tag name specified by RepoSource. - $REVISION_ID or $COMMIT_SHA: - the commit SHA specified by RepoSource or resolved from the - specified branch or tag. - $SHORT_SHA: first 7 characters of - $REVISION_ID or $COMMIT_SHA. - - Attributes: - id: - Output only. Unique identifier of the build. - project_id: - Output only. ID of the project. - status: - Output only. Status of the build. - status_detail: - Output only. Customer-readable message about the current - status. - source: - The location of the source files to build. - steps: - Required. The operations to be performed on the workspace. - results: - Output only. Results of the build. - create_time: - Output only. Time at which the request to create the build was - received. - start_time: - Output only. Time at which execution of the build was started. - finish_time: - Output only. Time at which execution of the build was - finished. The difference between finish_time and start_time - is the duration of the build’s execution. - timeout: - Amount of time that this build should be allowed to run, to - second granularity. If this amount of time elapses, work on - the build will cease and the build status will be ``TIMEOUT``. - Default time is ten minutes. - images: - A list of images to be pushed upon the successful completion - of all build steps. The images are pushed using the builder - service account’s credentials. The digests of the pushed - images will be stored in the ``Build`` resource’s results - field. If any of the images fail to be pushed, the build - status is marked ``FAILURE``. - queue_ttl: - TTL in queue for this build. If provided and the build is - enqueued longer than this value, the build will expire and the - build status will be ``EXPIRED``. The TTL starts ticking from - create_time. - artifacts: - Artifacts produced by the build that should be uploaded upon - successful completion of all build steps. - logs_bucket: - Google Cloud Storage bucket where logs should be written (see - `Bucket Name Requirements - `__). Logs file names will be of the - format ``${logs_bucket}/log-${build_id}.txt``. - source_provenance: - Output only. A permanent fixed identifier for source. - build_trigger_id: - Output only. The ID of the ``BuildTrigger`` that triggered - this build, if it was triggered automatically. - options: - Special options for this build. - log_url: - Output only. URL to logs for this build in Google Cloud - Console. - substitutions: - Substitutions data for ``Build`` resource. - tags: - Tags for annotation of a ``Build``. These are not docker tags. - secrets: - Secrets to decrypt using Cloud Key Management Service. - timing: - Output only. Stores timing information for phases of the - build. Valid keys are: - BUILD: time to execute all build - steps - PUSH: time to push all specified images. - - FETCHSOURCE: time to fetch source. If the build does not - specify source or images, these keys will not be included. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Build) - }, -) -_sym_db.RegisterMessage(Build) -_sym_db.RegisterMessage(Build.SubstitutionsEntry) -_sym_db.RegisterMessage(Build.TimingEntry) - -Artifacts = _reflection.GeneratedProtocolMessageType( - "Artifacts", - (_message.Message,), - { - "ArtifactObjects": _reflection.GeneratedProtocolMessageType( - "ArtifactObjects", - (_message.Message,), - { - "DESCRIPTOR": _ARTIFACTS_ARTIFACTOBJECTS, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Files in the workspace to upload to Cloud Storage upon successful - completion of all build steps. - - Attributes: - location: - Cloud Storage bucket and optional object path, in the form - “gs://bucket/path/to/somewhere/”. (see `Bucket Name - Requirements `__). Files in the workspace matching any - path pattern will be uploaded to Cloud Storage with this - location as a prefix. - paths: - Path globs used to match files in the build’s workspace. - timing: - Output only. Stores timing information for pushing all - artifact objects. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Artifacts.ArtifactObjects) - }, - ), - "DESCRIPTOR": _ARTIFACTS, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Artifacts produced by a build that should be uploaded upon successful - completion of all build steps. - - Attributes: - images: - A list of images to be pushed upon the successful completion - of all build steps. The images will be pushed using the - builder service account’s credentials. The digests of the - pushed images will be stored in the Build resource’s results - field. If any of the images fail to be pushed, the build is - marked FAILURE. - objects: - A list of objects to be uploaded to Cloud Storage upon - successful completion of all build steps. Files in the - workspace matching specified paths globs will be uploaded to - the specified Cloud Storage location using the builder service - account’s credentials. The location and generation of the - uploaded objects will be stored in the Build resource’s - results field. If any objects fail to be pushed, the build is - marked FAILURE. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Artifacts) - }, -) -_sym_db.RegisterMessage(Artifacts) -_sym_db.RegisterMessage(Artifacts.ArtifactObjects) - -TimeSpan = _reflection.GeneratedProtocolMessageType( - "TimeSpan", - (_message.Message,), - { - "DESCRIPTOR": _TIMESPAN, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Start and end times for a build execution phase. - - Attributes: - start_time: - Start of time span. - end_time: - End of time span. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.TimeSpan) - }, -) -_sym_db.RegisterMessage(TimeSpan) - -BuildOperationMetadata = _reflection.GeneratedProtocolMessageType( - "BuildOperationMetadata", - (_message.Message,), - { - "DESCRIPTOR": _BUILDOPERATIONMETADATA, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Metadata for build operations. - - Attributes: - build: - The build that the operation is tracking. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.BuildOperationMetadata) - }, -) -_sym_db.RegisterMessage(BuildOperationMetadata) - -SourceProvenance = _reflection.GeneratedProtocolMessageType( - "SourceProvenance", - (_message.Message,), - { - "FileHashesEntry": _reflection.GeneratedProtocolMessageType( - "FileHashesEntry", - (_message.Message,), - { - "DESCRIPTOR": _SOURCEPROVENANCE_FILEHASHESENTRY, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2" - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.SourceProvenance.FileHashesEntry) - }, - ), - "DESCRIPTOR": _SOURCEPROVENANCE, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Provenance of the source. Ways to find the original source, or verify - that some source was used for this build. - - Attributes: - resolved_storage_source: - A copy of the build’s ``source.storage_source``, if exists, - with any generations resolved. - resolved_repo_source: - A copy of the build’s ``source.repo_source``, if exists, with - any revisions resolved. - file_hashes: - Output only. Hash(es) of the build source, which can be used - to verify that the original source integrity was maintained in - the build. Note that ``FileHashes`` will only be populated if - ``BuildOptions`` has requested a ``SourceProvenanceHash``. - The keys to this map are file paths used as build source and - the values contain the hash values for those files. If the - build source came in a single package such as a gzipped - tarfile (``.tar.gz``), the ``FileHash`` will be for the single - path to that file. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.SourceProvenance) - }, -) -_sym_db.RegisterMessage(SourceProvenance) -_sym_db.RegisterMessage(SourceProvenance.FileHashesEntry) - -FileHashes = _reflection.GeneratedProtocolMessageType( - "FileHashes", - (_message.Message,), - { - "DESCRIPTOR": _FILEHASHES, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Container message for hashes of byte content of files, used in - SourceProvenance messages to verify integrity of source input to the - build. - - Attributes: - file_hash: - Collection of file hashes. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.FileHashes) - }, -) -_sym_db.RegisterMessage(FileHashes) - -Hash = _reflection.GeneratedProtocolMessageType( - "Hash", - (_message.Message,), - { - "DESCRIPTOR": _HASH, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Container message for hash values. - - Attributes: - type: - The type of hash that was performed. - value: - The hash value. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Hash) - }, -) -_sym_db.RegisterMessage(Hash) - -Secret = _reflection.GeneratedProtocolMessageType( - "Secret", - (_message.Message,), - { - "SecretEnvEntry": _reflection.GeneratedProtocolMessageType( - "SecretEnvEntry", - (_message.Message,), - { - "DESCRIPTOR": _SECRET_SECRETENVENTRY, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2" - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Secret.SecretEnvEntry) - }, - ), - "DESCRIPTOR": _SECRET, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Pairs a set of secret environment variables containing encrypted - values with the Cloud KMS key to use to decrypt the value. - - Attributes: - kms_key_name: - Cloud KMS key name to use to decrypt these envs. - secret_env: - Map of environment variable name to its encrypted value. - Secret environment variables must be unique across all of a - build’s secrets, and must be used by at least one build step. - Values can be at most 64 KB in size. There can be at most 100 - secret values across all of a build’s secrets. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Secret) - }, -) -_sym_db.RegisterMessage(Secret) -_sym_db.RegisterMessage(Secret.SecretEnvEntry) - -CreateBuildRequest = _reflection.GeneratedProtocolMessageType( - "CreateBuildRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEBUILDREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to create a new build. - - Attributes: - project_id: - Required. ID of the project. - build: - Required. Build resource to create. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.CreateBuildRequest) - }, -) -_sym_db.RegisterMessage(CreateBuildRequest) - -GetBuildRequest = _reflection.GeneratedProtocolMessageType( - "GetBuildRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETBUILDREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to get a build. - - Attributes: - project_id: - Required. ID of the project. - id: - Required. ID of the build. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.GetBuildRequest) - }, -) -_sym_db.RegisterMessage(GetBuildRequest) - -ListBuildsRequest = _reflection.GeneratedProtocolMessageType( - "ListBuildsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTBUILDSREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to list builds. - - Attributes: - project_id: - Required. ID of the project. - page_size: - Number of results to return in the list. - page_token: - Token to provide to skip to a particular spot in the list. - filter: - The raw filter text to constrain the results. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.ListBuildsRequest) - }, -) -_sym_db.RegisterMessage(ListBuildsRequest) - -ListBuildsResponse = _reflection.GeneratedProtocolMessageType( - "ListBuildsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTBUILDSRESPONSE, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Response including listed builds. - - Attributes: - builds: - Builds will be sorted by ``create_time``, descending. - next_page_token: - Token to receive the next page of results. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.ListBuildsResponse) - }, -) -_sym_db.RegisterMessage(ListBuildsResponse) - -CancelBuildRequest = _reflection.GeneratedProtocolMessageType( - "CancelBuildRequest", - (_message.Message,), - { - "DESCRIPTOR": _CANCELBUILDREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to cancel an ongoing build. - - Attributes: - project_id: - Required. ID of the project. - id: - Required. ID of the build. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.CancelBuildRequest) - }, -) -_sym_db.RegisterMessage(CancelBuildRequest) - -BuildTrigger = _reflection.GeneratedProtocolMessageType( - "BuildTrigger", - (_message.Message,), - { - "SubstitutionsEntry": _reflection.GeneratedProtocolMessageType( - "SubstitutionsEntry", - (_message.Message,), - { - "DESCRIPTOR": _BUILDTRIGGER_SUBSTITUTIONSENTRY, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2" - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.BuildTrigger.SubstitutionsEntry) - }, - ), - "DESCRIPTOR": _BUILDTRIGGER, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Configuration for an automated build in response to source repository - changes. - - Attributes: - id: - Output only. Unique identifier of the trigger. - description: - Human-readable description of this trigger. - name: - User-assigned name of the trigger. Must be unique within the - project. Trigger names must meet the following requirements: - - They must contain only alphanumeric characters and dashes. - - They can be 1-64 characters long. - They must begin and - end with an alphanumeric character. - tags: - Tags for annotation of a ``BuildTrigger`` - trigger_template: - Template describing the types of source changes to trigger a - build. Branch and tag names in trigger templates are - interpreted as regular expressions. Any branch or tag change - that matches that regular expression will trigger a build. - Mutually exclusive with ``github``. - github: - GitHubEventsConfig describes the configuration of a trigger - that creates a build whenever a GitHub event is received. - Mutually exclusive with ``trigger_template``. - build_template: - Template describing the Build request to make when the trigger - is matched. - build: - Contents of the build template. - filename: - Path, from the source root, to a file whose contents is used - for the template. - create_time: - Output only. Time when the trigger was created. - disabled: - If true, the trigger will never result in a build. - substitutions: - Substitutions for Build resource. The keys must match the - following regular expression: ``^_[A-Z0-9_]+$``.The keys - cannot conflict with the keys in bindings. - ignored_files: - ignored_files and included_files are file glob matches using - https://golang.org/pkg/path/filepath/#Match extended with - support for "**". If ignored_files and changed files are both - empty, then they are not used to determine whether or not to - trigger a build. If ignored_files is not empty, then we - ignore any files that match any of the ignored_file globs. If - the change has no files that are outside of the ignored_files - globs, then we do not trigger a build. - included_files: - If any of the files altered in the commit pass the - ignored_files filter and included_files is empty, then as far - as this filter is concerned, we should trigger the build. If - any of the files altered in the commit pass the ignored_files - filter and included_files is not empty, then we make sure that - at least one of those files matches a included_files glob. If - not, then we do not trigger a build. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.BuildTrigger) - }, -) -_sym_db.RegisterMessage(BuildTrigger) -_sym_db.RegisterMessage(BuildTrigger.SubstitutionsEntry) - -GitHubEventsConfig = _reflection.GeneratedProtocolMessageType( - "GitHubEventsConfig", - (_message.Message,), - { - "DESCRIPTOR": _GITHUBEVENTSCONFIG, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """GitHubEventsConfig describes the configuration of a trigger that - creates a build whenever a GitHub event is received. This message is - experimental. - - Attributes: - installation_id: - The installationID that emits the GitHub event. - owner: - Owner of the repository. For example: The owner for - https://github.com/googlecloudplatform/cloud-builders is - “googlecloudplatform”. - name: - Name of the repository. For example: The name for - https://github.com/googlecloudplatform/cloud-builders is - “cloud-builders”. - event: - Filter describing the types of events to trigger a build. - Currently supported event types: push, pull_request. - pull_request: - filter to match changes in pull requests. - push: - filter to match changes in refs like branches, tags. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.GitHubEventsConfig) - }, -) -_sym_db.RegisterMessage(GitHubEventsConfig) - -PullRequestFilter = _reflection.GeneratedProtocolMessageType( - "PullRequestFilter", - (_message.Message,), - { - "DESCRIPTOR": _PULLREQUESTFILTER, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """PullRequestFilter contains filter properties for matching GitHub Pull - Requests. - - Attributes: - git_ref: - Target refs to match. A target ref is the git reference where - the pull request will be applied. - branch: - Regex of branches to match. The syntax of the regular - expressions accepted is the syntax accepted by RE2 and - described at https://github.com/google/re2/wiki/Syntax - comment_control: - Whether to block builds on a “/gcbrun” comment from a - repository admin or collaborator. - invert_regex: - If true, branches that do NOT match the git_ref will trigger a - build. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.PullRequestFilter) - }, -) -_sym_db.RegisterMessage(PullRequestFilter) - -PushFilter = _reflection.GeneratedProtocolMessageType( - "PushFilter", - (_message.Message,), - { - "DESCRIPTOR": _PUSHFILTER, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Push contains filter properties for matching GitHub git pushes. - - Attributes: - git_ref: - Modified refs to match. A modified refs are the refs modified - by a git push operation. - branch: - Regexes matching branches to build. The syntax of the regular - expressions accepted is the syntax accepted by RE2 and - described at https://github.com/google/re2/wiki/Syntax - tag: - Regexes matching tags to build. The syntax of the regular - expressions accepted is the syntax accepted by RE2 and - described at https://github.com/google/re2/wiki/Syntax - invert_regex: - When true, only trigger a build if the revision regex does NOT - match the git_ref regex. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.PushFilter) - }, -) -_sym_db.RegisterMessage(PushFilter) - -CreateBuildTriggerRequest = _reflection.GeneratedProtocolMessageType( - "CreateBuildTriggerRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEBUILDTRIGGERREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to create a new ``BuildTrigger``. - - Attributes: - project_id: - Required. ID of the project for which to configure automatic - builds. - trigger: - Required. ``BuildTrigger`` to create. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.CreateBuildTriggerRequest) - }, -) -_sym_db.RegisterMessage(CreateBuildTriggerRequest) - -GetBuildTriggerRequest = _reflection.GeneratedProtocolMessageType( - "GetBuildTriggerRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETBUILDTRIGGERREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Returns the ``BuildTrigger`` with the specified ID. - - Attributes: - project_id: - Required. ID of the project that owns the trigger. - trigger_id: - Required. Identifier (``id`` or ``name``) of the - ``BuildTrigger`` to get. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.GetBuildTriggerRequest) - }, -) -_sym_db.RegisterMessage(GetBuildTriggerRequest) - -ListBuildTriggersRequest = _reflection.GeneratedProtocolMessageType( - "ListBuildTriggersRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTBUILDTRIGGERSREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to list existing ``BuildTriggers``. - - Attributes: - project_id: - Required. ID of the project for which to list BuildTriggers. - page_size: - Number of results to return in the list. - page_token: - Token to provide to skip to a particular spot in the list. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.ListBuildTriggersRequest) - }, -) -_sym_db.RegisterMessage(ListBuildTriggersRequest) - -ListBuildTriggersResponse = _reflection.GeneratedProtocolMessageType( - "ListBuildTriggersResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTBUILDTRIGGERSRESPONSE, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Response containing existing ``BuildTriggers``. - - Attributes: - triggers: - \ ``BuildTriggers`` for the project, sorted by ``create_time`` - descending. - next_page_token: - Token to receive the next page of results. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.ListBuildTriggersResponse) - }, -) -_sym_db.RegisterMessage(ListBuildTriggersResponse) - -DeleteBuildTriggerRequest = _reflection.GeneratedProtocolMessageType( - "DeleteBuildTriggerRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEBUILDTRIGGERREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to delete a ``BuildTrigger``. - - Attributes: - project_id: - Required. ID of the project that owns the trigger. - trigger_id: - Required. ID of the ``BuildTrigger`` to delete. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.DeleteBuildTriggerRequest) - }, -) -_sym_db.RegisterMessage(DeleteBuildTriggerRequest) - -UpdateBuildTriggerRequest = _reflection.GeneratedProtocolMessageType( - "UpdateBuildTriggerRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEBUILDTRIGGERREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to update an existing ``BuildTrigger``. - - Attributes: - project_id: - Required. ID of the project that owns the trigger. - trigger_id: - Required. ID of the ``BuildTrigger`` to update. - trigger: - Required. ``BuildTrigger`` to update. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.UpdateBuildTriggerRequest) - }, -) -_sym_db.RegisterMessage(UpdateBuildTriggerRequest) - -BuildOptions = _reflection.GeneratedProtocolMessageType( - "BuildOptions", - (_message.Message,), - { - "DESCRIPTOR": _BUILDOPTIONS, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Optional arguments to enable specific features of builds. - - Attributes: - source_provenance_hash: - Requested hash for SourceProvenance. - requested_verify_option: - Requested verifiability options. - machine_type: - Compute Engine machine type on which to run the build. - disk_size_gb: - Requested disk size for the VM that runs the build. Note that - this is *NOT* “disk free”; some of the space will be used by - the operating system and build utilities. Also note that this - is the minimum disk size that will be allocated for the build - – the build may run with a larger disk than requested. At - present, the maximum disk size is 1000GB; builds that request - more than the maximum are rejected with an error. - substitution_option: - Option to specify behavior when there is an error in the - substitution checks. - log_streaming_option: - Option to define build log streaming behavior to Google Cloud - Storage. - worker_pool: - Option to specify a ``WorkerPool`` for the build. Format: - projects/{project}/workerPools/{workerPool} This field is - experimental. - logging: - Option to specify the logging mode, which determines where the - logs are stored. - env: - A list of global environment variable definitions that will - exist for all build steps in this build. If a variable is - defined in both globally and in a build step, the variable - will use the build step value. The elements are of the form - “KEY=VALUE” for the environment variable “KEY” being given the - value “VALUE”. - secret_env: - A list of global environment variables, which are encrypted - using a Cloud Key Management Service crypto key. These values - must be specified in the build’s ``Secret``. These variables - will be available to all build steps in this build. - volumes: - Global list of volumes to mount for ALL build steps Each - volume is created as an empty volume prior to starting the - build process. Upon completion of the build, volumes and their - contents are discarded. Global volume names and paths cannot - conflict with the volumes defined a build step. Using a - global volume in a build with only one step is not valid as it - is indicative of a build request with an incorrect - configuration. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.BuildOptions) - }, -) -_sym_db.RegisterMessage(BuildOptions) - -WorkerPool = _reflection.GeneratedProtocolMessageType( - "WorkerPool", - (_message.Message,), - { - "DESCRIPTOR": _WORKERPOOL, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Configuration for a WorkerPool to run the builds. Workers are - machines that Cloud Build uses to run your builds. By default, all - workers run in a project owned by Cloud Build. To have full control - over the workers that execute your builds – such as enabling them to - access private resources on your private network – you can request - Cloud Build to run the workers in your own project by creating a - custom workers pool. - - Attributes: - name: - User-defined name of the ``WorkerPool``. - project_id: - The project ID of the GCP project for which the ``WorkerPool`` - is created. - service_account_email: - Output only. The service account used to manage the - ``WorkerPool``. The service account must have the Compute - Instance Admin (Beta) permission at the project level. - worker_count: - Total number of workers to be created across all requested - regions. - worker_config: - Configuration to be used for a creating workers in the - ``WorkerPool``. - regions: - List of regions to create the ``WorkerPool``. Regions can’t be - empty. If Cloud Build adds a new GCP region in the future, the - existing ``WorkerPool`` will not be enabled in the new region - automatically; you must add the new region to the ``regions`` - field to enable the ``WorkerPool`` in that region. - create_time: - Output only. Time at which the request to create the - ``WorkerPool`` was received. - update_time: - Output only. Time at which the request to update the - ``WorkerPool`` was received. - delete_time: - Output only. Time at which the request to delete the - ``WorkerPool`` was received. - status: - Output only. WorkerPool Status. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.WorkerPool) - }, -) -_sym_db.RegisterMessage(WorkerPool) - -WorkerConfig = _reflection.GeneratedProtocolMessageType( - "WorkerConfig", - (_message.Message,), - { - "DESCRIPTOR": _WORKERCONFIG, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """WorkerConfig defines the configuration to be used for a creating - workers in the pool. - - Attributes: - machine_type: - Machine Type of the worker, such as n1-standard-1. See - https://cloud.google.com/compute/docs/machine-types. If left - blank, Cloud Build will use a standard unspecified machine to - create the worker pool. ``machine_type`` is overridden if you - specify a different machine type in ``build_options``. In this - case, the VM specified in the ``build_options`` will be - created on demand at build time. For more information see - https://cloud.google.com/cloud-build/docs/speeding-up- - builds#using_custom_virtual_machine_sizes - disk_size_gb: - Size of the disk attached to the worker, in GB. See - https://cloud.google.com/compute/docs/disks/ If ``0`` is - specified, Cloud Build will use a standard disk size. - ``disk_size`` is overridden if you specify a different disk - size in ``build_options``. In this case, a VM with a disk size - specified in the ``build_options`` will be created on demand - at build time. For more information see - https://cloud.google.com/cloud- - build/docs/api/reference/rest/v1/projects.builds#buildoptions - network: - The network definition used to create the worker. If this - section is left empty, the workers will be created in - WorkerPool.project_id on the default network. - tag: - The tag applied to the worker, and the same tag used by the - firewall rule. It is used to identify the Cloud Build workers - among other VMs. The default value for tag is ``worker``. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.WorkerConfig) - }, -) -_sym_db.RegisterMessage(WorkerConfig) - -Network = _reflection.GeneratedProtocolMessageType( - "Network", - (_message.Message,), - { - "DESCRIPTOR": _NETWORK, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Network describes the GCP network used to create workers in. - - Attributes: - project_id: - Project id containing the defined network and subnetwork. For - a peered VPC, this will be the same as the project_id in which - the workers are created. For a shared VPC, this will be the - project sharing the network with the project_id project in - which workers will be created. For custom workers with no VPC, - this will be the same as project_id. - network: - Network on which the workers are created. “default” network is - used if empty. - subnetwork: - Subnetwork on which the workers are created. “default” - subnetwork is used if empty. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.Network) - }, -) -_sym_db.RegisterMessage(Network) - -CreateWorkerPoolRequest = _reflection.GeneratedProtocolMessageType( - "CreateWorkerPoolRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEWORKERPOOLREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to create a new ``WorkerPool``. - - Attributes: - parent: - ID of the parent project. - worker_pool: - \ ``WorkerPool`` resource to create. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.CreateWorkerPoolRequest) - }, -) -_sym_db.RegisterMessage(CreateWorkerPoolRequest) - -GetWorkerPoolRequest = _reflection.GeneratedProtocolMessageType( - "GetWorkerPoolRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETWORKERPOOLREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to get a ``WorkerPool`` with the specified name. - - Attributes: - name: - The field will contain name of the resource requested, for - example: “projects/project-1/workerPools/workerpool-name” - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.GetWorkerPoolRequest) - }, -) -_sym_db.RegisterMessage(GetWorkerPoolRequest) - -DeleteWorkerPoolRequest = _reflection.GeneratedProtocolMessageType( - "DeleteWorkerPoolRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEWORKERPOOLREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to delete a ``WorkerPool``. - - Attributes: - name: - The field will contain name of the resource requested, for - example: “projects/project-1/workerPools/workerpool-name” - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.DeleteWorkerPoolRequest) - }, -) -_sym_db.RegisterMessage(DeleteWorkerPoolRequest) - -UpdateWorkerPoolRequest = _reflection.GeneratedProtocolMessageType( - "UpdateWorkerPoolRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEWORKERPOOLREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to update a ``WorkerPool``. - - Attributes: - name: - The field will contain name of the resource requested, for - example: “projects/project-1/workerPools/workerpool-name” - worker_pool: - \ ``WorkerPool`` resource to update. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.UpdateWorkerPoolRequest) - }, -) -_sym_db.RegisterMessage(UpdateWorkerPoolRequest) - -ListWorkerPoolsRequest = _reflection.GeneratedProtocolMessageType( - "ListWorkerPoolsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTWORKERPOOLSREQUEST, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Request to list ``WorkerPool``\ s. - - Attributes: - parent: - ID of the parent project. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.ListWorkerPoolsRequest) - }, -) -_sym_db.RegisterMessage(ListWorkerPoolsRequest) - -ListWorkerPoolsResponse = _reflection.GeneratedProtocolMessageType( - "ListWorkerPoolsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTWORKERPOOLSRESPONSE, - "__module__": "google.cloud.devtools.cloudbuild_v1.proto.cloudbuild_pb2", - "__doc__": """Response containing existing ``WorkerPools``. - - Attributes: - worker_pools: - \ ``WorkerPools`` for the project. - """, - # @@protoc_insertion_point(class_scope:google.devtools.cloudbuild.v1.ListWorkerPoolsResponse) - }, -) -_sym_db.RegisterMessage(ListWorkerPoolsResponse) - - -DESCRIPTOR._options = None -_RETRYBUILDREQUEST.fields_by_name["project_id"]._options = None -_RETRYBUILDREQUEST.fields_by_name["id"]._options = None -_RUNBUILDTRIGGERREQUEST.fields_by_name["project_id"]._options = None -_RUNBUILDTRIGGERREQUEST.fields_by_name["trigger_id"]._options = None -_RUNBUILDTRIGGERREQUEST.fields_by_name["source"]._options = None -_REPOSOURCE_SUBSTITUTIONSENTRY._options = None -_BUILTIMAGE.fields_by_name["push_timing"]._options = None -_BUILDSTEP.fields_by_name["timing"]._options = None -_BUILD_SUBSTITUTIONSENTRY._options = None -_BUILD_TIMINGENTRY._options = None -_BUILD.fields_by_name["id"]._options = None -_BUILD.fields_by_name["project_id"]._options = None -_BUILD.fields_by_name["results"]._options = None -_BUILD.fields_by_name["create_time"]._options = None -_BUILD.fields_by_name["start_time"]._options = None -_BUILD.fields_by_name["finish_time"]._options = None -_BUILD.fields_by_name["log_url"]._options = None -_BUILD.fields_by_name["timing"]._options = None -_SOURCEPROVENANCE_FILEHASHESENTRY._options = None -_SOURCEPROVENANCE.fields_by_name["file_hashes"]._options = None -_SECRET_SECRETENVENTRY._options = None -_CREATEBUILDREQUEST.fields_by_name["project_id"]._options = None -_CREATEBUILDREQUEST.fields_by_name["build"]._options = None -_GETBUILDREQUEST.fields_by_name["project_id"]._options = None -_GETBUILDREQUEST.fields_by_name["id"]._options = None -_LISTBUILDSREQUEST.fields_by_name["project_id"]._options = None -_CANCELBUILDREQUEST.fields_by_name["project_id"]._options = None -_CANCELBUILDREQUEST.fields_by_name["id"]._options = None -_BUILDTRIGGER_SUBSTITUTIONSENTRY._options = None -_BUILDTRIGGER.fields_by_name["id"]._options = None -_BUILDTRIGGER.fields_by_name["create_time"]._options = None -_GITHUBEVENTSCONFIG.fields_by_name["installation_id"]._options = None -_CREATEBUILDTRIGGERREQUEST.fields_by_name["project_id"]._options = None -_CREATEBUILDTRIGGERREQUEST.fields_by_name["trigger"]._options = None -_GETBUILDTRIGGERREQUEST.fields_by_name["project_id"]._options = None -_GETBUILDTRIGGERREQUEST.fields_by_name["trigger_id"]._options = None -_LISTBUILDTRIGGERSREQUEST.fields_by_name["project_id"]._options = None -_DELETEBUILDTRIGGERREQUEST.fields_by_name["project_id"]._options = None -_DELETEBUILDTRIGGERREQUEST.fields_by_name["trigger_id"]._options = None -_UPDATEBUILDTRIGGERREQUEST.fields_by_name["project_id"]._options = None -_UPDATEBUILDTRIGGERREQUEST.fields_by_name["trigger_id"]._options = None -_UPDATEBUILDTRIGGERREQUEST.fields_by_name["trigger"]._options = None - -_CLOUDBUILD = _descriptor.ServiceDescriptor( - name="CloudBuild", - full_name="google.devtools.cloudbuild.v1.CloudBuild", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\031cloudbuild.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform", - create_key=_descriptor._internal_create_key, - serialized_start=8812, - serialized_end=11661, - methods=[ - _descriptor.MethodDescriptor( - name="CreateBuild", - full_name="google.devtools.cloudbuild.v1.CloudBuild.CreateBuild", - index=0, - containing_service=None, - input_type=_CREATEBUILDREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002)" /v1/projects/{project_id}/builds:\005build\332A\020project_id,build\312A\037\n\005Build\022\026BuildOperationMetadata', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetBuild", - full_name="google.devtools.cloudbuild.v1.CloudBuild.GetBuild", - index=1, - containing_service=None, - input_type=_GETBUILDREQUEST, - output_type=_BUILD, - serialized_options=b"\202\323\344\223\002'\022%/v1/projects/{project_id}/builds/{id}\332A\rproject_id,id", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ListBuilds", - full_name="google.devtools.cloudbuild.v1.CloudBuild.ListBuilds", - index=2, - containing_service=None, - input_type=_LISTBUILDSREQUEST, - output_type=_LISTBUILDSRESPONSE, - serialized_options=b'\202\323\344\223\002"\022 /v1/projects/{project_id}/builds\332A\021project_id,filter', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CancelBuild", - full_name="google.devtools.cloudbuild.v1.CloudBuild.CancelBuild", - index=3, - containing_service=None, - input_type=_CANCELBUILDREQUEST, - output_type=_BUILD, - serialized_options=b'\202\323\344\223\0021",/v1/projects/{project_id}/builds/{id}:cancel:\001*\332A\rproject_id,id', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="RetryBuild", - full_name="google.devtools.cloudbuild.v1.CloudBuild.RetryBuild", - index=4, - containing_service=None, - input_type=_RETRYBUILDREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\0020"+/v1/projects/{project_id}/builds/{id}:retry:\001*\332A\rproject_id,id\312A\037\n\005Build\022\026BuildOperationMetadata', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateBuildTrigger", - full_name="google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger", - index=5, - containing_service=None, - input_type=_CREATEBUILDTRIGGERREQUEST, - output_type=_BUILDTRIGGER, - serialized_options=b'\202\323\344\223\002-""/v1/projects/{project_id}/triggers:\007trigger\332A\022project_id,trigger', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetBuildTrigger", - full_name="google.devtools.cloudbuild.v1.CloudBuild.GetBuildTrigger", - index=6, - containing_service=None, - input_type=_GETBUILDTRIGGERREQUEST, - output_type=_BUILDTRIGGER, - serialized_options=b"\202\323\344\223\0021\022//v1/projects/{project_id}/triggers/{trigger_id}\332A\025project_id,trigger_id", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ListBuildTriggers", - full_name="google.devtools.cloudbuild.v1.CloudBuild.ListBuildTriggers", - index=7, - containing_service=None, - input_type=_LISTBUILDTRIGGERSREQUEST, - output_type=_LISTBUILDTRIGGERSRESPONSE, - serialized_options=b'\202\323\344\223\002$\022"/v1/projects/{project_id}/triggers\332A\nproject_id', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteBuildTrigger", - full_name="google.devtools.cloudbuild.v1.CloudBuild.DeleteBuildTrigger", - index=8, - containing_service=None, - input_type=_DELETEBUILDTRIGGERREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\0021*//v1/projects/{project_id}/triggers/{trigger_id}\332A\025project_id,trigger_id", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateBuildTrigger", - full_name="google.devtools.cloudbuild.v1.CloudBuild.UpdateBuildTrigger", - index=9, - containing_service=None, - input_type=_UPDATEBUILDTRIGGERREQUEST, - output_type=_BUILDTRIGGER, - serialized_options=b"\202\323\344\223\002:2//v1/projects/{project_id}/triggers/{trigger_id}:\007trigger\332A\035project_id,trigger_id,trigger", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="RunBuildTrigger", - full_name="google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger", - index=10, - containing_service=None, - input_type=_RUNBUILDTRIGGERREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002="3/v1/projects/{project_id}/triggers/{trigger_id}:run:\006source\332A\034project_id,trigger_id,source\312A\037\n\005Build\022\026BuildOperationMetadata', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateWorkerPool", - full_name="google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool", - index=11, - containing_service=None, - input_type=_CREATEWORKERPOOLREQUEST, - output_type=_WORKERPOOL, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetWorkerPool", - full_name="google.devtools.cloudbuild.v1.CloudBuild.GetWorkerPool", - index=12, - containing_service=None, - input_type=_GETWORKERPOOLREQUEST, - output_type=_WORKERPOOL, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteWorkerPool", - full_name="google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool", - index=13, - containing_service=None, - input_type=_DELETEWORKERPOOLREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateWorkerPool", - full_name="google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool", - index=14, - containing_service=None, - input_type=_UPDATEWORKERPOOLREQUEST, - output_type=_WORKERPOOL, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ListWorkerPools", - full_name="google.devtools.cloudbuild.v1.CloudBuild.ListWorkerPools", - index=15, - containing_service=None, - input_type=_LISTWORKERPOOLSREQUEST, - output_type=_LISTWORKERPOOLSRESPONSE, - serialized_options=None, - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_CLOUDBUILD) - -DESCRIPTOR.services_by_name["CloudBuild"] = _CLOUDBUILD - -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild_pb2_grpc.py b/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild_pb2_grpc.py deleted file mode 100644 index 215b18c9..00000000 --- a/google/cloud/devtools/cloudbuild_v1/proto/cloudbuild_pb2_grpc.py +++ /dev/null @@ -1,378 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -import grpc - -from google.cloud.devtools.cloudbuild_v1.proto import ( - cloudbuild_pb2 as google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class CloudBuildStub(object): - """Creates and manages builds on Google Cloud Platform. - - The main concept used by this API is a `Build`, which describes the location - of the source to build, how to build the source, and where to store the - built artifacts, if any. - - A user can list previously-requested builds or get builds by their ID to - determine the status of the build. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.CreateBuild = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/CreateBuild", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.CreateBuildRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.GetBuild = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/GetBuild", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.GetBuildRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.Build.FromString, - ) - self.ListBuilds = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/ListBuilds", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListBuildsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListBuildsResponse.FromString, - ) - self.CancelBuild = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/CancelBuild", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.CancelBuildRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.Build.FromString, - ) - self.RetryBuild = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/RetryBuild", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.RetryBuildRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.CreateBuildTrigger = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/CreateBuildTrigger", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.CreateBuildTriggerRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.BuildTrigger.FromString, - ) - self.GetBuildTrigger = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/GetBuildTrigger", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.GetBuildTriggerRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.BuildTrigger.FromString, - ) - self.ListBuildTriggers = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/ListBuildTriggers", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListBuildTriggersRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListBuildTriggersResponse.FromString, - ) - self.DeleteBuildTrigger = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/DeleteBuildTrigger", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.DeleteBuildTriggerRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.UpdateBuildTrigger = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/UpdateBuildTrigger", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.UpdateBuildTriggerRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.BuildTrigger.FromString, - ) - self.RunBuildTrigger = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/RunBuildTrigger", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.RunBuildTriggerRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.CreateWorkerPool = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/CreateWorkerPool", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.CreateWorkerPoolRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.WorkerPool.FromString, - ) - self.GetWorkerPool = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/GetWorkerPool", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.GetWorkerPoolRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.WorkerPool.FromString, - ) - self.DeleteWorkerPool = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/DeleteWorkerPool", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.DeleteWorkerPoolRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.UpdateWorkerPool = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/UpdateWorkerPool", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.UpdateWorkerPoolRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.WorkerPool.FromString, - ) - self.ListWorkerPools = channel.unary_unary( - "/google.devtools.cloudbuild.v1.CloudBuild/ListWorkerPools", - request_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListWorkerPoolsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListWorkerPoolsResponse.FromString, - ) - - -class CloudBuildServicer(object): - """Creates and manages builds on Google Cloud Platform. - - The main concept used by this API is a `Build`, which describes the location - of the source to build, how to build the source, and where to store the - built artifacts, if any. - - A user can list previously-requested builds or get builds by their ID to - determine the status of the build. - """ - - def CreateBuild(self, request, context): - """Starts a build with the specified configuration. - - This method returns a long-running `Operation`, which includes the build - ID. Pass the build ID to `GetBuild` to determine the build status (such as - `SUCCESS` or `FAILURE`). - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetBuild(self, request, context): - """Returns information about a previously requested build. - - The `Build` that is returned includes its status (such as `SUCCESS`, - `FAILURE`, or `WORKING`), and timing information. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ListBuilds(self, request, context): - """Lists previously requested builds. - - Previously requested builds may still be in-progress, or may have finished - successfully or unsuccessfully. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CancelBuild(self, request, context): - """Cancels a build in progress. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def RetryBuild(self, request, context): - """Creates a new build based on the specified build. - - This method creates a new build using the original build request, which may - or may not result in an identical build. - - For triggered builds: - - * Triggered builds resolve to a precise revision; therefore a retry of a - triggered build will result in a build that uses the same revision. - - For non-triggered builds that specify `RepoSource`: - - * If the original build built from the tip of a branch, the retried build - will build from the tip of that branch, which may not be the same revision - as the original build. - * If the original build specified a commit sha or revision ID, the retried - build will use the identical source. - - For builds that specify `StorageSource`: - - * If the original build pulled source from Google Cloud Storage without - specifying the generation of the object, the new build will use the current - object, which may be different from the original build source. - * If the original build pulled source from Cloud Storage and specified the - generation of the object, the new build will attempt to use the same - object, which may or may not be available depending on the bucket's - lifecycle management settings. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateBuildTrigger(self, request, context): - """Creates a new `BuildTrigger`. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetBuildTrigger(self, request, context): - """Returns information about a `BuildTrigger`. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ListBuildTriggers(self, request, context): - """Lists existing `BuildTrigger`s. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteBuildTrigger(self, request, context): - """Deletes a `BuildTrigger` by its project ID and trigger ID. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateBuildTrigger(self, request, context): - """Updates a `BuildTrigger` by its project ID and trigger ID. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def RunBuildTrigger(self, request, context): - """Runs a `BuildTrigger` at a particular source revision. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateWorkerPool(self, request, context): - """Creates a `WorkerPool` to run the builds, and returns the new worker pool. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetWorkerPool(self, request, context): - """Returns information about a `WorkerPool`. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteWorkerPool(self, request, context): - """Deletes a `WorkerPool` by its project ID and WorkerPool name. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateWorkerPool(self, request, context): - """Update a `WorkerPool`. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ListWorkerPools(self, request, context): - """List project's `WorkerPool`s. - - This API is experimental. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_CloudBuildServicer_to_server(servicer, server): - rpc_method_handlers = { - "CreateBuild": grpc.unary_unary_rpc_method_handler( - servicer.CreateBuild, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.CreateBuildRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "GetBuild": grpc.unary_unary_rpc_method_handler( - servicer.GetBuild, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.GetBuildRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.Build.SerializeToString, - ), - "ListBuilds": grpc.unary_unary_rpc_method_handler( - servicer.ListBuilds, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListBuildsRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListBuildsResponse.SerializeToString, - ), - "CancelBuild": grpc.unary_unary_rpc_method_handler( - servicer.CancelBuild, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.CancelBuildRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.Build.SerializeToString, - ), - "RetryBuild": grpc.unary_unary_rpc_method_handler( - servicer.RetryBuild, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.RetryBuildRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "CreateBuildTrigger": grpc.unary_unary_rpc_method_handler( - servicer.CreateBuildTrigger, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.CreateBuildTriggerRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.BuildTrigger.SerializeToString, - ), - "GetBuildTrigger": grpc.unary_unary_rpc_method_handler( - servicer.GetBuildTrigger, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.GetBuildTriggerRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.BuildTrigger.SerializeToString, - ), - "ListBuildTriggers": grpc.unary_unary_rpc_method_handler( - servicer.ListBuildTriggers, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListBuildTriggersRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListBuildTriggersResponse.SerializeToString, - ), - "DeleteBuildTrigger": grpc.unary_unary_rpc_method_handler( - servicer.DeleteBuildTrigger, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.DeleteBuildTriggerRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "UpdateBuildTrigger": grpc.unary_unary_rpc_method_handler( - servicer.UpdateBuildTrigger, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.UpdateBuildTriggerRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.BuildTrigger.SerializeToString, - ), - "RunBuildTrigger": grpc.unary_unary_rpc_method_handler( - servicer.RunBuildTrigger, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.RunBuildTriggerRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "CreateWorkerPool": grpc.unary_unary_rpc_method_handler( - servicer.CreateWorkerPool, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.CreateWorkerPoolRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.WorkerPool.SerializeToString, - ), - "GetWorkerPool": grpc.unary_unary_rpc_method_handler( - servicer.GetWorkerPool, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.GetWorkerPoolRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.WorkerPool.SerializeToString, - ), - "DeleteWorkerPool": grpc.unary_unary_rpc_method_handler( - servicer.DeleteWorkerPool, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.DeleteWorkerPoolRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "UpdateWorkerPool": grpc.unary_unary_rpc_method_handler( - servicer.UpdateWorkerPool, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.UpdateWorkerPoolRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.WorkerPool.SerializeToString, - ), - "ListWorkerPools": grpc.unary_unary_rpc_method_handler( - servicer.ListWorkerPools, - request_deserializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListWorkerPoolsRequest.FromString, - response_serializer=google_dot_cloud_dot_devtools_dot_cloudbuild__v1_dot_proto_dot_cloudbuild__pb2.ListWorkerPoolsResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.devtools.cloudbuild.v1.CloudBuild", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) diff --git a/google/cloud/devtools/cloudbuild_v1/py.typed b/google/cloud/devtools/cloudbuild_v1/py.typed new file mode 100644 index 00000000..076585a1 --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-devtools-cloudbuild package uses inline types. diff --git a/google/cloud/__init__.py b/google/cloud/devtools/cloudbuild_v1/services/__init__.py similarity index 71% rename from google/cloud/__init__.py rename to google/cloud/devtools/cloudbuild_v1/services/__init__.py index 9a1b64a6..42ffdf2b 100644 --- a/google/cloud/__init__.py +++ b/google/cloud/devtools/cloudbuild_v1/services/__init__.py @@ -1,24 +1,16 @@ # -*- coding: utf-8 -*- -# + # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil - - __path__ = pkgutil.extend_path(__path__, __name__) +# diff --git a/google/__init__.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/__init__.py similarity index 71% rename from google/__init__.py rename to google/cloud/devtools/cloudbuild_v1/services/cloud_build/__init__.py index 9a1b64a6..51798087 100644 --- a/google/__init__.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/__init__.py @@ -1,24 +1,24 @@ # -*- 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 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil +from .client import CloudBuildClient +from .async_client import CloudBuildAsyncClient - __path__ = pkgutil.extend_path(__path__, __name__) +__all__ = ( + "CloudBuildClient", + "CloudBuildAsyncClient", +) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py new file mode 100644 index 00000000..96421e96 --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py @@ -0,0 +1,1428 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation +from google.api_core import operation_async +from google.cloud.devtools.cloudbuild_v1.services.cloud_build import pagers +from google.cloud.devtools.cloudbuild_v1.types import cloudbuild +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + +from .transports.base import CloudBuildTransport +from .transports.grpc_asyncio import CloudBuildGrpcAsyncIOTransport +from .client import CloudBuildClient + + +class CloudBuildAsyncClient: + """Creates and manages builds on Google Cloud Platform. + + The main concept used by this API is a ``Build``, which describes + the location of the source to build, how to build the source, and + where to store the built artifacts, if any. + + A user can list previously-requested builds or get builds by their + ID to determine the status of the build. + """ + + _client: CloudBuildClient + + DEFAULT_ENDPOINT = CloudBuildClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = CloudBuildClient.DEFAULT_MTLS_ENDPOINT + + from_service_account_file = CloudBuildClient.from_service_account_file + from_service_account_json = from_service_account_file + + get_transport_class = functools.partial( + type(CloudBuildClient).get_transport_class, type(CloudBuildClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, CloudBuildTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + ) -> None: + """Instantiate the cloud build 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, ~.CloudBuildTransport]): 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 + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = CloudBuildClient( + credentials=credentials, transport=transport, client_options=client_options, + ) + + async def create_build( + self, + request: cloudbuild.CreateBuildRequest = None, + *, + project_id: str = None, + build: cloudbuild.Build = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Starts a build with the specified configuration. + + This method returns a long-running ``Operation``, which includes + the build ID. Pass the build ID to ``GetBuild`` to determine the + build status (such as ``SUCCESS`` or ``FAILURE``). + + Args: + request (:class:`~.cloudbuild.CreateBuildRequest`): + The request object. Request to create a new build. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + build (:class:`~.cloudbuild.Build`): + Required. Build resource to create. + This corresponds to the ``build`` 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: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.cloudbuild.Build``: A build resource in the + Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, build]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.CreateBuildRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if build is not None: + request.build = build + + # 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_build, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloudbuild.Build, + metadata_type=cloudbuild.BuildOperationMetadata, + ) + + # Done; return the response. + return response + + async def get_build( + self, + request: cloudbuild.GetBuildRequest = None, + *, + project_id: str = None, + id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.Build: + r"""Returns information about a previously requested build. + + The ``Build`` that is returned includes its status (such as + ``SUCCESS``, ``FAILURE``, or ``WORKING``), and timing + information. + + Args: + request (:class:`~.cloudbuild.GetBuildRequest`): + The request object. Request to get a build. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + id (:class:`str`): + Required. ID of the build. + This corresponds to the ``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: + ~.cloudbuild.Build: + A build resource in the Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.GetBuildRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if id is not None: + request.id = 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.get_build, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def list_builds( + self, + request: cloudbuild.ListBuildsRequest = None, + *, + project_id: str = None, + filter: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListBuildsAsyncPager: + r"""Lists previously requested builds. + Previously requested builds may still be in-progress, or + may have finished successfully or unsuccessfully. + + Args: + request (:class:`~.cloudbuild.ListBuildsRequest`): + The request object. Request to list builds. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + filter (:class:`str`): + The raw filter text to constrain the + results. + This corresponds to the ``filter`` 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: + ~.pagers.ListBuildsAsyncPager: + Response including listed builds. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, filter]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.ListBuildsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if filter is not None: + request.filter = filter + + # 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_builds, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # 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.ListBuildsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def cancel_build( + self, + request: cloudbuild.CancelBuildRequest = None, + *, + project_id: str = None, + id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.Build: + r"""Cancels a build in progress. + + Args: + request (:class:`~.cloudbuild.CancelBuildRequest`): + The request object. Request to cancel an ongoing build. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + id (:class:`str`): + Required. ID of the build. + This corresponds to the ``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: + ~.cloudbuild.Build: + A build resource in the Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.CancelBuildRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if id is not None: + request.id = 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.cancel_build, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def retry_build( + self, + request: cloudbuild.RetryBuildRequest = None, + *, + project_id: str = None, + id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Creates a new build based on the specified build. + + This method creates a new build using the original build + request, which may or may not result in an identical build. + + For triggered builds: + + - Triggered builds resolve to a precise revision; therefore a + retry of a triggered build will result in a build that uses + the same revision. + + For non-triggered builds that specify ``RepoSource``: + + - If the original build built from the tip of a branch, the + retried build will build from the tip of that branch, which + may not be the same revision as the original build. + - If the original build specified a commit sha or revision ID, + the retried build will use the identical source. + + For builds that specify ``StorageSource``: + + - If the original build pulled source from Google Cloud Storage + without specifying the generation of the object, the new + build will use the current object, which may be different + from the original build source. + - If the original build pulled source from Cloud Storage and + specified the generation of the object, the new build will + attempt to use the same object, which may or may not be + available depending on the bucket's lifecycle management + settings. + + Args: + request (:class:`~.cloudbuild.RetryBuildRequest`): + The request object. Specifies a build to retry. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + id (:class:`str`): + Required. Build ID of the original + build. + This corresponds to the ``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: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.cloudbuild.Build``: A build resource in the + Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.RetryBuildRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if id is not None: + request.id = 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_build, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloudbuild.Build, + metadata_type=cloudbuild.BuildOperationMetadata, + ) + + # Done; return the response. + return response + + async def create_build_trigger( + self, + request: cloudbuild.CreateBuildTriggerRequest = None, + *, + project_id: str = None, + trigger: cloudbuild.BuildTrigger = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.BuildTrigger: + r"""Creates a new ``BuildTrigger``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.CreateBuildTriggerRequest`): + The request object. Request to create a new + `BuildTrigger`. + project_id (:class:`str`): + Required. ID of the project for which + to configure automatic builds. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger (:class:`~.cloudbuild.BuildTrigger`): + Required. ``BuildTrigger`` to create. + This corresponds to the ``trigger`` 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: + ~.cloudbuild.BuildTrigger: + Configuration for an automated build + in response to source repository + changes. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.CreateBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger is not None: + request.trigger = trigger + + # 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_build_trigger, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_build_trigger( + self, + request: cloudbuild.GetBuildTriggerRequest = None, + *, + project_id: str = None, + trigger_id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.BuildTrigger: + r"""Returns information about a ``BuildTrigger``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.GetBuildTriggerRequest`): + The request object. Returns the `BuildTrigger` with the + specified ID. + project_id (:class:`str`): + Required. ID of the project that owns + the trigger. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger_id (:class:`str`): + Required. Identifier (``id`` or ``name``) of the + ``BuildTrigger`` to get. + This corresponds to the ``trigger_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: + ~.cloudbuild.BuildTrigger: + Configuration for an automated build + in response to source repository + changes. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger_id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.GetBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger_id is not None: + request.trigger_id = trigger_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.get_build_trigger, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def list_build_triggers( + self, + request: cloudbuild.ListBuildTriggersRequest = None, + *, + project_id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListBuildTriggersAsyncPager: + r"""Lists existing ``BuildTrigger``\ s. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.ListBuildTriggersRequest`): + The request object. Request to list existing + `BuildTriggers`. + project_id (:class:`str`): + Required. ID of the project for which + to list BuildTriggers. + This corresponds to the ``project_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: + ~.pagers.ListBuildTriggersAsyncPager: + Response containing existing ``BuildTriggers``. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.ListBuildTriggersRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + + # 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_build_triggers, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # 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.ListBuildTriggersAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def delete_build_trigger( + self, + request: cloudbuild.DeleteBuildTriggerRequest = None, + *, + project_id: str = None, + trigger_id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a ``BuildTrigger`` by its project ID and trigger ID. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.DeleteBuildTriggerRequest`): + The request object. Request to delete a `BuildTrigger`. + project_id (:class:`str`): + Required. ID of the project that owns + the trigger. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger_id (:class:`str`): + Required. ID of the ``BuildTrigger`` to delete. + This corresponds to the ``trigger_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. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger_id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.DeleteBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger_id is not None: + request.trigger_id = trigger_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.delete_build_trigger, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def update_build_trigger( + self, + request: cloudbuild.UpdateBuildTriggerRequest = None, + *, + project_id: str = None, + trigger_id: str = None, + trigger: cloudbuild.BuildTrigger = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.BuildTrigger: + r"""Updates a ``BuildTrigger`` by its project ID and trigger ID. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.UpdateBuildTriggerRequest`): + The request object. Request to update an existing + `BuildTrigger`. + project_id (:class:`str`): + Required. ID of the project that owns + the trigger. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger_id (:class:`str`): + Required. ID of the ``BuildTrigger`` to update. + This corresponds to the ``trigger_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger (:class:`~.cloudbuild.BuildTrigger`): + Required. ``BuildTrigger`` to update. + This corresponds to the ``trigger`` 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: + ~.cloudbuild.BuildTrigger: + Configuration for an automated build + in response to source repository + changes. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger_id, trigger]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.UpdateBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger_id is not None: + request.trigger_id = trigger_id + if trigger is not None: + request.trigger = trigger + + # 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_build_trigger, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def run_build_trigger( + self, + request: cloudbuild.RunBuildTriggerRequest = None, + *, + project_id: str = None, + trigger_id: str = None, + source: cloudbuild.RepoSource = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Runs a ``BuildTrigger`` at a particular source revision. + + Args: + request (:class:`~.cloudbuild.RunBuildTriggerRequest`): + The request object. Specifies a build trigger to run and + the source to use. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger_id (:class:`str`): + Required. ID of the trigger. + This corresponds to the ``trigger_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + source (:class:`~.cloudbuild.RepoSource`): + Required. Source to build against + this trigger. + This corresponds to the ``source`` 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: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.cloudbuild.Build``: A build resource in the + Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger_id, source]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.RunBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger_id is not None: + request.trigger_id = trigger_id + if source is not None: + request.source = source + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.run_build_trigger, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + cloudbuild.Build, + metadata_type=cloudbuild.BuildOperationMetadata, + ) + + # Done; return the response. + return response + + async def create_worker_pool( + self, + request: cloudbuild.CreateWorkerPoolRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.WorkerPool: + r"""Creates a ``WorkerPool`` to run the builds, and returns the new + worker pool. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.CreateWorkerPoolRequest`): + The request object. Request to create a new + `WorkerPool`. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.cloudbuild.WorkerPool: + Configuration for a WorkerPool to run + the builds. + Workers are machines that Cloud Build + uses to run your builds. By default, all + workers run in a project owned by Cloud + Build. To have full control over the + workers that execute your builds -- such + as enabling them to access private + resources on your private network -- you + can request Cloud Build to run the + workers in your own project by creating + a custom workers pool. + + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.CreateWorkerPoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_worker_pool, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_worker_pool( + self, + request: cloudbuild.GetWorkerPoolRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.WorkerPool: + r"""Returns information about a ``WorkerPool``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.GetWorkerPoolRequest`): + The request object. Request to get a `WorkerPool` with + the specified name. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.cloudbuild.WorkerPool: + Configuration for a WorkerPool to run + the builds. + Workers are machines that Cloud Build + uses to run your builds. By default, all + workers run in a project owned by Cloud + Build. To have full control over the + workers that execute your builds -- such + as enabling them to access private + resources on your private network -- you + can request Cloud Build to run the + workers in your own project by creating + a custom workers pool. + + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.GetWorkerPoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_worker_pool, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_worker_pool( + self, + request: cloudbuild.DeleteWorkerPoolRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a ``WorkerPool`` by its project ID and WorkerPool name. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.DeleteWorkerPoolRequest`): + The request object. Request to delete a `WorkerPool`. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.DeleteWorkerPoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_worker_pool, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def update_worker_pool( + self, + request: cloudbuild.UpdateWorkerPoolRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.WorkerPool: + r"""Update a ``WorkerPool``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.UpdateWorkerPoolRequest`): + The request object. Request to update a `WorkerPool`. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.cloudbuild.WorkerPool: + Configuration for a WorkerPool to run + the builds. + Workers are machines that Cloud Build + uses to run your builds. By default, all + workers run in a project owned by Cloud + Build. To have full control over the + workers that execute your builds -- such + as enabling them to access private + resources on your private network -- you + can request Cloud Build to run the + workers in your own project by creating + a custom workers pool. + + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.UpdateWorkerPoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_worker_pool, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def list_worker_pools( + self, + request: cloudbuild.ListWorkerPoolsRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.ListWorkerPoolsResponse: + r"""List project's ``WorkerPools``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.ListWorkerPoolsRequest`): + The request object. Request to list `WorkerPools`. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.cloudbuild.ListWorkerPoolsResponse: + Response containing existing ``WorkerPools``. + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.ListWorkerPoolsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_worker_pools, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-devtools-cloudbuild", + ).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("CloudBuildAsyncClient",) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py new file mode 100644 index 00000000..a89cd044 --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py @@ -0,0 +1,1551 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from collections import OrderedDict +import os +import re +from typing import Callable, Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation +from google.api_core import operation_async +from google.cloud.devtools.cloudbuild_v1.services.cloud_build import pagers +from google.cloud.devtools.cloudbuild_v1.types import cloudbuild +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + +from .transports.base import CloudBuildTransport +from .transports.grpc import CloudBuildGrpcTransport +from .transports.grpc_asyncio import CloudBuildGrpcAsyncIOTransport + + +class CloudBuildClientMeta(type): + """Metaclass for the CloudBuild 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[CloudBuildTransport]] + _transport_registry["grpc"] = CloudBuildGrpcTransport + _transport_registry["grpc_asyncio"] = CloudBuildGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[CloudBuildTransport]: + """Return 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 CloudBuildClient(metaclass=CloudBuildClientMeta): + """Creates and manages builds on Google Cloud Platform. + + The main concept used by this API is a ``Build``, which describes + the location of the source to build, how to build the source, and + where to store the built artifacts, if any. + + A user can list previously-requested builds or get builds by their + ID to determine the status of the build. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert 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 = "cloudbuild.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @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: + {@api.name}: 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 + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, CloudBuildTransport] = None, + client_options: ClientOptions = None, + ) -> None: + """Instantiate the cloud build 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, ~.CloudBuildTransport]): 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 + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = ClientOptions.from_dict(client_options) + if client_options is None: + client_options = ClientOptions.ClientOptions() + + if client_options.api_endpoint is None: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") + if use_mtls_env == "never": + client_options.api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + client_options.api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + has_client_cert_source = ( + client_options.client_cert_source is not None + or mtls.has_default_client_cert_source() + ) + client_options.api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT + if has_client_cert_source + else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" + ) + + # 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, CloudBuildTransport): + # transport is a CloudBuildTransport instance. + if credentials or client_options.credentials_file: + 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: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=client_options.api_endpoint, + scopes=client_options.scopes, + api_mtls_endpoint=client_options.api_endpoint, + client_cert_source=client_options.client_cert_source, + ) + + def create_build( + self, + request: cloudbuild.CreateBuildRequest = None, + *, + project_id: str = None, + build: cloudbuild.Build = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Starts a build with the specified configuration. + + This method returns a long-running ``Operation``, which includes + the build ID. Pass the build ID to ``GetBuild`` to determine the + build status (such as ``SUCCESS`` or ``FAILURE``). + + Args: + request (:class:`~.cloudbuild.CreateBuildRequest`): + The request object. Request to create a new build. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + build (:class:`~.cloudbuild.Build`): + Required. Build resource to create. + This corresponds to the ``build`` 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: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.cloudbuild.Build``: A build resource in the + Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, build]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.CreateBuildRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if build is not None: + request.build = build + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.create_build, + default_timeout=600.0, + client_info=_client_info, + ) + + # 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, + cloudbuild.Build, + metadata_type=cloudbuild.BuildOperationMetadata, + ) + + # Done; return the response. + return response + + def get_build( + self, + request: cloudbuild.GetBuildRequest = None, + *, + project_id: str = None, + id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.Build: + r"""Returns information about a previously requested build. + + The ``Build`` that is returned includes its status (such as + ``SUCCESS``, ``FAILURE``, or ``WORKING``), and timing + information. + + Args: + request (:class:`~.cloudbuild.GetBuildRequest`): + The request object. Request to get a build. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + id (:class:`str`): + Required. ID of the build. + This corresponds to the ``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: + ~.cloudbuild.Build: + A build resource in the Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.GetBuildRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if id is not None: + request.id = id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_build, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def list_builds( + self, + request: cloudbuild.ListBuildsRequest = None, + *, + project_id: str = None, + filter: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListBuildsPager: + r"""Lists previously requested builds. + Previously requested builds may still be in-progress, or + may have finished successfully or unsuccessfully. + + Args: + request (:class:`~.cloudbuild.ListBuildsRequest`): + The request object. Request to list builds. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + filter (:class:`str`): + The raw filter text to constrain the + results. + This corresponds to the ``filter`` 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: + ~.pagers.ListBuildsPager: + Response including listed builds. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, filter]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.ListBuildsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if filter is not None: + request.filter = filter + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_builds, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # 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.ListBuildsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def cancel_build( + self, + request: cloudbuild.CancelBuildRequest = None, + *, + project_id: str = None, + id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.Build: + r"""Cancels a build in progress. + + Args: + request (:class:`~.cloudbuild.CancelBuildRequest`): + The request object. Request to cancel an ongoing build. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + id (:class:`str`): + Required. ID of the build. + This corresponds to the ``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: + ~.cloudbuild.Build: + A build resource in the Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.CancelBuildRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if id is not None: + request.id = id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.cancel_build, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def retry_build( + self, + request: cloudbuild.RetryBuildRequest = None, + *, + project_id: str = None, + id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Creates a new build based on the specified build. + + This method creates a new build using the original build + request, which may or may not result in an identical build. + + For triggered builds: + + - Triggered builds resolve to a precise revision; therefore a + retry of a triggered build will result in a build that uses + the same revision. + + For non-triggered builds that specify ``RepoSource``: + + - If the original build built from the tip of a branch, the + retried build will build from the tip of that branch, which + may not be the same revision as the original build. + - If the original build specified a commit sha or revision ID, + the retried build will use the identical source. + + For builds that specify ``StorageSource``: + + - If the original build pulled source from Google Cloud Storage + without specifying the generation of the object, the new + build will use the current object, which may be different + from the original build source. + - If the original build pulled source from Cloud Storage and + specified the generation of the object, the new build will + attempt to use the same object, which may or may not be + available depending on the bucket's lifecycle management + settings. + + Args: + request (:class:`~.cloudbuild.RetryBuildRequest`): + The request object. Specifies a build to retry. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + id (:class:`str`): + Required. Build ID of the original + build. + This corresponds to the ``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: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.cloudbuild.Build``: A build resource in the + Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.RetryBuildRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if id is not None: + request.id = id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.retry_build, + default_timeout=600.0, + client_info=_client_info, + ) + + # 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, + cloudbuild.Build, + metadata_type=cloudbuild.BuildOperationMetadata, + ) + + # Done; return the response. + return response + + def create_build_trigger( + self, + request: cloudbuild.CreateBuildTriggerRequest = None, + *, + project_id: str = None, + trigger: cloudbuild.BuildTrigger = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.BuildTrigger: + r"""Creates a new ``BuildTrigger``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.CreateBuildTriggerRequest`): + The request object. Request to create a new + `BuildTrigger`. + project_id (:class:`str`): + Required. ID of the project for which + to configure automatic builds. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger (:class:`~.cloudbuild.BuildTrigger`): + Required. ``BuildTrigger`` to create. + This corresponds to the ``trigger`` 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: + ~.cloudbuild.BuildTrigger: + Configuration for an automated build + in response to source repository + changes. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.CreateBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger is not None: + request.trigger = trigger + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.create_build_trigger, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_build_trigger( + self, + request: cloudbuild.GetBuildTriggerRequest = None, + *, + project_id: str = None, + trigger_id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.BuildTrigger: + r"""Returns information about a ``BuildTrigger``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.GetBuildTriggerRequest`): + The request object. Returns the `BuildTrigger` with the + specified ID. + project_id (:class:`str`): + Required. ID of the project that owns + the trigger. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger_id (:class:`str`): + Required. Identifier (``id`` or ``name``) of the + ``BuildTrigger`` to get. + This corresponds to the ``trigger_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: + ~.cloudbuild.BuildTrigger: + Configuration for an automated build + in response to source repository + changes. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger_id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.GetBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger_id is not None: + request.trigger_id = trigger_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_build_trigger, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def list_build_triggers( + self, + request: cloudbuild.ListBuildTriggersRequest = None, + *, + project_id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListBuildTriggersPager: + r"""Lists existing ``BuildTrigger``\ s. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.ListBuildTriggersRequest`): + The request object. Request to list existing + `BuildTriggers`. + project_id (:class:`str`): + Required. ID of the project for which + to list BuildTriggers. + This corresponds to the ``project_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: + ~.pagers.ListBuildTriggersPager: + Response containing existing ``BuildTriggers``. + + Iterating over this object will yield results and + resolve additional pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.ListBuildTriggersRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_build_triggers, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # 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.ListBuildTriggersPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def delete_build_trigger( + self, + request: cloudbuild.DeleteBuildTriggerRequest = None, + *, + project_id: str = None, + trigger_id: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a ``BuildTrigger`` by its project ID and trigger ID. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.DeleteBuildTriggerRequest`): + The request object. Request to delete a `BuildTrigger`. + project_id (:class:`str`): + Required. ID of the project that owns + the trigger. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger_id (:class:`str`): + Required. ID of the ``BuildTrigger`` to delete. + This corresponds to the ``trigger_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. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger_id]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.DeleteBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger_id is not None: + request.trigger_id = trigger_id + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.delete_build_trigger, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def update_build_trigger( + self, + request: cloudbuild.UpdateBuildTriggerRequest = None, + *, + project_id: str = None, + trigger_id: str = None, + trigger: cloudbuild.BuildTrigger = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.BuildTrigger: + r"""Updates a ``BuildTrigger`` by its project ID and trigger ID. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.UpdateBuildTriggerRequest`): + The request object. Request to update an existing + `BuildTrigger`. + project_id (:class:`str`): + Required. ID of the project that owns + the trigger. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger_id (:class:`str`): + Required. ID of the ``BuildTrigger`` to update. + This corresponds to the ``trigger_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger (:class:`~.cloudbuild.BuildTrigger`): + Required. ``BuildTrigger`` to update. + This corresponds to the ``trigger`` 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: + ~.cloudbuild.BuildTrigger: + Configuration for an automated build + in response to source repository + changes. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger_id, trigger]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.UpdateBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger_id is not None: + request.trigger_id = trigger_id + if trigger is not None: + request.trigger = trigger + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.update_build_trigger, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def run_build_trigger( + self, + request: cloudbuild.RunBuildTriggerRequest = None, + *, + project_id: str = None, + trigger_id: str = None, + source: cloudbuild.RepoSource = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Runs a ``BuildTrigger`` at a particular source revision. + + Args: + request (:class:`~.cloudbuild.RunBuildTriggerRequest`): + The request object. Specifies a build trigger to run and + the source to use. + project_id (:class:`str`): + Required. ID of the project. + This corresponds to the ``project_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + trigger_id (:class:`str`): + Required. ID of the trigger. + This corresponds to the ``trigger_id`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + source (:class:`~.cloudbuild.RepoSource`): + Required. Source to build against + this trigger. + This corresponds to the ``source`` 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: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.cloudbuild.Build``: A build resource in the + Cloud Build API. + + At a high level, a ``Build`` describes where to find + source code, how to build it (for example, the builder + image to run on the source), and where to store the + built artifacts. + + Fields can include the following variables, which will + be expanded when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by + RepoSource. + - $BRANCH_NAME: the branch name specified by + RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified + by RepoSource or resolved from the specified branch + or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or + $COMMIT_SHA. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([project_id, trigger_id, source]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = cloudbuild.RunBuildTriggerRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if project_id is not None: + request.project_id = project_id + if trigger_id is not None: + request.trigger_id = trigger_id + if source is not None: + request.source = source + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.run_build_trigger, + default_timeout=600.0, + client_info=_client_info, + ) + + # 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, + cloudbuild.Build, + metadata_type=cloudbuild.BuildOperationMetadata, + ) + + # Done; return the response. + return response + + def create_worker_pool( + self, + request: cloudbuild.CreateWorkerPoolRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.WorkerPool: + r"""Creates a ``WorkerPool`` to run the builds, and returns the new + worker pool. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.CreateWorkerPoolRequest`): + The request object. Request to create a new + `WorkerPool`. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.cloudbuild.WorkerPool: + Configuration for a WorkerPool to run + the builds. + Workers are machines that Cloud Build + uses to run your builds. By default, all + workers run in a project owned by Cloud + Build. To have full control over the + workers that execute your builds -- such + as enabling them to access private + resources on your private network -- you + can request Cloud Build to run the + workers in your own project by creating + a custom workers pool. + + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.CreateWorkerPoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.create_worker_pool, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_worker_pool( + self, + request: cloudbuild.GetWorkerPoolRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.WorkerPool: + r"""Returns information about a ``WorkerPool``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.GetWorkerPoolRequest`): + The request object. Request to get a `WorkerPool` with + the specified name. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.cloudbuild.WorkerPool: + Configuration for a WorkerPool to run + the builds. + Workers are machines that Cloud Build + uses to run your builds. By default, all + workers run in a project owned by Cloud + Build. To have full control over the + workers that execute your builds -- such + as enabling them to access private + resources on your private network -- you + can request Cloud Build to run the + workers in your own project by creating + a custom workers pool. + + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.GetWorkerPoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.get_worker_pool, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_worker_pool( + self, + request: cloudbuild.DeleteWorkerPoolRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a ``WorkerPool`` by its project ID and WorkerPool name. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.DeleteWorkerPoolRequest`): + The request object. Request to delete a `WorkerPool`. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.DeleteWorkerPoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.delete_worker_pool, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def update_worker_pool( + self, + request: cloudbuild.UpdateWorkerPoolRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.WorkerPool: + r"""Update a ``WorkerPool``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.UpdateWorkerPoolRequest`): + The request object. Request to update a `WorkerPool`. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.cloudbuild.WorkerPool: + Configuration for a WorkerPool to run + the builds. + Workers are machines that Cloud Build + uses to run your builds. By default, all + workers run in a project owned by Cloud + Build. To have full control over the + workers that execute your builds -- such + as enabling them to access private + resources on your private network -- you + can request Cloud Build to run the + workers in your own project by creating + a custom workers pool. + + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.UpdateWorkerPoolRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.update_worker_pool, + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def list_worker_pools( + self, + request: cloudbuild.ListWorkerPoolsRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> cloudbuild.ListWorkerPoolsResponse: + r"""List project's ``WorkerPools``. + + This API is experimental. + + Args: + request (:class:`~.cloudbuild.ListWorkerPoolsRequest`): + The request object. Request to list `WorkerPools`. + + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.cloudbuild.ListWorkerPoolsResponse: + Response containing existing ``WorkerPools``. + """ + # Create or coerce a protobuf request object. + + request = cloudbuild.ListWorkerPoolsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method.wrap_method( + self._transport.list_worker_pools, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=600.0, + client_info=_client_info, + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution( + "google-devtools-cloudbuild", + ).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("CloudBuildClient",) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/pagers.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/pagers.py new file mode 100644 index 00000000..52132bd1 --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/pagers.py @@ -0,0 +1,276 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.devtools.cloudbuild_v1.types import cloudbuild + + +class ListBuildsPager: + """A pager for iterating through ``list_builds`` requests. + + This class thinly wraps an initial + :class:`~.cloudbuild.ListBuildsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``builds`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListBuilds`` requests and continue to iterate + through the ``builds`` field on the + corresponding responses. + + All the usual :class:`~.cloudbuild.ListBuildsResponse` + 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[..., cloudbuild.ListBuildsResponse], + request: cloudbuild.ListBuildsRequest, + response: cloudbuild.ListBuildsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.cloudbuild.ListBuildsRequest`): + The initial request object. + response (:class:`~.cloudbuild.ListBuildsResponse`): + 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 = cloudbuild.ListBuildsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[cloudbuild.ListBuildsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[cloudbuild.Build]: + for page in self.pages: + yield from page.builds + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListBuildsAsyncPager: + """A pager for iterating through ``list_builds`` requests. + + This class thinly wraps an initial + :class:`~.cloudbuild.ListBuildsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``builds`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListBuilds`` requests and continue to iterate + through the ``builds`` field on the + corresponding responses. + + All the usual :class:`~.cloudbuild.ListBuildsResponse` + 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[cloudbuild.ListBuildsResponse]], + request: cloudbuild.ListBuildsRequest, + response: cloudbuild.ListBuildsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.cloudbuild.ListBuildsRequest`): + The initial request object. + response (:class:`~.cloudbuild.ListBuildsResponse`): + 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 = cloudbuild.ListBuildsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[cloudbuild.ListBuildsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[cloudbuild.Build]: + async def async_generator(): + async for page in self.pages: + for response in page.builds: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListBuildTriggersPager: + """A pager for iterating through ``list_build_triggers`` requests. + + This class thinly wraps an initial + :class:`~.cloudbuild.ListBuildTriggersResponse` object, and + provides an ``__iter__`` method to iterate through its + ``triggers`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListBuildTriggers`` requests and continue to iterate + through the ``triggers`` field on the + corresponding responses. + + All the usual :class:`~.cloudbuild.ListBuildTriggersResponse` + 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[..., cloudbuild.ListBuildTriggersResponse], + request: cloudbuild.ListBuildTriggersRequest, + response: cloudbuild.ListBuildTriggersResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.cloudbuild.ListBuildTriggersRequest`): + The initial request object. + response (:class:`~.cloudbuild.ListBuildTriggersResponse`): + 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 = cloudbuild.ListBuildTriggersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[cloudbuild.ListBuildTriggersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[cloudbuild.BuildTrigger]: + for page in self.pages: + yield from page.triggers + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListBuildTriggersAsyncPager: + """A pager for iterating through ``list_build_triggers`` requests. + + This class thinly wraps an initial + :class:`~.cloudbuild.ListBuildTriggersResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``triggers`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListBuildTriggers`` requests and continue to iterate + through the ``triggers`` field on the + corresponding responses. + + All the usual :class:`~.cloudbuild.ListBuildTriggersResponse` + 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[cloudbuild.ListBuildTriggersResponse]], + request: cloudbuild.ListBuildTriggersRequest, + response: cloudbuild.ListBuildTriggersResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.cloudbuild.ListBuildTriggersRequest`): + The initial request object. + response (:class:`~.cloudbuild.ListBuildTriggersResponse`): + 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 = cloudbuild.ListBuildTriggersRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[cloudbuild.ListBuildTriggersResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[cloudbuild.BuildTrigger]: + async def async_generator(): + async for page in self.pages: + for response in page.triggers: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/__init__.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/__init__.py new file mode 100644 index 00000000..cf9e2143 --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import CloudBuildTransport +from .grpc import CloudBuildGrpcTransport +from .grpc_asyncio import CloudBuildGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[CloudBuildTransport]] +_transport_registry["grpc"] = CloudBuildGrpcTransport +_transport_registry["grpc_asyncio"] = CloudBuildGrpcAsyncIOTransport + + +__all__ = ( + "CloudBuildTransport", + "CloudBuildGrpcTransport", + "CloudBuildGrpcAsyncIOTransport", +) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py new file mode 100644 index 00000000..ace575ab --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py @@ -0,0 +1,246 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import abc +import typing + +from google import auth +from google.api_core import exceptions # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.devtools.cloudbuild_v1.types import cloudbuild +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + + +class CloudBuildTransport(abc.ABC): + """Abstract transport class for CloudBuild.""" + + AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + + def __init__( + self, + *, + host: str = "cloudbuild.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + **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. + scope (Optional[Sequence[str]]): A list of scopes. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes + ) + elif credentials is None: + credentials, _ = auth.default(scopes=scopes) + + # Save the credentials. + self._credentials = credentials + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def create_build( + self, + ) -> typing.Callable[ + [cloudbuild.CreateBuildRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def get_build( + self, + ) -> typing.Callable[ + [cloudbuild.GetBuildRequest], + typing.Union[cloudbuild.Build, typing.Awaitable[cloudbuild.Build]], + ]: + raise NotImplementedError() + + @property + def list_builds( + self, + ) -> typing.Callable[ + [cloudbuild.ListBuildsRequest], + typing.Union[ + cloudbuild.ListBuildsResponse, + typing.Awaitable[cloudbuild.ListBuildsResponse], + ], + ]: + raise NotImplementedError() + + @property + def cancel_build( + self, + ) -> typing.Callable[ + [cloudbuild.CancelBuildRequest], + typing.Union[cloudbuild.Build, typing.Awaitable[cloudbuild.Build]], + ]: + raise NotImplementedError() + + @property + def retry_build( + self, + ) -> typing.Callable[ + [cloudbuild.RetryBuildRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def create_build_trigger( + self, + ) -> typing.Callable[ + [cloudbuild.CreateBuildTriggerRequest], + typing.Union[ + cloudbuild.BuildTrigger, typing.Awaitable[cloudbuild.BuildTrigger] + ], + ]: + raise NotImplementedError() + + @property + def get_build_trigger( + self, + ) -> typing.Callable[ + [cloudbuild.GetBuildTriggerRequest], + typing.Union[ + cloudbuild.BuildTrigger, typing.Awaitable[cloudbuild.BuildTrigger] + ], + ]: + raise NotImplementedError() + + @property + def list_build_triggers( + self, + ) -> typing.Callable[ + [cloudbuild.ListBuildTriggersRequest], + typing.Union[ + cloudbuild.ListBuildTriggersResponse, + typing.Awaitable[cloudbuild.ListBuildTriggersResponse], + ], + ]: + raise NotImplementedError() + + @property + def delete_build_trigger( + self, + ) -> typing.Callable[ + [cloudbuild.DeleteBuildTriggerRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def update_build_trigger( + self, + ) -> typing.Callable[ + [cloudbuild.UpdateBuildTriggerRequest], + typing.Union[ + cloudbuild.BuildTrigger, typing.Awaitable[cloudbuild.BuildTrigger] + ], + ]: + raise NotImplementedError() + + @property + def run_build_trigger( + self, + ) -> typing.Callable[ + [cloudbuild.RunBuildTriggerRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def create_worker_pool( + self, + ) -> typing.Callable[ + [cloudbuild.CreateWorkerPoolRequest], + typing.Union[cloudbuild.WorkerPool, typing.Awaitable[cloudbuild.WorkerPool]], + ]: + raise NotImplementedError() + + @property + def get_worker_pool( + self, + ) -> typing.Callable[ + [cloudbuild.GetWorkerPoolRequest], + typing.Union[cloudbuild.WorkerPool, typing.Awaitable[cloudbuild.WorkerPool]], + ]: + raise NotImplementedError() + + @property + def delete_worker_pool( + self, + ) -> typing.Callable[ + [cloudbuild.DeleteWorkerPoolRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def update_worker_pool( + self, + ) -> typing.Callable[ + [cloudbuild.UpdateWorkerPoolRequest], + typing.Union[cloudbuild.WorkerPool, typing.Awaitable[cloudbuild.WorkerPool]], + ]: + raise NotImplementedError() + + @property + def list_worker_pools( + self, + ) -> typing.Callable[ + [cloudbuild.ListWorkerPoolsRequest], + typing.Union[ + cloudbuild.ListWorkerPoolsResponse, + typing.Awaitable[cloudbuild.ListWorkerPoolsResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("CloudBuildTransport",) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py new file mode 100644 index 00000000..a3570363 --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py @@ -0,0 +1,700 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + + +import grpc # type: ignore + +from google.cloud.devtools.cloudbuild_v1.types import cloudbuild +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import CloudBuildTransport + + +class CloudBuildGrpcTransport(CloudBuildTransport): + """gRPC backend transport for CloudBuild. + + Creates and manages builds on Google Cloud Platform. + + The main concept used by this API is a ``Build``, which describes + the location of the source to build, how to build the source, and + where to store the built artifacts, if any. + + A user can list previously-requested builds or get builds by their + ID to determine the status of the build. + + 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 = "cloudbuild.googleapis.com", + credentials: 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 + ) -> 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]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): 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. + + 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. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + ) + + self._stubs = {} # type: Dict[str, Callable] + + @classmethod + def create_channel( + cls, + host: str = "cloudbuild.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + **kwargs + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[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`. + 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. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + 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. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def create_build( + self, + ) -> Callable[[cloudbuild.CreateBuildRequest], operations.Operation]: + r"""Return a callable for the create build method over gRPC. + + Starts a build with the specified configuration. + + This method returns a long-running ``Operation``, which includes + the build ID. Pass the build ID to ``GetBuild`` to determine the + build status (such as ``SUCCESS`` or ``FAILURE``). + + Returns: + Callable[[~.CreateBuildRequest], + ~.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_build" not in self._stubs: + self._stubs["create_build"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/CreateBuild", + request_serializer=cloudbuild.CreateBuildRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["create_build"] + + @property + def get_build(self) -> Callable[[cloudbuild.GetBuildRequest], cloudbuild.Build]: + r"""Return a callable for the get build method over gRPC. + + Returns information about a previously requested build. + + The ``Build`` that is returned includes its status (such as + ``SUCCESS``, ``FAILURE``, or ``WORKING``), and timing + information. + + Returns: + Callable[[~.GetBuildRequest], + ~.Build]: + 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_build" not in self._stubs: + self._stubs["get_build"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/GetBuild", + request_serializer=cloudbuild.GetBuildRequest.serialize, + response_deserializer=cloudbuild.Build.deserialize, + ) + return self._stubs["get_build"] + + @property + def list_builds( + self, + ) -> Callable[[cloudbuild.ListBuildsRequest], cloudbuild.ListBuildsResponse]: + r"""Return a callable for the list builds method over gRPC. + + Lists previously requested builds. + Previously requested builds may still be in-progress, or + may have finished successfully or unsuccessfully. + + Returns: + Callable[[~.ListBuildsRequest], + ~.ListBuildsResponse]: + 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_builds" not in self._stubs: + self._stubs["list_builds"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/ListBuilds", + request_serializer=cloudbuild.ListBuildsRequest.serialize, + response_deserializer=cloudbuild.ListBuildsResponse.deserialize, + ) + return self._stubs["list_builds"] + + @property + def cancel_build( + self, + ) -> Callable[[cloudbuild.CancelBuildRequest], cloudbuild.Build]: + r"""Return a callable for the cancel build method over gRPC. + + Cancels a build in progress. + + Returns: + Callable[[~.CancelBuildRequest], + ~.Build]: + 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 "cancel_build" not in self._stubs: + self._stubs["cancel_build"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/CancelBuild", + request_serializer=cloudbuild.CancelBuildRequest.serialize, + response_deserializer=cloudbuild.Build.deserialize, + ) + return self._stubs["cancel_build"] + + @property + def retry_build( + self, + ) -> Callable[[cloudbuild.RetryBuildRequest], operations.Operation]: + r"""Return a callable for the retry build method over gRPC. + + Creates a new build based on the specified build. + + This method creates a new build using the original build + request, which may or may not result in an identical build. + + For triggered builds: + + - Triggered builds resolve to a precise revision; therefore a + retry of a triggered build will result in a build that uses + the same revision. + + For non-triggered builds that specify ``RepoSource``: + + - If the original build built from the tip of a branch, the + retried build will build from the tip of that branch, which + may not be the same revision as the original build. + - If the original build specified a commit sha or revision ID, + the retried build will use the identical source. + + For builds that specify ``StorageSource``: + + - If the original build pulled source from Google Cloud Storage + without specifying the generation of the object, the new + build will use the current object, which may be different + from the original build source. + - If the original build pulled source from Cloud Storage and + specified the generation of the object, the new build will + attempt to use the same object, which may or may not be + available depending on the bucket's lifecycle management + settings. + + Returns: + Callable[[~.RetryBuildRequest], + ~.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 "retry_build" not in self._stubs: + self._stubs["retry_build"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/RetryBuild", + request_serializer=cloudbuild.RetryBuildRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["retry_build"] + + @property + def create_build_trigger( + self, + ) -> Callable[[cloudbuild.CreateBuildTriggerRequest], cloudbuild.BuildTrigger]: + r"""Return a callable for the create build trigger method over gRPC. + + Creates a new ``BuildTrigger``. + + This API is experimental. + + Returns: + Callable[[~.CreateBuildTriggerRequest], + ~.BuildTrigger]: + 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_build_trigger" not in self._stubs: + self._stubs["create_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/CreateBuildTrigger", + request_serializer=cloudbuild.CreateBuildTriggerRequest.serialize, + response_deserializer=cloudbuild.BuildTrigger.deserialize, + ) + return self._stubs["create_build_trigger"] + + @property + def get_build_trigger( + self, + ) -> Callable[[cloudbuild.GetBuildTriggerRequest], cloudbuild.BuildTrigger]: + r"""Return a callable for the get build trigger method over gRPC. + + Returns information about a ``BuildTrigger``. + + This API is experimental. + + Returns: + Callable[[~.GetBuildTriggerRequest], + ~.BuildTrigger]: + 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_build_trigger" not in self._stubs: + self._stubs["get_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/GetBuildTrigger", + request_serializer=cloudbuild.GetBuildTriggerRequest.serialize, + response_deserializer=cloudbuild.BuildTrigger.deserialize, + ) + return self._stubs["get_build_trigger"] + + @property + def list_build_triggers( + self, + ) -> Callable[ + [cloudbuild.ListBuildTriggersRequest], cloudbuild.ListBuildTriggersResponse + ]: + r"""Return a callable for the list build triggers method over gRPC. + + Lists existing ``BuildTrigger``\ s. + + This API is experimental. + + Returns: + Callable[[~.ListBuildTriggersRequest], + ~.ListBuildTriggersResponse]: + 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_build_triggers" not in self._stubs: + self._stubs["list_build_triggers"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/ListBuildTriggers", + request_serializer=cloudbuild.ListBuildTriggersRequest.serialize, + response_deserializer=cloudbuild.ListBuildTriggersResponse.deserialize, + ) + return self._stubs["list_build_triggers"] + + @property + def delete_build_trigger( + self, + ) -> Callable[[cloudbuild.DeleteBuildTriggerRequest], empty.Empty]: + r"""Return a callable for the delete build trigger method over gRPC. + + Deletes a ``BuildTrigger`` by its project ID and trigger ID. + + This API is experimental. + + Returns: + Callable[[~.DeleteBuildTriggerRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_build_trigger" not in self._stubs: + self._stubs["delete_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/DeleteBuildTrigger", + request_serializer=cloudbuild.DeleteBuildTriggerRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_build_trigger"] + + @property + def update_build_trigger( + self, + ) -> Callable[[cloudbuild.UpdateBuildTriggerRequest], cloudbuild.BuildTrigger]: + r"""Return a callable for the update build trigger method over gRPC. + + Updates a ``BuildTrigger`` by its project ID and trigger ID. + + This API is experimental. + + Returns: + Callable[[~.UpdateBuildTriggerRequest], + ~.BuildTrigger]: + 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_build_trigger" not in self._stubs: + self._stubs["update_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/UpdateBuildTrigger", + request_serializer=cloudbuild.UpdateBuildTriggerRequest.serialize, + response_deserializer=cloudbuild.BuildTrigger.deserialize, + ) + return self._stubs["update_build_trigger"] + + @property + def run_build_trigger( + self, + ) -> Callable[[cloudbuild.RunBuildTriggerRequest], operations.Operation]: + r"""Return a callable for the run build trigger method over gRPC. + + Runs a ``BuildTrigger`` at a particular source revision. + + Returns: + Callable[[~.RunBuildTriggerRequest], + ~.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 "run_build_trigger" not in self._stubs: + self._stubs["run_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/RunBuildTrigger", + request_serializer=cloudbuild.RunBuildTriggerRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["run_build_trigger"] + + @property + def create_worker_pool( + self, + ) -> Callable[[cloudbuild.CreateWorkerPoolRequest], cloudbuild.WorkerPool]: + r"""Return a callable for the create worker pool method over gRPC. + + Creates a ``WorkerPool`` to run the builds, and returns the new + worker pool. + + This API is experimental. + + Returns: + Callable[[~.CreateWorkerPoolRequest], + ~.WorkerPool]: + 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_worker_pool" not in self._stubs: + self._stubs["create_worker_pool"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/CreateWorkerPool", + request_serializer=cloudbuild.CreateWorkerPoolRequest.serialize, + response_deserializer=cloudbuild.WorkerPool.deserialize, + ) + return self._stubs["create_worker_pool"] + + @property + def get_worker_pool( + self, + ) -> Callable[[cloudbuild.GetWorkerPoolRequest], cloudbuild.WorkerPool]: + r"""Return a callable for the get worker pool method over gRPC. + + Returns information about a ``WorkerPool``. + + This API is experimental. + + Returns: + Callable[[~.GetWorkerPoolRequest], + ~.WorkerPool]: + 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_worker_pool" not in self._stubs: + self._stubs["get_worker_pool"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/GetWorkerPool", + request_serializer=cloudbuild.GetWorkerPoolRequest.serialize, + response_deserializer=cloudbuild.WorkerPool.deserialize, + ) + return self._stubs["get_worker_pool"] + + @property + def delete_worker_pool( + self, + ) -> Callable[[cloudbuild.DeleteWorkerPoolRequest], empty.Empty]: + r"""Return a callable for the delete worker pool method over gRPC. + + Deletes a ``WorkerPool`` by its project ID and WorkerPool name. + + This API is experimental. + + Returns: + Callable[[~.DeleteWorkerPoolRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_worker_pool" not in self._stubs: + self._stubs["delete_worker_pool"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/DeleteWorkerPool", + request_serializer=cloudbuild.DeleteWorkerPoolRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_worker_pool"] + + @property + def update_worker_pool( + self, + ) -> Callable[[cloudbuild.UpdateWorkerPoolRequest], cloudbuild.WorkerPool]: + r"""Return a callable for the update worker pool method over gRPC. + + Update a ``WorkerPool``. + + This API is experimental. + + Returns: + Callable[[~.UpdateWorkerPoolRequest], + ~.WorkerPool]: + 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_worker_pool" not in self._stubs: + self._stubs["update_worker_pool"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/UpdateWorkerPool", + request_serializer=cloudbuild.UpdateWorkerPoolRequest.serialize, + response_deserializer=cloudbuild.WorkerPool.deserialize, + ) + return self._stubs["update_worker_pool"] + + @property + def list_worker_pools( + self, + ) -> Callable[ + [cloudbuild.ListWorkerPoolsRequest], cloudbuild.ListWorkerPoolsResponse + ]: + r"""Return a callable for the list worker pools method over gRPC. + + List project's ``WorkerPools``. + + This API is experimental. + + Returns: + Callable[[~.ListWorkerPoolsRequest], + ~.ListWorkerPoolsResponse]: + 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_worker_pools" not in self._stubs: + self._stubs["list_worker_pools"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/ListWorkerPools", + request_serializer=cloudbuild.ListWorkerPoolsRequest.serialize, + response_deserializer=cloudbuild.ListWorkerPoolsResponse.deserialize, + ) + return self._stubs["list_worker_pools"] + + +__all__ = ("CloudBuildGrpcTransport",) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py new file mode 100644 index 00000000..432dfb85 --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py @@ -0,0 +1,711 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import 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.devtools.cloudbuild_v1.types import cloudbuild +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import CloudBuildTransport +from .grpc import CloudBuildGrpcTransport + + +class CloudBuildGrpcAsyncIOTransport(CloudBuildTransport): + """gRPC AsyncIO backend transport for CloudBuild. + + Creates and manages builds on Google Cloud Platform. + + The main concept used by this API is a ``Build``, which describes + the location of the source to build, how to build the source, and + where to store the built artifacts, if any. + + A user can list previously-requested builds or get builds by their + ID to determine the status of the build. + + 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 = "cloudbuild.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + **kwargs + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (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`. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + **kwargs + ) + + def __init__( + self, + *, + host: str = "cloudbuild.googleapis.com", + credentials: 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 + ) -> 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]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): 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. + + 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. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + ) + + self._stubs = {} + + @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. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # 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. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def create_build( + self, + ) -> Callable[[cloudbuild.CreateBuildRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the create build method over gRPC. + + Starts a build with the specified configuration. + + This method returns a long-running ``Operation``, which includes + the build ID. Pass the build ID to ``GetBuild`` to determine the + build status (such as ``SUCCESS`` or ``FAILURE``). + + Returns: + Callable[[~.CreateBuildRequest], + 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_build" not in self._stubs: + self._stubs["create_build"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/CreateBuild", + request_serializer=cloudbuild.CreateBuildRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["create_build"] + + @property + def get_build( + self, + ) -> Callable[[cloudbuild.GetBuildRequest], Awaitable[cloudbuild.Build]]: + r"""Return a callable for the get build method over gRPC. + + Returns information about a previously requested build. + + The ``Build`` that is returned includes its status (such as + ``SUCCESS``, ``FAILURE``, or ``WORKING``), and timing + information. + + Returns: + Callable[[~.GetBuildRequest], + Awaitable[~.Build]]: + 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_build" not in self._stubs: + self._stubs["get_build"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/GetBuild", + request_serializer=cloudbuild.GetBuildRequest.serialize, + response_deserializer=cloudbuild.Build.deserialize, + ) + return self._stubs["get_build"] + + @property + def list_builds( + self, + ) -> Callable[ + [cloudbuild.ListBuildsRequest], Awaitable[cloudbuild.ListBuildsResponse] + ]: + r"""Return a callable for the list builds method over gRPC. + + Lists previously requested builds. + Previously requested builds may still be in-progress, or + may have finished successfully or unsuccessfully. + + Returns: + Callable[[~.ListBuildsRequest], + Awaitable[~.ListBuildsResponse]]: + 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_builds" not in self._stubs: + self._stubs["list_builds"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/ListBuilds", + request_serializer=cloudbuild.ListBuildsRequest.serialize, + response_deserializer=cloudbuild.ListBuildsResponse.deserialize, + ) + return self._stubs["list_builds"] + + @property + def cancel_build( + self, + ) -> Callable[[cloudbuild.CancelBuildRequest], Awaitable[cloudbuild.Build]]: + r"""Return a callable for the cancel build method over gRPC. + + Cancels a build in progress. + + Returns: + Callable[[~.CancelBuildRequest], + Awaitable[~.Build]]: + 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 "cancel_build" not in self._stubs: + self._stubs["cancel_build"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/CancelBuild", + request_serializer=cloudbuild.CancelBuildRequest.serialize, + response_deserializer=cloudbuild.Build.deserialize, + ) + return self._stubs["cancel_build"] + + @property + def retry_build( + self, + ) -> Callable[[cloudbuild.RetryBuildRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the retry build method over gRPC. + + Creates a new build based on the specified build. + + This method creates a new build using the original build + request, which may or may not result in an identical build. + + For triggered builds: + + - Triggered builds resolve to a precise revision; therefore a + retry of a triggered build will result in a build that uses + the same revision. + + For non-triggered builds that specify ``RepoSource``: + + - If the original build built from the tip of a branch, the + retried build will build from the tip of that branch, which + may not be the same revision as the original build. + - If the original build specified a commit sha or revision ID, + the retried build will use the identical source. + + For builds that specify ``StorageSource``: + + - If the original build pulled source from Google Cloud Storage + without specifying the generation of the object, the new + build will use the current object, which may be different + from the original build source. + - If the original build pulled source from Cloud Storage and + specified the generation of the object, the new build will + attempt to use the same object, which may or may not be + available depending on the bucket's lifecycle management + settings. + + Returns: + Callable[[~.RetryBuildRequest], + 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 "retry_build" not in self._stubs: + self._stubs["retry_build"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/RetryBuild", + request_serializer=cloudbuild.RetryBuildRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["retry_build"] + + @property + def create_build_trigger( + self, + ) -> Callable[ + [cloudbuild.CreateBuildTriggerRequest], Awaitable[cloudbuild.BuildTrigger] + ]: + r"""Return a callable for the create build trigger method over gRPC. + + Creates a new ``BuildTrigger``. + + This API is experimental. + + Returns: + Callable[[~.CreateBuildTriggerRequest], + Awaitable[~.BuildTrigger]]: + 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_build_trigger" not in self._stubs: + self._stubs["create_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/CreateBuildTrigger", + request_serializer=cloudbuild.CreateBuildTriggerRequest.serialize, + response_deserializer=cloudbuild.BuildTrigger.deserialize, + ) + return self._stubs["create_build_trigger"] + + @property + def get_build_trigger( + self, + ) -> Callable[ + [cloudbuild.GetBuildTriggerRequest], Awaitable[cloudbuild.BuildTrigger] + ]: + r"""Return a callable for the get build trigger method over gRPC. + + Returns information about a ``BuildTrigger``. + + This API is experimental. + + Returns: + Callable[[~.GetBuildTriggerRequest], + Awaitable[~.BuildTrigger]]: + 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_build_trigger" not in self._stubs: + self._stubs["get_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/GetBuildTrigger", + request_serializer=cloudbuild.GetBuildTriggerRequest.serialize, + response_deserializer=cloudbuild.BuildTrigger.deserialize, + ) + return self._stubs["get_build_trigger"] + + @property + def list_build_triggers( + self, + ) -> Callable[ + [cloudbuild.ListBuildTriggersRequest], + Awaitable[cloudbuild.ListBuildTriggersResponse], + ]: + r"""Return a callable for the list build triggers method over gRPC. + + Lists existing ``BuildTrigger``\ s. + + This API is experimental. + + Returns: + Callable[[~.ListBuildTriggersRequest], + Awaitable[~.ListBuildTriggersResponse]]: + 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_build_triggers" not in self._stubs: + self._stubs["list_build_triggers"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/ListBuildTriggers", + request_serializer=cloudbuild.ListBuildTriggersRequest.serialize, + response_deserializer=cloudbuild.ListBuildTriggersResponse.deserialize, + ) + return self._stubs["list_build_triggers"] + + @property + def delete_build_trigger( + self, + ) -> Callable[[cloudbuild.DeleteBuildTriggerRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete build trigger method over gRPC. + + Deletes a ``BuildTrigger`` by its project ID and trigger ID. + + This API is experimental. + + Returns: + Callable[[~.DeleteBuildTriggerRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_build_trigger" not in self._stubs: + self._stubs["delete_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/DeleteBuildTrigger", + request_serializer=cloudbuild.DeleteBuildTriggerRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_build_trigger"] + + @property + def update_build_trigger( + self, + ) -> Callable[ + [cloudbuild.UpdateBuildTriggerRequest], Awaitable[cloudbuild.BuildTrigger] + ]: + r"""Return a callable for the update build trigger method over gRPC. + + Updates a ``BuildTrigger`` by its project ID and trigger ID. + + This API is experimental. + + Returns: + Callable[[~.UpdateBuildTriggerRequest], + Awaitable[~.BuildTrigger]]: + 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_build_trigger" not in self._stubs: + self._stubs["update_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/UpdateBuildTrigger", + request_serializer=cloudbuild.UpdateBuildTriggerRequest.serialize, + response_deserializer=cloudbuild.BuildTrigger.deserialize, + ) + return self._stubs["update_build_trigger"] + + @property + def run_build_trigger( + self, + ) -> Callable[[cloudbuild.RunBuildTriggerRequest], Awaitable[operations.Operation]]: + r"""Return a callable for the run build trigger method over gRPC. + + Runs a ``BuildTrigger`` at a particular source revision. + + Returns: + Callable[[~.RunBuildTriggerRequest], + 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 "run_build_trigger" not in self._stubs: + self._stubs["run_build_trigger"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/RunBuildTrigger", + request_serializer=cloudbuild.RunBuildTriggerRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["run_build_trigger"] + + @property + def create_worker_pool( + self, + ) -> Callable[ + [cloudbuild.CreateWorkerPoolRequest], Awaitable[cloudbuild.WorkerPool] + ]: + r"""Return a callable for the create worker pool method over gRPC. + + Creates a ``WorkerPool`` to run the builds, and returns the new + worker pool. + + This API is experimental. + + Returns: + Callable[[~.CreateWorkerPoolRequest], + Awaitable[~.WorkerPool]]: + 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_worker_pool" not in self._stubs: + self._stubs["create_worker_pool"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/CreateWorkerPool", + request_serializer=cloudbuild.CreateWorkerPoolRequest.serialize, + response_deserializer=cloudbuild.WorkerPool.deserialize, + ) + return self._stubs["create_worker_pool"] + + @property + def get_worker_pool( + self, + ) -> Callable[[cloudbuild.GetWorkerPoolRequest], Awaitable[cloudbuild.WorkerPool]]: + r"""Return a callable for the get worker pool method over gRPC. + + Returns information about a ``WorkerPool``. + + This API is experimental. + + Returns: + Callable[[~.GetWorkerPoolRequest], + Awaitable[~.WorkerPool]]: + 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_worker_pool" not in self._stubs: + self._stubs["get_worker_pool"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/GetWorkerPool", + request_serializer=cloudbuild.GetWorkerPoolRequest.serialize, + response_deserializer=cloudbuild.WorkerPool.deserialize, + ) + return self._stubs["get_worker_pool"] + + @property + def delete_worker_pool( + self, + ) -> Callable[[cloudbuild.DeleteWorkerPoolRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete worker pool method over gRPC. + + Deletes a ``WorkerPool`` by its project ID and WorkerPool name. + + This API is experimental. + + Returns: + Callable[[~.DeleteWorkerPoolRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_worker_pool" not in self._stubs: + self._stubs["delete_worker_pool"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/DeleteWorkerPool", + request_serializer=cloudbuild.DeleteWorkerPoolRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_worker_pool"] + + @property + def update_worker_pool( + self, + ) -> Callable[ + [cloudbuild.UpdateWorkerPoolRequest], Awaitable[cloudbuild.WorkerPool] + ]: + r"""Return a callable for the update worker pool method over gRPC. + + Update a ``WorkerPool``. + + This API is experimental. + + Returns: + Callable[[~.UpdateWorkerPoolRequest], + Awaitable[~.WorkerPool]]: + 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_worker_pool" not in self._stubs: + self._stubs["update_worker_pool"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/UpdateWorkerPool", + request_serializer=cloudbuild.UpdateWorkerPoolRequest.serialize, + response_deserializer=cloudbuild.WorkerPool.deserialize, + ) + return self._stubs["update_worker_pool"] + + @property + def list_worker_pools( + self, + ) -> Callable[ + [cloudbuild.ListWorkerPoolsRequest], + Awaitable[cloudbuild.ListWorkerPoolsResponse], + ]: + r"""Return a callable for the list worker pools method over gRPC. + + List project's ``WorkerPools``. + + This API is experimental. + + Returns: + Callable[[~.ListWorkerPoolsRequest], + Awaitable[~.ListWorkerPoolsResponse]]: + 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_worker_pools" not in self._stubs: + self._stubs["list_worker_pools"] = self.grpc_channel.unary_unary( + "/google.devtools.cloudbuild.v1.CloudBuild/ListWorkerPools", + request_serializer=cloudbuild.ListWorkerPoolsRequest.serialize, + response_deserializer=cloudbuild.ListWorkerPoolsResponse.deserialize, + ) + return self._stubs["list_worker_pools"] + + +__all__ = ("CloudBuildGrpcAsyncIOTransport",) diff --git a/google/cloud/devtools/cloudbuild_v1/types.py b/google/cloud/devtools/cloudbuild_v1/types.py deleted file mode 100644 index bb5281bf..00000000 --- a/google/cloud/devtools/cloudbuild_v1/types.py +++ /dev/null @@ -1,58 +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. - - -from __future__ import absolute_import -import sys - -from google.api_core.protobuf_helpers import get_messages - -from google.cloud.devtools.cloudbuild_v1.proto import cloudbuild_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import any_pb2 -from google.protobuf import duration_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import timestamp_pb2 -from google.rpc import status_pb2 - - -_shared_modules = [ - operations_pb2, - any_pb2, - duration_pb2, - empty_pb2, - timestamp_pb2, - status_pb2, -] - -_local_modules = [ - cloudbuild_pb2, -] - -names = [] - -for module in _shared_modules: # pragma: NO COVER - for name, message in get_messages(module).items(): - setattr(sys.modules[__name__], name, message) - names.append(name) -for module in _local_modules: - for name, message in get_messages(module).items(): - message.__module__ = "google.cloud.devtools.cloudbuild_v1.types" - setattr(sys.modules[__name__], name, message) - names.append(name) - - -__all__ = tuple(sorted(names)) diff --git a/google/cloud/devtools/cloudbuild_v1/types/__init__.py b/google/cloud/devtools/cloudbuild_v1/types/__init__.py new file mode 100644 index 00000000..c9fc9fed --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/types/__init__.py @@ -0,0 +1,109 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +from .cloudbuild import ( + RetryBuildRequest, + RunBuildTriggerRequest, + StorageSource, + RepoSource, + Source, + BuiltImage, + BuildStep, + Volume, + Results, + ArtifactResult, + Build, + Artifacts, + TimeSpan, + BuildOperationMetadata, + SourceProvenance, + FileHashes, + Hash, + Secret, + CreateBuildRequest, + GetBuildRequest, + ListBuildsRequest, + ListBuildsResponse, + CancelBuildRequest, + BuildTrigger, + GitHubEventsConfig, + PullRequestFilter, + PushFilter, + CreateBuildTriggerRequest, + GetBuildTriggerRequest, + ListBuildTriggersRequest, + ListBuildTriggersResponse, + DeleteBuildTriggerRequest, + UpdateBuildTriggerRequest, + BuildOptions, + WorkerPool, + WorkerConfig, + Network, + CreateWorkerPoolRequest, + GetWorkerPoolRequest, + DeleteWorkerPoolRequest, + UpdateWorkerPoolRequest, + ListWorkerPoolsRequest, + ListWorkerPoolsResponse, +) + + +__all__ = ( + "RetryBuildRequest", + "RunBuildTriggerRequest", + "StorageSource", + "RepoSource", + "Source", + "BuiltImage", + "BuildStep", + "Volume", + "Results", + "ArtifactResult", + "Build", + "Artifacts", + "TimeSpan", + "BuildOperationMetadata", + "SourceProvenance", + "FileHashes", + "Hash", + "Secret", + "CreateBuildRequest", + "GetBuildRequest", + "ListBuildsRequest", + "ListBuildsResponse", + "CancelBuildRequest", + "BuildTrigger", + "GitHubEventsConfig", + "PullRequestFilter", + "PushFilter", + "CreateBuildTriggerRequest", + "GetBuildTriggerRequest", + "ListBuildTriggersRequest", + "ListBuildTriggersResponse", + "DeleteBuildTriggerRequest", + "UpdateBuildTriggerRequest", + "BuildOptions", + "WorkerPool", + "WorkerConfig", + "Network", + "CreateWorkerPoolRequest", + "GetWorkerPoolRequest", + "DeleteWorkerPoolRequest", + "UpdateWorkerPoolRequest", + "ListWorkerPoolsRequest", + "ListWorkerPoolsResponse", +) diff --git a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py new file mode 100644 index 00000000..371c86c4 --- /dev/null +++ b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py @@ -0,0 +1,1548 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import proto # type: ignore + + +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + + +__protobuf__ = proto.module( + package="google.devtools.cloudbuild.v1", + manifest={ + "RetryBuildRequest", + "RunBuildTriggerRequest", + "StorageSource", + "RepoSource", + "Source", + "BuiltImage", + "BuildStep", + "Volume", + "Results", + "ArtifactResult", + "Build", + "Artifacts", + "TimeSpan", + "BuildOperationMetadata", + "SourceProvenance", + "FileHashes", + "Hash", + "Secret", + "CreateBuildRequest", + "GetBuildRequest", + "ListBuildsRequest", + "ListBuildsResponse", + "CancelBuildRequest", + "BuildTrigger", + "GitHubEventsConfig", + "PullRequestFilter", + "PushFilter", + "CreateBuildTriggerRequest", + "GetBuildTriggerRequest", + "ListBuildTriggersRequest", + "ListBuildTriggersResponse", + "DeleteBuildTriggerRequest", + "UpdateBuildTriggerRequest", + "BuildOptions", + "WorkerPool", + "WorkerConfig", + "Network", + "CreateWorkerPoolRequest", + "GetWorkerPoolRequest", + "DeleteWorkerPoolRequest", + "UpdateWorkerPoolRequest", + "ListWorkerPoolsRequest", + "ListWorkerPoolsResponse", + }, +) + + +class RetryBuildRequest(proto.Message): + r"""Specifies a build to retry. + + Attributes: + project_id (str): + Required. ID of the project. + id (str): + Required. Build ID of the original build. + """ + + project_id = proto.Field(proto.STRING, number=1) + + id = proto.Field(proto.STRING, number=2) + + +class RunBuildTriggerRequest(proto.Message): + r"""Specifies a build trigger to run and the source to use. + + Attributes: + project_id (str): + Required. ID of the project. + trigger_id (str): + Required. ID of the trigger. + source (~.cloudbuild.RepoSource): + Required. Source to build against this + trigger. + """ + + project_id = proto.Field(proto.STRING, number=1) + + trigger_id = proto.Field(proto.STRING, number=2) + + source = proto.Field(proto.MESSAGE, number=3, message="RepoSource",) + + +class StorageSource(proto.Message): + r"""Location of the source in an archive file in Google Cloud + Storage. + + Attributes: + bucket (str): + Google Cloud Storage bucket containing the source (see + `Bucket Name + Requirements `__). + object (str): + Google Cloud Storage object containing the source. + + This object must be a gzipped archive file (``.tar.gz``) + containing source to build. + generation (int): + Google Cloud Storage generation for the + object. If the generation is omitted, the latest + generation will be used. + """ + + bucket = proto.Field(proto.STRING, number=1) + + object = proto.Field(proto.STRING, number=2) + + generation = proto.Field(proto.INT64, number=3) + + +class RepoSource(proto.Message): + r"""Location of the source in a Google Cloud Source Repository. + + Attributes: + project_id (str): + ID of the project that owns the Cloud Source + Repository. If omitted, the project ID + requesting the build is assumed. + repo_name (str): + Required. Name of the Cloud Source + Repository. + branch_name (str): + Regex matching branches to build. + The syntax of the regular expressions accepted + is the syntax accepted by RE2 and described at + https://github.com/google/re2/wiki/Syntax + tag_name (str): + Regex matching tags to build. + The syntax of the regular expressions accepted + is the syntax accepted by RE2 and described at + https://github.com/google/re2/wiki/Syntax + commit_sha (str): + Explicit commit SHA to build. + dir (str): + Directory, relative to the source root, in which to run the + build. + + This must be a relative path. If a step's ``dir`` is + specified and is an absolute path, this value is ignored for + that step's execution. + invert_regex (bool): + Only trigger a build if the revision regex + does NOT match the revision regex. + substitutions (Sequence[~.cloudbuild.RepoSource.SubstitutionsEntry]): + Substitutions to use in a triggered build. + Should only be used with RunBuildTrigger + """ + + project_id = proto.Field(proto.STRING, number=1) + + repo_name = proto.Field(proto.STRING, number=2) + + branch_name = proto.Field(proto.STRING, number=3, oneof="revision") + + tag_name = proto.Field(proto.STRING, number=4, oneof="revision") + + commit_sha = proto.Field(proto.STRING, number=5, oneof="revision") + + dir = proto.Field(proto.STRING, number=7) + + invert_regex = proto.Field(proto.BOOL, number=8) + + substitutions = proto.MapField(proto.STRING, proto.STRING, number=9) + + +class Source(proto.Message): + r"""Location of the source in a supported storage service. + + Attributes: + storage_source (~.cloudbuild.StorageSource): + If provided, get the source from this + location in Google Cloud Storage. + repo_source (~.cloudbuild.RepoSource): + If provided, get the source from this + location in a Cloud Source Repository. + """ + + storage_source = proto.Field( + proto.MESSAGE, number=2, oneof="source", message=StorageSource, + ) + + repo_source = proto.Field( + proto.MESSAGE, number=3, oneof="source", message=RepoSource, + ) + + +class BuiltImage(proto.Message): + r"""An image built by the pipeline. + + Attributes: + name (str): + Name used to push the container image to Google Container + Registry, as presented to ``docker push``. + digest (str): + Docker Registry 2.0 digest. + push_timing (~.cloudbuild.TimeSpan): + Output only. Stores timing information for + pushing the specified image. + """ + + name = proto.Field(proto.STRING, number=1) + + digest = proto.Field(proto.STRING, number=3) + + push_timing = proto.Field(proto.MESSAGE, number=4, message="TimeSpan",) + + +class BuildStep(proto.Message): + r"""A step in the build pipeline. + + Attributes: + name (str): + Required. The name of the container image that will run this + particular build step. + + If the image is available in the host's Docker daemon's + cache, it will be run directly. If not, the host will + attempt to pull the image first, using the builder service + account's credentials if necessary. + + The Docker daemon's cache will already have the latest + versions of all of the officially supported build steps + (https://github.com/GoogleCloudPlatform/cloud-builders). The + Docker daemon will also have cached many of the layers for + some popular images, like "ubuntu", "debian", but they will + be refreshed at the time you attempt to use them. + + If you built an image in a previous build step, it will be + stored in the host's Docker daemon's cache and is available + to use as the name for a later build step. + env (Sequence[str]): + A list of environment variable definitions to + be used when running a step. + The elements are of the form "KEY=VALUE" for the + environment variable "KEY" being given the value + "VALUE". + args (Sequence[str]): + A list of arguments that will be presented to the step when + it is started. + + If the image used to run the step's container has an + entrypoint, the ``args`` are used as arguments to that + entrypoint. If the image does not define an entrypoint, the + first element in args is used as the entrypoint, and the + remainder will be used as arguments. + dir (str): + Working directory to use when running this step's container. + + If this value is a relative path, it is relative to the + build's working directory. If this value is absolute, it may + be outside the build's working directory, in which case the + contents of the path may not be persisted across build step + executions, unless a ``volume`` for that path is specified. + + If the build specifies a ``RepoSource`` with ``dir`` and a + step with a ``dir``, which specifies an absolute path, the + ``RepoSource`` ``dir`` is ignored for the step's execution. + id (str): + Unique identifier for this build step, used in ``wait_for`` + to reference this build step as a dependency. + wait_for (Sequence[str]): + The ID(s) of the step(s) that this build step depends on. + This build step will not start until all the build steps in + ``wait_for`` have completed successfully. If ``wait_for`` is + empty, this build step will start when all previous build + steps in the ``Build.Steps`` list have completed + successfully. + entrypoint (str): + Entrypoint to be used instead of the build + step image's default entrypoint. If unset, the + image's default entrypoint is used. + secret_env (Sequence[str]): + A list of environment variables which are encrypted using a + Cloud Key Management Service crypto key. These values must + be specified in the build's ``Secret``. + volumes (Sequence[~.cloudbuild.Volume]): + List of volumes to mount into the build step. + Each volume is created as an empty volume prior + to execution of the build step. Upon completion + of the build, volumes and their contents are + discarded. + + Using a named volume in only one step is not + valid as it is indicative of a build request + with an incorrect configuration. + timing (~.cloudbuild.TimeSpan): + Output only. Stores timing information for + executing this build step. + pull_timing (~.cloudbuild.TimeSpan): + Output only. Stores timing information for + pulling this build step's builder image only. + timeout (~.duration.Duration): + Time limit for executing this build step. If + not defined, the step has no time limit and will + be allowed to continue to run until either it + completes or the build itself times out. + status (~.cloudbuild.Build.Status): + Output only. Status of the build step. At + this time, build step status is only updated on + build completion; step status is not updated in + real-time as the build progresses. + """ + + name = proto.Field(proto.STRING, number=1) + + env = proto.RepeatedField(proto.STRING, number=2) + + args = proto.RepeatedField(proto.STRING, number=3) + + dir = proto.Field(proto.STRING, number=4) + + id = proto.Field(proto.STRING, number=5) + + wait_for = proto.RepeatedField(proto.STRING, number=6) + + entrypoint = proto.Field(proto.STRING, number=7) + + secret_env = proto.RepeatedField(proto.STRING, number=8) + + volumes = proto.RepeatedField(proto.MESSAGE, number=9, message="Volume",) + + timing = proto.Field(proto.MESSAGE, number=10, message="TimeSpan",) + + pull_timing = proto.Field(proto.MESSAGE, number=13, message="TimeSpan",) + + timeout = proto.Field(proto.MESSAGE, number=11, message=duration.Duration,) + + status = proto.Field(proto.ENUM, number=12, enum="Build.Status",) + + +class Volume(proto.Message): + r"""Volume describes a Docker container volume which is mounted + into build steps in order to persist files across build step + execution. + + Attributes: + name (str): + Name of the volume to mount. + Volume names must be unique per build step and + must be valid names for Docker volumes. Each + named volume must be used by at least two build + steps. + path (str): + Path at which to mount the volume. + Paths must be absolute and cannot conflict with + other volume paths on the same build step or + with certain reserved volume paths. + """ + + name = proto.Field(proto.STRING, number=1) + + path = proto.Field(proto.STRING, number=2) + + +class Results(proto.Message): + r"""Artifacts created by the build pipeline. + + Attributes: + images (Sequence[~.cloudbuild.BuiltImage]): + Container images that were built as a part of + the build. + build_step_images (Sequence[str]): + List of build step digests, in the order + corresponding to build step indices. + artifact_manifest (str): + Path to the artifact manifest. Only populated + when artifacts are uploaded. + num_artifacts (int): + Number of artifacts uploaded. Only populated + when artifacts are uploaded. + build_step_outputs (Sequence[bytes]): + List of build step outputs, produced by builder images, in + the order corresponding to build step indices. + + `Cloud + Builders `__ + can produce this output by writing to + ``$BUILDER_OUTPUT/output``. Only the first 4KB of data is + stored. + artifact_timing (~.cloudbuild.TimeSpan): + Time to push all non-container artifacts. + """ + + images = proto.RepeatedField(proto.MESSAGE, number=2, message=BuiltImage,) + + build_step_images = proto.RepeatedField(proto.STRING, number=3) + + artifact_manifest = proto.Field(proto.STRING, number=4) + + num_artifacts = proto.Field(proto.INT64, number=5) + + build_step_outputs = proto.RepeatedField(proto.BYTES, number=6) + + artifact_timing = proto.Field(proto.MESSAGE, number=7, message="TimeSpan",) + + +class ArtifactResult(proto.Message): + r"""An artifact that was uploaded during a build. This + is a single record in the artifact manifest JSON file. + + Attributes: + location (str): + The path of an artifact in a Google Cloud Storage bucket, + with the generation number. For example, + ``gs://mybucket/path/to/output.jar#generation``. + file_hash (Sequence[~.cloudbuild.FileHashes]): + The file hash of the artifact. + """ + + location = proto.Field(proto.STRING, number=1) + + file_hash = proto.RepeatedField(proto.MESSAGE, number=2, message="FileHashes",) + + +class Build(proto.Message): + r"""A build resource in the Cloud Build API. + + At a high level, a ``Build`` describes where to find source code, + how to build it (for example, the builder image to run on the + source), and where to store the built artifacts. + + Fields can include the following variables, which will be expanded + when the build is created: + + - $PROJECT_ID: the project ID of the build. + - $BUILD_ID: the autogenerated ID of the build. + - $REPO_NAME: the source repository name specified by RepoSource. + - $BRANCH_NAME: the branch name specified by RepoSource. + - $TAG_NAME: the tag name specified by RepoSource. + - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by + RepoSource or resolved from the specified branch or tag. + - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. + + Attributes: + id (str): + Output only. Unique identifier of the build. + project_id (str): + Output only. ID of the project. + status (~.cloudbuild.Build.Status): + Output only. Status of the build. + status_detail (str): + Output only. Customer-readable message about + the current status. + source (~.cloudbuild.Source): + The location of the source files to build. + steps (Sequence[~.cloudbuild.BuildStep]): + Required. The operations to be performed on + the workspace. + results (~.cloudbuild.Results): + Output only. Results of the build. + create_time (~.timestamp.Timestamp): + Output only. Time at which the request to + create the build was received. + start_time (~.timestamp.Timestamp): + Output only. Time at which execution of the + build was started. + finish_time (~.timestamp.Timestamp): + Output only. Time at which execution of the build was + finished. + + The difference between finish_time and start_time is the + duration of the build's execution. + timeout (~.duration.Duration): + Amount of time that this build should be allowed to run, to + second granularity. If this amount of time elapses, work on + the build will cease and the build status will be + ``TIMEOUT``. + + Default time is ten minutes. + images (Sequence[str]): + A list of images to be pushed upon the successful completion + of all build steps. + + The images are pushed using the builder service account's + credentials. + + The digests of the pushed images will be stored in the + ``Build`` resource's results field. + + If any of the images fail to be pushed, the build status is + marked ``FAILURE``. + queue_ttl (~.duration.Duration): + TTL in queue for this build. If provided and the build is + enqueued longer than this value, the build will expire and + the build status will be ``EXPIRED``. + + The TTL starts ticking from create_time. + artifacts (~.cloudbuild.Artifacts): + Artifacts produced by the build that should + be uploaded upon successful completion of all + build steps. + logs_bucket (str): + Google Cloud Storage bucket where logs should be written + (see `Bucket Name + Requirements `__). + Logs file names will be of the format + ``${logs_bucket}/log-${build_id}.txt``. + source_provenance (~.cloudbuild.SourceProvenance): + Output only. A permanent fixed identifier for + source. + build_trigger_id (str): + Output only. The ID of the ``BuildTrigger`` that triggered + this build, if it was triggered automatically. + options (~.cloudbuild.BuildOptions): + Special options for this build. + log_url (str): + Output only. URL to logs for this build in + Google Cloud Console. + substitutions (Sequence[~.cloudbuild.Build.SubstitutionsEntry]): + Substitutions data for ``Build`` resource. + tags (Sequence[str]): + Tags for annotation of a ``Build``. These are not docker + tags. + secrets (Sequence[~.cloudbuild.Secret]): + Secrets to decrypt using Cloud Key Management + Service. + timing (Sequence[~.cloudbuild.Build.TimingEntry]): + Output only. Stores timing information for phases of the + build. Valid keys are: + + - BUILD: time to execute all build steps + - PUSH: time to push all specified images. + - FETCHSOURCE: time to fetch source. + + If the build does not specify source or images, these keys + will not be included. + """ + + class Status(proto.Enum): + r"""Possible status of a build or build step.""" + STATUS_UNKNOWN = 0 + QUEUED = 1 + WORKING = 2 + SUCCESS = 3 + FAILURE = 4 + INTERNAL_ERROR = 5 + TIMEOUT = 6 + CANCELLED = 7 + EXPIRED = 9 + + id = proto.Field(proto.STRING, number=1) + + project_id = proto.Field(proto.STRING, number=16) + + status = proto.Field(proto.ENUM, number=2, enum=Status,) + + status_detail = proto.Field(proto.STRING, number=24) + + source = proto.Field(proto.MESSAGE, number=3, message=Source,) + + steps = proto.RepeatedField(proto.MESSAGE, number=11, message=BuildStep,) + + results = proto.Field(proto.MESSAGE, number=10, message=Results,) + + create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp.Timestamp,) + + start_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,) + + finish_time = proto.Field(proto.MESSAGE, number=8, message=timestamp.Timestamp,) + + timeout = proto.Field(proto.MESSAGE, number=12, message=duration.Duration,) + + images = proto.RepeatedField(proto.STRING, number=13) + + queue_ttl = proto.Field(proto.MESSAGE, number=40, message=duration.Duration,) + + artifacts = proto.Field(proto.MESSAGE, number=37, message="Artifacts",) + + logs_bucket = proto.Field(proto.STRING, number=19) + + source_provenance = proto.Field( + proto.MESSAGE, number=21, message="SourceProvenance", + ) + + build_trigger_id = proto.Field(proto.STRING, number=22) + + options = proto.Field(proto.MESSAGE, number=23, message="BuildOptions",) + + log_url = proto.Field(proto.STRING, number=25) + + substitutions = proto.MapField(proto.STRING, proto.STRING, number=29) + + tags = proto.RepeatedField(proto.STRING, number=31) + + secrets = proto.RepeatedField(proto.MESSAGE, number=32, message="Secret",) + + timing = proto.MapField(proto.STRING, proto.MESSAGE, number=33, message="TimeSpan",) + + +class Artifacts(proto.Message): + r"""Artifacts produced by a build that should be uploaded upon + successful completion of all build steps. + + Attributes: + images (Sequence[str]): + A list of images to be pushed upon the + successful completion of all build steps. + + The images will be pushed using the builder + service account's credentials. + The digests of the pushed images will be stored + in the Build resource's results field. + + If any of the images fail to be pushed, the + build is marked FAILURE. + objects (~.cloudbuild.Artifacts.ArtifactObjects): + A list of objects to be uploaded to Cloud + Storage upon successful completion of all build + steps. + Files in the workspace matching specified paths + globs will be uploaded to the specified Cloud + Storage location using the builder service + account's credentials. + + The location and generation of the uploaded + objects will be stored in the Build resource's + results field. + + If any objects fail to be pushed, the build is + marked FAILURE. + """ + + class ArtifactObjects(proto.Message): + r"""Files in the workspace to upload to Cloud Storage upon + successful completion of all build steps. + + Attributes: + location (str): + Cloud Storage bucket and optional object path, in the form + "gs://bucket/path/to/somewhere/". (see `Bucket Name + Requirements `__). + + Files in the workspace matching any path pattern will be + uploaded to Cloud Storage with this location as a prefix. + paths (Sequence[str]): + Path globs used to match files in the build's + workspace. + timing (~.cloudbuild.TimeSpan): + Output only. Stores timing information for + pushing all artifact objects. + """ + + location = proto.Field(proto.STRING, number=1) + + paths = proto.RepeatedField(proto.STRING, number=2) + + timing = proto.Field(proto.MESSAGE, number=3, message="TimeSpan",) + + images = proto.RepeatedField(proto.STRING, number=1) + + objects = proto.Field(proto.MESSAGE, number=2, message=ArtifactObjects,) + + +class TimeSpan(proto.Message): + r"""Start and end times for a build execution phase. + + Attributes: + start_time (~.timestamp.Timestamp): + Start of time span. + end_time (~.timestamp.Timestamp): + End of time span. + """ + + start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) + + end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) + + +class BuildOperationMetadata(proto.Message): + r"""Metadata for build operations. + + Attributes: + build (~.cloudbuild.Build): + The build that the operation is tracking. + """ + + build = proto.Field(proto.MESSAGE, number=1, message=Build,) + + +class SourceProvenance(proto.Message): + r"""Provenance of the source. Ways to find the original source, + or verify that some source was used for this build. + + Attributes: + resolved_storage_source (~.cloudbuild.StorageSource): + A copy of the build's ``source.storage_source``, if exists, + with any generations resolved. + resolved_repo_source (~.cloudbuild.RepoSource): + A copy of the build's ``source.repo_source``, if exists, + with any revisions resolved. + file_hashes (Sequence[~.cloudbuild.SourceProvenance.FileHashesEntry]): + Output only. Hash(es) of the build source, which can be used + to verify that the original source integrity was maintained + in the build. Note that ``FileHashes`` will only be + populated if ``BuildOptions`` has requested a + ``SourceProvenanceHash``. + + The keys to this map are file paths used as build source and + the values contain the hash values for those files. + + If the build source came in a single package such as a + gzipped tarfile (``.tar.gz``), the ``FileHash`` will be for + the single path to that file. + """ + + resolved_storage_source = proto.Field( + proto.MESSAGE, number=3, message=StorageSource, + ) + + resolved_repo_source = proto.Field(proto.MESSAGE, number=6, message=RepoSource,) + + file_hashes = proto.MapField( + proto.STRING, proto.MESSAGE, number=4, message="FileHashes", + ) + + +class FileHashes(proto.Message): + r"""Container message for hashes of byte content of files, used + in SourceProvenance messages to verify integrity of source input + to the build. + + Attributes: + file_hash (Sequence[~.cloudbuild.Hash]): + Collection of file hashes. + """ + + file_hash = proto.RepeatedField(proto.MESSAGE, number=1, message="Hash",) + + +class Hash(proto.Message): + r"""Container message for hash values. + + Attributes: + type (~.cloudbuild.Hash.HashType): + The type of hash that was performed. + value (bytes): + The hash value. + """ + + class HashType(proto.Enum): + r"""Specifies the hash algorithm, if any.""" + NONE = 0 + SHA256 = 1 + MD5 = 2 + + type = proto.Field(proto.ENUM, number=1, enum=HashType,) + + value = proto.Field(proto.BYTES, number=2) + + +class Secret(proto.Message): + r"""Pairs a set of secret environment variables containing + encrypted values with the Cloud KMS key to use to decrypt the + value. + + Attributes: + kms_key_name (str): + Cloud KMS key name to use to decrypt these + envs. + secret_env (Sequence[~.cloudbuild.Secret.SecretEnvEntry]): + Map of environment variable name to its + encrypted value. + Secret environment variables must be unique + across all of a build's secrets, and must be + used by at least one build step. Values can be + at most 64 KB in size. There can be at most 100 + secret values across all of a build's secrets. + """ + + kms_key_name = proto.Field(proto.STRING, number=1) + + secret_env = proto.MapField(proto.STRING, proto.BYTES, number=3) + + +class CreateBuildRequest(proto.Message): + r"""Request to create a new build. + + Attributes: + project_id (str): + Required. ID of the project. + build (~.cloudbuild.Build): + Required. Build resource to create. + """ + + project_id = proto.Field(proto.STRING, number=1) + + build = proto.Field(proto.MESSAGE, number=2, message=Build,) + + +class GetBuildRequest(proto.Message): + r"""Request to get a build. + + Attributes: + project_id (str): + Required. ID of the project. + id (str): + Required. ID of the build. + """ + + project_id = proto.Field(proto.STRING, number=1) + + id = proto.Field(proto.STRING, number=2) + + +class ListBuildsRequest(proto.Message): + r"""Request to list builds. + + Attributes: + project_id (str): + Required. ID of the project. + page_size (int): + Number of results to return in the list. + page_token (str): + Token to provide to skip to a particular spot + in the list. + filter (str): + The raw filter text to constrain the results. + """ + + project_id = 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=8) + + +class ListBuildsResponse(proto.Message): + r"""Response including listed builds. + + Attributes: + builds (Sequence[~.cloudbuild.Build]): + Builds will be sorted by ``create_time``, descending. + next_page_token (str): + Token to receive the next page of results. + """ + + @property + def raw_page(self): + return self + + builds = proto.RepeatedField(proto.MESSAGE, number=1, message=Build,) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class CancelBuildRequest(proto.Message): + r"""Request to cancel an ongoing build. + + Attributes: + project_id (str): + Required. ID of the project. + id (str): + Required. ID of the build. + """ + + project_id = proto.Field(proto.STRING, number=1) + + id = proto.Field(proto.STRING, number=2) + + +class BuildTrigger(proto.Message): + r"""Configuration for an automated build in response to source + repository changes. + + Attributes: + id (str): + Output only. Unique identifier of the + trigger. + description (str): + Human-readable description of this trigger. + name (str): + User-assigned name of the trigger. Must be + unique within the project. Trigger names must + meet the following requirements: + + They must contain only alphanumeric characters + and dashes. + They can be 1-64 characters long. + + They must begin and end with an alphanumeric + character. + tags (Sequence[str]): + Tags for annotation of a ``BuildTrigger`` + trigger_template (~.cloudbuild.RepoSource): + Template describing the types of source changes to trigger a + build. + + Branch and tag names in trigger templates are interpreted as + regular expressions. Any branch or tag change that matches + that regular expression will trigger a build. + + Mutually exclusive with ``github``. + github (~.cloudbuild.GitHubEventsConfig): + GitHubEventsConfig describes the configuration of a trigger + that creates a build whenever a GitHub event is received. + + Mutually exclusive with ``trigger_template``. + build (~.cloudbuild.Build): + Contents of the build template. + filename (str): + Path, from the source root, to a file whose + contents is used for the template. + create_time (~.timestamp.Timestamp): + Output only. Time when the trigger was + created. + disabled (bool): + If true, the trigger will never result in a + build. + substitutions (Sequence[~.cloudbuild.BuildTrigger.SubstitutionsEntry]): + Substitutions for Build resource. The keys must match the + following regular expression: ``^_[A-Z0-9_]+$``.The keys + cannot conflict with the keys in bindings. + ignored_files (Sequence[str]): + ignored_files and included_files are file glob matches using + https://golang.org/pkg/path/filepath/#Match extended with + support for "**". + + If ignored_files and changed files are both empty, then they + are not used to determine whether or not to trigger a build. + + If ignored_files is not empty, then we ignore any files that + match any of the ignored_file globs. If the change has no + files that are outside of the ignored_files globs, then we + do not trigger a build. + included_files (Sequence[str]): + If any of the files altered in the commit pass the + ignored_files filter and included_files is empty, then as + far as this filter is concerned, we should trigger the + build. + + If any of the files altered in the commit pass the + ignored_files filter and included_files is not empty, then + we make sure that at least one of those files matches a + included_files glob. If not, then we do not trigger a build. + """ + + id = proto.Field(proto.STRING, number=1) + + description = proto.Field(proto.STRING, number=10) + + name = proto.Field(proto.STRING, number=21) + + tags = proto.RepeatedField(proto.STRING, number=19) + + trigger_template = proto.Field(proto.MESSAGE, number=7, message=RepoSource,) + + github = proto.Field(proto.MESSAGE, number=13, message="GitHubEventsConfig",) + + build = proto.Field(proto.MESSAGE, number=4, oneof="build_template", message=Build,) + + filename = proto.Field(proto.STRING, number=8, oneof="build_template") + + create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp.Timestamp,) + + disabled = proto.Field(proto.BOOL, number=9) + + substitutions = proto.MapField(proto.STRING, proto.STRING, number=11) + + ignored_files = proto.RepeatedField(proto.STRING, number=15) + + included_files = proto.RepeatedField(proto.STRING, number=16) + + +class GitHubEventsConfig(proto.Message): + r"""GitHubEventsConfig describes the configuration of a trigger + that creates a build whenever a GitHub event is received. + This message is experimental. + + Attributes: + installation_id (int): + The installationID that emits the GitHub + event. + owner (str): + Owner of the repository. For example: The + owner for + https://github.com/googlecloudplatform/cloud- + builders is "googlecloudplatform". + name (str): + Name of the repository. For example: The name + for + https://github.com/googlecloudplatform/cloud- + builders is "cloud-builders". + pull_request (~.cloudbuild.PullRequestFilter): + filter to match changes in pull requests. + push (~.cloudbuild.PushFilter): + filter to match changes in refs like + branches, tags. + """ + + installation_id = proto.Field(proto.INT64, number=1) + + owner = proto.Field(proto.STRING, number=6) + + name = proto.Field(proto.STRING, number=7) + + pull_request = proto.Field( + proto.MESSAGE, number=4, oneof="event", message="PullRequestFilter", + ) + + push = proto.Field(proto.MESSAGE, number=5, oneof="event", message="PushFilter",) + + +class PullRequestFilter(proto.Message): + r"""PullRequestFilter contains filter properties for matching + GitHub Pull Requests. + + Attributes: + branch (str): + Regex of branches to match. + The syntax of the regular expressions accepted + is the syntax accepted by RE2 and described at + https://github.com/google/re2/wiki/Syntax + comment_control (~.cloudbuild.PullRequestFilter.CommentControl): + Whether to block builds on a "/gcbrun" + comment from a repository admin or collaborator. + invert_regex (bool): + If true, branches that do NOT match the git_ref will trigger + a build. + """ + + class CommentControl(proto.Enum): + r"""Controls behavior of Pull Request comments.""" + COMMENTS_DISABLED = 0 + COMMENTS_ENABLED = 1 + + branch = proto.Field(proto.STRING, number=2, oneof="git_ref") + + comment_control = proto.Field(proto.ENUM, number=5, enum=CommentControl,) + + invert_regex = proto.Field(proto.BOOL, number=6) + + +class PushFilter(proto.Message): + r"""Push contains filter properties for matching GitHub git + pushes. + + Attributes: + branch (str): + Regexes matching branches to build. + The syntax of the regular expressions accepted + is the syntax accepted by RE2 and described at + https://github.com/google/re2/wiki/Syntax + tag (str): + Regexes matching tags to build. + The syntax of the regular expressions accepted + is the syntax accepted by RE2 and described at + https://github.com/google/re2/wiki/Syntax + invert_regex (bool): + When true, only trigger a build if the revision regex does + NOT match the git_ref regex. + """ + + branch = proto.Field(proto.STRING, number=2, oneof="git_ref") + + tag = proto.Field(proto.STRING, number=3, oneof="git_ref") + + invert_regex = proto.Field(proto.BOOL, number=4) + + +class CreateBuildTriggerRequest(proto.Message): + r"""Request to create a new ``BuildTrigger``. + + Attributes: + project_id (str): + Required. ID of the project for which to + configure automatic builds. + trigger (~.cloudbuild.BuildTrigger): + Required. ``BuildTrigger`` to create. + """ + + project_id = proto.Field(proto.STRING, number=1) + + trigger = proto.Field(proto.MESSAGE, number=2, message=BuildTrigger,) + + +class GetBuildTriggerRequest(proto.Message): + r"""Returns the ``BuildTrigger`` with the specified ID. + + Attributes: + project_id (str): + Required. ID of the project that owns the + trigger. + trigger_id (str): + Required. Identifier (``id`` or ``name``) of the + ``BuildTrigger`` to get. + """ + + project_id = proto.Field(proto.STRING, number=1) + + trigger_id = proto.Field(proto.STRING, number=2) + + +class ListBuildTriggersRequest(proto.Message): + r"""Request to list existing ``BuildTriggers``. + + Attributes: + project_id (str): + Required. ID of the project for which to list + BuildTriggers. + page_size (int): + Number of results to return in the list. + page_token (str): + Token to provide to skip to a particular spot + in the list. + """ + + project_id = proto.Field(proto.STRING, number=1) + + page_size = proto.Field(proto.INT32, number=2) + + page_token = proto.Field(proto.STRING, number=3) + + +class ListBuildTriggersResponse(proto.Message): + r"""Response containing existing ``BuildTriggers``. + + Attributes: + triggers (Sequence[~.cloudbuild.BuildTrigger]): + ``BuildTriggers`` for the project, sorted by ``create_time`` + descending. + next_page_token (str): + Token to receive the next page of results. + """ + + @property + def raw_page(self): + return self + + triggers = proto.RepeatedField(proto.MESSAGE, number=1, message=BuildTrigger,) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class DeleteBuildTriggerRequest(proto.Message): + r"""Request to delete a ``BuildTrigger``. + + Attributes: + project_id (str): + Required. ID of the project that owns the + trigger. + trigger_id (str): + Required. ID of the ``BuildTrigger`` to delete. + """ + + project_id = proto.Field(proto.STRING, number=1) + + trigger_id = proto.Field(proto.STRING, number=2) + + +class UpdateBuildTriggerRequest(proto.Message): + r"""Request to update an existing ``BuildTrigger``. + + Attributes: + project_id (str): + Required. ID of the project that owns the + trigger. + trigger_id (str): + Required. ID of the ``BuildTrigger`` to update. + trigger (~.cloudbuild.BuildTrigger): + Required. ``BuildTrigger`` to update. + """ + + project_id = proto.Field(proto.STRING, number=1) + + trigger_id = proto.Field(proto.STRING, number=2) + + trigger = proto.Field(proto.MESSAGE, number=3, message=BuildTrigger,) + + +class BuildOptions(proto.Message): + r"""Optional arguments to enable specific features of builds. + + Attributes: + source_provenance_hash (Sequence[~.cloudbuild.Hash.HashType]): + Requested hash for SourceProvenance. + requested_verify_option (~.cloudbuild.BuildOptions.VerifyOption): + Requested verifiability options. + machine_type (~.cloudbuild.BuildOptions.MachineType): + Compute Engine machine type on which to run + the build. + disk_size_gb (int): + Requested disk size for the VM that runs the build. Note + that this is *NOT* "disk free"; some of the space will be + used by the operating system and build utilities. Also note + that this is the minimum disk size that will be allocated + for the build -- the build may run with a larger disk than + requested. At present, the maximum disk size is 1000GB; + builds that request more than the maximum are rejected with + an error. + substitution_option (~.cloudbuild.BuildOptions.SubstitutionOption): + Option to specify behavior when there is an + error in the substitution checks. + log_streaming_option (~.cloudbuild.BuildOptions.LogStreamingOption): + Option to define build log streaming behavior + to Google Cloud Storage. + worker_pool (str): + Option to specify a ``WorkerPool`` for the build. Format: + projects/{project}/workerPools/{workerPool} + + This field is experimental. + logging (~.cloudbuild.BuildOptions.LoggingMode): + Option to specify the logging mode, which + determines where the logs are stored. + env (Sequence[str]): + A list of global environment variable + definitions that will exist for all build steps + in this build. If a variable is defined in both + globally and in a build step, the variable will + use the build step value. + The elements are of the form "KEY=VALUE" for the + environment variable "KEY" being given the value + "VALUE". + secret_env (Sequence[str]): + A list of global environment variables, which are encrypted + using a Cloud Key Management Service crypto key. These + values must be specified in the build's ``Secret``. These + variables will be available to all build steps in this + build. + volumes (Sequence[~.cloudbuild.Volume]): + Global list of volumes to mount for ALL build + steps + Each volume is created as an empty volume prior + to starting the build process. Upon completion + of the build, volumes and their contents are + discarded. Global volume names and paths cannot + conflict with the volumes defined a build step. + + Using a global volume in a build with only one + step is not valid as it is indicative of a build + request with an incorrect configuration. + """ + + class VerifyOption(proto.Enum): + r"""Specifies the manner in which the build should be verified, + if at all. + """ + NOT_VERIFIED = 0 + VERIFIED = 1 + + class MachineType(proto.Enum): + r"""Supported VM sizes.""" + UNSPECIFIED = 0 + N1_HIGHCPU_8 = 1 + N1_HIGHCPU_32 = 2 + + class SubstitutionOption(proto.Enum): + r"""Specifies the behavior when there is an error in the + substitution checks. + """ + MUST_MATCH = 0 + ALLOW_LOOSE = 1 + + class LogStreamingOption(proto.Enum): + r"""Specifies the behavior when writing build logs to Google + Cloud Storage. + """ + STREAM_DEFAULT = 0 + STREAM_ON = 1 + STREAM_OFF = 2 + + class LoggingMode(proto.Enum): + r"""Specifies the logging mode.""" + LOGGING_UNSPECIFIED = 0 + LEGACY = 1 + GCS_ONLY = 2 + + source_provenance_hash = proto.RepeatedField( + proto.ENUM, number=1, enum=Hash.HashType, + ) + + requested_verify_option = proto.Field(proto.ENUM, number=2, enum=VerifyOption,) + + machine_type = proto.Field(proto.ENUM, number=3, enum=MachineType,) + + disk_size_gb = proto.Field(proto.INT64, number=6) + + substitution_option = proto.Field(proto.ENUM, number=4, enum=SubstitutionOption,) + + log_streaming_option = proto.Field(proto.ENUM, number=5, enum=LogStreamingOption,) + + worker_pool = proto.Field(proto.STRING, number=7) + + logging = proto.Field(proto.ENUM, number=11, enum=LoggingMode,) + + env = proto.RepeatedField(proto.STRING, number=12) + + secret_env = proto.RepeatedField(proto.STRING, number=13) + + volumes = proto.RepeatedField(proto.MESSAGE, number=14, message=Volume,) + + +class WorkerPool(proto.Message): + r"""Configuration for a WorkerPool to run the builds. + Workers are machines that Cloud Build uses to run your builds. + By default, all workers run in a project owned by Cloud Build. + To have full control over the workers that execute your builds + -- such as enabling them to access private resources on your + private network -- you can request Cloud Build to run the + workers in your own project by creating a custom workers pool. + + Attributes: + name (str): + User-defined name of the ``WorkerPool``. + project_id (str): + The project ID of the GCP project for which the + ``WorkerPool`` is created. + service_account_email (str): + Output only. The service account used to manage the + ``WorkerPool``. The service account must have the Compute + Instance Admin (Beta) permission at the project level. + worker_count (int): + Total number of workers to be created across + all requested regions. + worker_config (~.cloudbuild.WorkerConfig): + Configuration to be used for a creating workers in the + ``WorkerPool``. + regions (Sequence[~.cloudbuild.WorkerPool.Region]): + List of regions to create the ``WorkerPool``. Regions can't + be empty. If Cloud Build adds a new GCP region in the + future, the existing ``WorkerPool`` will not be enabled in + the new region automatically; you must add the new region to + the ``regions`` field to enable the ``WorkerPool`` in that + region. + create_time (~.timestamp.Timestamp): + Output only. Time at which the request to create the + ``WorkerPool`` was received. + update_time (~.timestamp.Timestamp): + Output only. Time at which the request to update the + ``WorkerPool`` was received. + delete_time (~.timestamp.Timestamp): + Output only. Time at which the request to delete the + ``WorkerPool`` was received. + status (~.cloudbuild.WorkerPool.Status): + Output only. WorkerPool Status. + """ + + class Region(proto.Enum): + r"""Supported GCP regions to create the ``WorkerPool``.""" + REGION_UNSPECIFIED = 0 + US_CENTRAL1 = 1 + US_WEST1 = 2 + US_EAST1 = 3 + US_EAST4 = 4 + + class Status(proto.Enum): + r"""``WorkerPool`` status""" + STATUS_UNSPECIFIED = 0 + CREATING = 1 + RUNNING = 2 + DELETING = 3 + DELETED = 4 + + name = proto.Field(proto.STRING, number=14) + + project_id = proto.Field(proto.STRING, number=2) + + service_account_email = proto.Field(proto.STRING, number=3) + + worker_count = proto.Field(proto.INT64, number=4) + + worker_config = proto.Field(proto.MESSAGE, number=16, message="WorkerConfig",) + + regions = proto.RepeatedField(proto.ENUM, number=9, enum=Region,) + + create_time = proto.Field(proto.MESSAGE, number=11, message=timestamp.Timestamp,) + + update_time = proto.Field(proto.MESSAGE, number=17, message=timestamp.Timestamp,) + + delete_time = proto.Field(proto.MESSAGE, number=12, message=timestamp.Timestamp,) + + status = proto.Field(proto.ENUM, number=13, enum=Status,) + + +class WorkerConfig(proto.Message): + r"""WorkerConfig defines the configuration to be used for a + creating workers in the pool. + + Attributes: + machine_type (str): + Machine Type of the worker, such as n1-standard-1. See + https://cloud.google.com/compute/docs/machine-types. If left + blank, Cloud Build will use a standard unspecified machine + to create the worker pool. ``machine_type`` is overridden if + you specify a different machine type in ``build_options``. + In this case, the VM specified in the ``build_options`` will + be created on demand at build time. For more information see + https://cloud.google.com/cloud-build/docs/speeding-up-builds#using_custom_virtual_machine_sizes + disk_size_gb (int): + Size of the disk attached to the worker, in GB. See + https://cloud.google.com/compute/docs/disks/ If ``0`` is + specified, Cloud Build will use a standard disk size. + ``disk_size`` is overridden if you specify a different disk + size in ``build_options``. In this case, a VM with a disk + size specified in the ``build_options`` will be created on + demand at build time. For more information see + https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions + network (~.cloudbuild.Network): + The network definition used to create the worker. If this + section is left empty, the workers will be created in + WorkerPool.project_id on the default network. + tag (str): + The tag applied to the worker, and the same tag used by the + firewall rule. It is used to identify the Cloud Build + workers among other VMs. The default value for tag is + ``worker``. + """ + + machine_type = proto.Field(proto.STRING, number=1) + + disk_size_gb = proto.Field(proto.INT64, number=2) + + network = proto.Field(proto.MESSAGE, number=3, message="Network",) + + tag = proto.Field(proto.STRING, number=4) + + +class Network(proto.Message): + r"""Network describes the GCP network used to create workers in. + + Attributes: + project_id (str): + Project id containing the defined network and subnetwork. + For a peered VPC, this will be the same as the project_id in + which the workers are created. For a shared VPC, this will + be the project sharing the network with the project_id + project in which workers will be created. For custom workers + with no VPC, this will be the same as project_id. + network (str): + Network on which the workers are created. + "default" network is used if empty. + subnetwork (str): + Subnetwork on which the workers are created. + "default" subnetwork is used if empty. + """ + + project_id = proto.Field(proto.STRING, number=1) + + network = proto.Field(proto.STRING, number=2) + + subnetwork = proto.Field(proto.STRING, number=3) + + +class CreateWorkerPoolRequest(proto.Message): + r"""Request to create a new ``WorkerPool``. + + Attributes: + parent (str): + ID of the parent project. + worker_pool (~.cloudbuild.WorkerPool): + ``WorkerPool`` resource to create. + """ + + parent = proto.Field(proto.STRING, number=1) + + worker_pool = proto.Field(proto.MESSAGE, number=2, message=WorkerPool,) + + +class GetWorkerPoolRequest(proto.Message): + r"""Request to get a ``WorkerPool`` with the specified name. + + Attributes: + name (str): + The field will contain name of the resource + requested, for example: + "projects/project-1/workerPools/workerpool-name". + """ + + name = proto.Field(proto.STRING, number=1) + + +class DeleteWorkerPoolRequest(proto.Message): + r"""Request to delete a ``WorkerPool``. + + Attributes: + name (str): + The field will contain name of the resource + requested, for example: + "projects/project-1/workerPools/workerpool-name". + """ + + name = proto.Field(proto.STRING, number=1) + + +class UpdateWorkerPoolRequest(proto.Message): + r"""Request to update a ``WorkerPool``. + + Attributes: + name (str): + The field will contain name of the resource + requested, for example: + "projects/project-1/workerPools/workerpool-name". + worker_pool (~.cloudbuild.WorkerPool): + ``WorkerPool`` resource to update. + """ + + name = proto.Field(proto.STRING, number=2) + + worker_pool = proto.Field(proto.MESSAGE, number=3, message=WorkerPool,) + + +class ListWorkerPoolsRequest(proto.Message): + r"""Request to list ``WorkerPools``. + + Attributes: + parent (str): + ID of the parent project. + """ + + parent = proto.Field(proto.STRING, number=1) + + +class ListWorkerPoolsResponse(proto.Message): + r"""Response containing existing ``WorkerPools``. + + Attributes: + worker_pools (Sequence[~.cloudbuild.WorkerPool]): + ``WorkerPools`` for the project. + """ + + worker_pools = proto.RepeatedField(proto.MESSAGE, number=1, message=WorkerPool,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 348438e0..da184cbd 100644 --- a/noxfile.py +++ b/noxfile.py @@ -27,8 +27,8 @@ BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.8"] -UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8"] +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8"] @nox.session(python=DEFAULT_PYTHON_VERSION) @@ -70,6 +70,8 @@ def lint_setup_py(session): def default(session): # Install all test dependencies, then install this package in-place. + session.install("asyncmock", "pytest-asyncio") + session.install("mock", "pytest", "pytest-cov") session.install("-e", ".") @@ -77,7 +79,7 @@ def default(session): session.run( "py.test", "--quiet", - "--cov=google.cloud.cloudbuild", + "--cov=google.cloud.devtools.cloudbuild", "--cov=google.cloud", "--cov=tests.unit", "--cov-append", @@ -135,7 +137,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=65") + session.run("coverage", "report", "--show-missing", "--fail-under=99") session.run("coverage", "erase") diff --git a/samples/AUTHORING_GUIDE.md b/samples/AUTHORING_GUIDE.md new file mode 100644 index 00000000..55c97b32 --- /dev/null +++ b/samples/AUTHORING_GUIDE.md @@ -0,0 +1 @@ +See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md \ No newline at end of file diff --git a/samples/CONTRIBUTING.md b/samples/CONTRIBUTING.md new file mode 100644 index 00000000..34c882b6 --- /dev/null +++ b/samples/CONTRIBUTING.md @@ -0,0 +1 @@ +See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/CONTRIBUTING.md \ No newline at end of file diff --git a/scripts/fixup_cloudbuild_v1_keywords.py b/scripts/fixup_cloudbuild_v1_keywords.py new file mode 100644 index 00000000..92e726f3 --- /dev/null +++ b/scripts/fixup_cloudbuild_v1_keywords.py @@ -0,0 +1,192 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +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 cloudbuildCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'cancel_build': ('project_id', 'id', ), + 'create_build': ('project_id', 'build', ), + 'create_build_trigger': ('project_id', 'trigger', ), + 'create_worker_pool': ('parent', 'worker_pool', ), + 'delete_build_trigger': ('project_id', 'trigger_id', ), + 'delete_worker_pool': ('name', ), + 'get_build': ('project_id', 'id', ), + 'get_build_trigger': ('project_id', 'trigger_id', ), + 'get_worker_pool': ('name', ), + 'list_builds': ('project_id', 'page_size', 'page_token', 'filter', ), + 'list_build_triggers': ('project_id', 'page_size', 'page_token', ), + 'list_worker_pools': ('parent', ), + 'retry_build': ('project_id', 'id', ), + 'run_build_trigger': ('project_id', 'trigger_id', 'source', ), + 'update_build_trigger': ('project_id', 'trigger_id', 'trigger', ), + 'update_worker_pool': ('name', 'worker_pool', ), + } + + 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: not a.keyword.value 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=cloudbuildCallTransformer(), +): + """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 cloudbuild 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/setup.py b/setup.py index a28c17fc..3ff81feb 100644 --- a/setup.py +++ b/setup.py @@ -28,8 +28,9 @@ # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.14.0, < 2.0.0dev", - 'enum34; python_version < "3.4"', + "google-api-core[grpc] >= 1.22.0, < 2.0.0dev", + "proto-plus >= 0.4.0", + "libcst >= 0.2.5", ] package_root = os.path.abspath(os.path.dirname(__file__)) @@ -39,7 +40,9 @@ readme = readme_file.read() packages = [ - package for package in setuptools.find_packages() if package.startswith("google") + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") ] namespaces = ["google"] @@ -63,18 +66,18 @@ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Operating System :: OS Independent", "Topic :: Internet", ], platforms="Posix; MacOS X; Windows", packages=packages, + python_requires=">=3.6", namespace_packages=namespaces, + scripts=["scripts/fixup_cloudbuild_v1_keywords.py"], install_requires=dependencies, include_package_data=True, zip_safe=False, diff --git a/synth.metadata b/synth.metadata index 29a4b9b1..0e3a4407 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,22 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-cloudbuild.git", - "sha": "d30aba73e7026089d4e3f9b51ce71d262698d510" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "cf41866c6f14f10a07aa1e2a1260fc0a2727d889", - "internalRef": "317812187" + "sha": "d75e9f590378c67c52ab052cc6122301922a0560" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "303271797a360f8a439203413f13a160f2f5b3b4" + "sha": "f221423c5c9d28a199c052eb4962afac4b749ea3" } } ], diff --git a/synth.py b/synth.py index 7c1e4616..d69dd421 100644 --- a/synth.py +++ b/synth.py @@ -29,19 +29,38 @@ version=version, bazel_target=f"//google/devtools/cloudbuild/{version}:devtools-cloudbuild-{version}-py", include_protos=True, - proto_output_path=f"google/cloud/devtools/cloudbuild_{version}/proto", + proto_output_path=f"google/devtools/cloudbuild_{version}/proto", ) +s.move(library / "google/devtools/cloudbuild", "google/cloud/devtools/cloudbuild") s.move( - library, - excludes=[ - 'docs/index.rst', - 'nox*.py', - 'setup.py', - 'setup.cfg', - 'README.rst', - 'google/cloud/devtools/__init__.py', # declare this as a namespace package - ], + library / f"google/devtools/cloudbuild_{version}", + f"google/cloud/devtools/cloudbuild_{version}" +) +s.move(library / "tests") +s.move(library / "scripts") +s.move(library / "docs", excludes=[library / "docs/index.rst"]) + +# Fix namespace +s.replace( + f"google/cloud/**/*.py", + f"google.devtools.cloudbuild_{version}", + f"google.cloud.devtools.cloudbuild_{version}", +) +s.replace( + f"tests/unit/gapic/**/*.py", + f"google.devtools.cloudbuild_{version}", + f"google.cloud.devtools.cloudbuild_{version}", +) +s.replace( + f"google/cloud/**/*.py", + f"google.devtools.cloudbuild_{version}", + f"google.cloud.devtools.cloudbuild_{version}", +) +s.replace( + f"docs/**/*.rst", + f"google.devtools.cloudbuild_{version}", + f"google.cloud.devtools.cloudbuild_{version}", ) # Rename package to `google-cloud-build` @@ -54,13 +73,21 @@ # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- - -# coverage level is low because of missing coverage for __init__.py files -templated_files = common.py_library(unit_cov_level=65, cov_level=65) -s.move(templated_files) +templated_files = common.py_library( + samples=False, # set to True only if there are samples + microgenerator=True, + cov_level=99, +) +s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file # TODO(busunkim): Use latest sphinx after microgenerator transition s.replace("noxfile.py", """['"]sphinx['"]""", '"sphinx<3.0.0"') +s.replace( + "noxfile.py", + "google.cloud.cloudbuild", + "google.cloud.devtools.cloudbuild", +) + -s.shell.run(["nox", "-s", "blacken"], hide_output=False) \ No newline at end of file +s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/google/cloud/devtools/cloudbuild_v1/gapic/__init__.py b/tests/unit/gapic/cloudbuild_v1/__init__.py similarity index 100% rename from google/cloud/devtools/cloudbuild_v1/gapic/__init__.py rename to tests/unit/gapic/cloudbuild_v1/__init__.py diff --git a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py new file mode 100644 index 00000000..fff9e16f --- /dev/null +++ b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py @@ -0,0 +1,3137 @@ +# -*- coding: utf-8 -*- + +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os +import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from google import auth +from google.api_core import client_options +from google.api_core import exceptions +from google.api_core import future +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import operation_async +from google.api_core import operations_v1 +from google.auth import credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.devtools.cloudbuild_v1.services.cloud_build import ( + CloudBuildAsyncClient, +) +from google.cloud.devtools.cloudbuild_v1.services.cloud_build import CloudBuildClient +from google.cloud.devtools.cloudbuild_v1.services.cloud_build import pagers +from google.cloud.devtools.cloudbuild_v1.services.cloud_build import transports +from google.cloud.devtools.cloudbuild_v1.types import cloudbuild +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +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 CloudBuildClient._get_default_mtls_endpoint(None) is None + assert ( + CloudBuildClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + ) + assert ( + CloudBuildClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + CloudBuildClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + CloudBuildClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert CloudBuildClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class", [CloudBuildClient, CloudBuildAsyncClient]) +def test_cloud_build_client_from_service_account_file(client_class): + creds = 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") + assert client._transport._credentials == creds + + client = client_class.from_service_account_json("dummy/file/path.json") + assert client._transport._credentials == creds + + assert client._transport._host == "cloudbuild.googleapis.com:443" + + +def test_cloud_build_client_get_transport_class(): + transport = CloudBuildClient.get_transport_class() + assert transport == transports.CloudBuildGrpcTransport + + transport = CloudBuildClient.get_transport_class("grpc") + assert transport == transports.CloudBuildGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CloudBuildClient, transports.CloudBuildGrpcTransport, "grpc"), + ( + CloudBuildAsyncClient, + transports.CloudBuildGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_cloud_build_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(CloudBuildClient, "get_transport_class") as gtc: + transport = transport_class(credentials=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(CloudBuildClient, "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(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "never". + os.environ["GOOGLE_API_USE_MTLS"] = "never" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "always". + os.environ["GOOGLE_API_USE_MTLS"] = "always" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and client_cert_source is provided. + os.environ["GOOGLE_API_USE_MTLS"] = "auto" + 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) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=client_cert_source_callback, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and default_client_cert_source is provided. + os.environ["GOOGLE_API_USE_MTLS"] = "auto" + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", but client_cert_source and default_client_cert_source are None. + os.environ["GOOGLE_API_USE_MTLS"] = "auto" + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has + # unsupported value. + os.environ["GOOGLE_API_USE_MTLS"] = "Unsupported" + with pytest.raises(MutualTLSChannelError): + client = client_class() + + del os.environ["GOOGLE_API_USE_MTLS"] + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CloudBuildClient, transports.CloudBuildGrpcTransport, "grpc"), + ( + CloudBuildAsyncClient, + transports.CloudBuildGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_cloud_build_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) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CloudBuildClient, transports.CloudBuildGrpcTransport, "grpc"), + ( + CloudBuildAsyncClient, + transports.CloudBuildGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_cloud_build_client_client_options_credentials_file( + client_class, transport_class, transport_name +): + # 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) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + ) + + +def test_cloud_build_client_client_options_from_dict(): + with mock.patch( + "google.cloud.devtools.cloudbuild_v1.services.cloud_build.transports.CloudBuildGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = CloudBuildClient(client_options={"api_endpoint": "squid.clam.whelk"}) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + ) + + +def test_create_build(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.CreateBuildRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_build), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + + response = client.create_build(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, future.Future) + + +@pytest.mark.asyncio +async def test_create_build_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.CreateBuildRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_build), "__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_build(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, future.Future) + + +def test_create_build_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_build), "__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_build( + project_id="project_id_value", build=cloudbuild.Build(id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].build == cloudbuild.Build(id="id_value") + + +def test_create_build_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_build( + cloudbuild.CreateBuildRequest(), + project_id="project_id_value", + build=cloudbuild.Build(id="id_value"), + ) + + +@pytest.mark.asyncio +async def test_create_build_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_build), "__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_build( + project_id="project_id_value", build=cloudbuild.Build(id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].build == cloudbuild.Build(id="id_value") + + +@pytest.mark.asyncio +async def test_create_build_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_build( + cloudbuild.CreateBuildRequest(), + project_id="project_id_value", + build=cloudbuild.Build(id="id_value"), + ) + + +def test_get_build(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.GetBuildRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_build), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.Build( + id="id_value", + project_id="project_id_value", + status=cloudbuild.Build.Status.QUEUED, + status_detail="status_detail_value", + images=["images_value"], + logs_bucket="logs_bucket_value", + build_trigger_id="build_trigger_id_value", + log_url="iframe.php?url=https%3A%2F%2Fgithub.com%2Flog_url_value", + tags=["tags_value"], + ) + + response = client.get_build(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, cloudbuild.Build) + + assert response.id == "id_value" + + assert response.project_id == "project_id_value" + + assert response.status == cloudbuild.Build.Status.QUEUED + + assert response.status_detail == "status_detail_value" + + assert response.images == ["images_value"] + + assert response.logs_bucket == "logs_bucket_value" + + assert response.build_trigger_id == "build_trigger_id_value" + + assert response.log_url == "log_url_value" + + assert response.tags == ["tags_value"] + + +@pytest.mark.asyncio +async def test_get_build_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.GetBuildRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_build), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.Build( + id="id_value", + project_id="project_id_value", + status=cloudbuild.Build.Status.QUEUED, + status_detail="status_detail_value", + images=["images_value"], + logs_bucket="logs_bucket_value", + build_trigger_id="build_trigger_id_value", + log_url="iframe.php?url=https%3A%2F%2Fgithub.com%2Flog_url_value", + tags=["tags_value"], + ) + ) + + response = await client.get_build(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, cloudbuild.Build) + + assert response.id == "id_value" + + assert response.project_id == "project_id_value" + + assert response.status == cloudbuild.Build.Status.QUEUED + + assert response.status_detail == "status_detail_value" + + assert response.images == ["images_value"] + + assert response.logs_bucket == "logs_bucket_value" + + assert response.build_trigger_id == "build_trigger_id_value" + + assert response.log_url == "log_url_value" + + assert response.tags == ["tags_value"] + + +def test_get_build_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_build), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.Build() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_build( + project_id="project_id_value", id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].id == "id_value" + + +def test_get_build_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_build( + cloudbuild.GetBuildRequest(), project_id="project_id_value", id="id_value", + ) + + +@pytest.mark.asyncio +async def test_get_build_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_build), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.Build() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloudbuild.Build()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_build(project_id="project_id_value", id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].id == "id_value" + + +@pytest.mark.asyncio +async def test_get_build_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_build( + cloudbuild.GetBuildRequest(), project_id="project_id_value", id="id_value", + ) + + +def test_list_builds(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.ListBuildsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_builds), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.ListBuildsResponse( + next_page_token="next_page_token_value", + ) + + response = client.list_builds(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, pagers.ListBuildsPager) + + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_builds_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.ListBuildsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_builds), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.ListBuildsResponse(next_page_token="next_page_token_value",) + ) + + response = await client.list_builds(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, pagers.ListBuildsAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_builds_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_builds), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.ListBuildsResponse() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_builds( + project_id="project_id_value", filter="filter_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] + + assert args[0].project_id == "project_id_value" + + assert args[0].filter == "filter_value" + + +def test_list_builds_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_builds( + cloudbuild.ListBuildsRequest(), + project_id="project_id_value", + filter="filter_value", + ) + + +@pytest.mark.asyncio +async def test_list_builds_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_builds), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.ListBuildsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.ListBuildsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_builds( + project_id="project_id_value", filter="filter_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].project_id == "project_id_value" + + assert args[0].filter == "filter_value" + + +@pytest.mark.asyncio +async def test_list_builds_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_builds( + cloudbuild.ListBuildsRequest(), + project_id="project_id_value", + filter="filter_value", + ) + + +def test_list_builds_pager(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_builds), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(), cloudbuild.Build(), cloudbuild.Build(),], + next_page_token="abc", + ), + cloudbuild.ListBuildsResponse(builds=[], next_page_token="def",), + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(),], next_page_token="ghi", + ), + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(), cloudbuild.Build(),], + ), + RuntimeError, + ) + + metadata = () + pager = client.list_builds(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, cloudbuild.Build) for i in results) + + +def test_list_builds_pages(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_builds), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(), cloudbuild.Build(), cloudbuild.Build(),], + next_page_token="abc", + ), + cloudbuild.ListBuildsResponse(builds=[], next_page_token="def",), + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(),], next_page_token="ghi", + ), + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(), cloudbuild.Build(),], + ), + RuntimeError, + ) + pages = list(client.list_builds(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_builds_async_pager(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_builds), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(), cloudbuild.Build(), cloudbuild.Build(),], + next_page_token="abc", + ), + cloudbuild.ListBuildsResponse(builds=[], next_page_token="def",), + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(),], next_page_token="ghi", + ), + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(), cloudbuild.Build(),], + ), + RuntimeError, + ) + async_pager = await client.list_builds(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, cloudbuild.Build) for i in responses) + + +@pytest.mark.asyncio +async def test_list_builds_async_pages(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_builds), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(), cloudbuild.Build(), cloudbuild.Build(),], + next_page_token="abc", + ), + cloudbuild.ListBuildsResponse(builds=[], next_page_token="def",), + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(),], next_page_token="ghi", + ), + cloudbuild.ListBuildsResponse( + builds=[cloudbuild.Build(), cloudbuild.Build(),], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.list_builds(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_cancel_build(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.CancelBuildRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.cancel_build), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.Build( + id="id_value", + project_id="project_id_value", + status=cloudbuild.Build.Status.QUEUED, + status_detail="status_detail_value", + images=["images_value"], + logs_bucket="logs_bucket_value", + build_trigger_id="build_trigger_id_value", + log_url="iframe.php?url=https%3A%2F%2Fgithub.com%2Flog_url_value", + tags=["tags_value"], + ) + + response = client.cancel_build(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, cloudbuild.Build) + + assert response.id == "id_value" + + assert response.project_id == "project_id_value" + + assert response.status == cloudbuild.Build.Status.QUEUED + + assert response.status_detail == "status_detail_value" + + assert response.images == ["images_value"] + + assert response.logs_bucket == "logs_bucket_value" + + assert response.build_trigger_id == "build_trigger_id_value" + + assert response.log_url == "log_url_value" + + assert response.tags == ["tags_value"] + + +@pytest.mark.asyncio +async def test_cancel_build_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.CancelBuildRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.cancel_build), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.Build( + id="id_value", + project_id="project_id_value", + status=cloudbuild.Build.Status.QUEUED, + status_detail="status_detail_value", + images=["images_value"], + logs_bucket="logs_bucket_value", + build_trigger_id="build_trigger_id_value", + log_url="iframe.php?url=https%3A%2F%2Fgithub.com%2Flog_url_value", + tags=["tags_value"], + ) + ) + + response = await client.cancel_build(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, cloudbuild.Build) + + assert response.id == "id_value" + + assert response.project_id == "project_id_value" + + assert response.status == cloudbuild.Build.Status.QUEUED + + assert response.status_detail == "status_detail_value" + + assert response.images == ["images_value"] + + assert response.logs_bucket == "logs_bucket_value" + + assert response.build_trigger_id == "build_trigger_id_value" + + assert response.log_url == "log_url_value" + + assert response.tags == ["tags_value"] + + +def test_cancel_build_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.cancel_build), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.Build() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.cancel_build( + project_id="project_id_value", id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].id == "id_value" + + +def test_cancel_build_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.cancel_build( + cloudbuild.CancelBuildRequest(), + project_id="project_id_value", + id="id_value", + ) + + +@pytest.mark.asyncio +async def test_cancel_build_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.cancel_build), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.Build() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(cloudbuild.Build()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.cancel_build( + project_id="project_id_value", id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].id == "id_value" + + +@pytest.mark.asyncio +async def test_cancel_build_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.cancel_build( + cloudbuild.CancelBuildRequest(), + project_id="project_id_value", + id="id_value", + ) + + +def test_retry_build(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.RetryBuildRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.retry_build), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + + response = client.retry_build(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, future.Future) + + +@pytest.mark.asyncio +async def test_retry_build_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.RetryBuildRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.retry_build), "__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.retry_build(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, future.Future) + + +def test_retry_build_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.retry_build), "__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.retry_build( + project_id="project_id_value", id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].id == "id_value" + + +def test_retry_build_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.retry_build( + cloudbuild.RetryBuildRequest(), + project_id="project_id_value", + id="id_value", + ) + + +@pytest.mark.asyncio +async def test_retry_build_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.retry_build), "__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.retry_build( + project_id="project_id_value", id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].id == "id_value" + + +@pytest.mark.asyncio +async def test_retry_build_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_build( + cloudbuild.RetryBuildRequest(), + project_id="project_id_value", + id="id_value", + ) + + +def test_create_build_trigger(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.CreateBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger( + id="id_value", + description="description_value", + name="name_value", + tags=["tags_value"], + disabled=True, + ignored_files=["ignored_files_value"], + included_files=["included_files_value"], + build=cloudbuild.Build(id="id_value"), + ) + + response = client.create_build_trigger(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, cloudbuild.BuildTrigger) + + assert response.id == "id_value" + + assert response.description == "description_value" + + assert response.name == "name_value" + + assert response.tags == ["tags_value"] + + assert response.disabled is True + + assert response.ignored_files == ["ignored_files_value"] + + assert response.included_files == ["included_files_value"] + + +@pytest.mark.asyncio +async def test_create_build_trigger_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.CreateBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.BuildTrigger( + id="id_value", + description="description_value", + name="name_value", + tags=["tags_value"], + disabled=True, + ignored_files=["ignored_files_value"], + included_files=["included_files_value"], + ) + ) + + response = await client.create_build_trigger(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, cloudbuild.BuildTrigger) + + assert response.id == "id_value" + + assert response.description == "description_value" + + assert response.name == "name_value" + + assert response.tags == ["tags_value"] + + assert response.disabled is True + + assert response.ignored_files == ["ignored_files_value"] + + assert response.included_files == ["included_files_value"] + + +def test_create_build_trigger_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_build_trigger( + project_id="project_id_value", + trigger=cloudbuild.BuildTrigger(id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger == cloudbuild.BuildTrigger(id="id_value") + + +def test_create_build_trigger_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_build_trigger( + cloudbuild.CreateBuildTriggerRequest(), + project_id="project_id_value", + trigger=cloudbuild.BuildTrigger(id="id_value"), + ) + + +@pytest.mark.asyncio +async def test_create_build_trigger_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.BuildTrigger() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_build_trigger( + project_id="project_id_value", + trigger=cloudbuild.BuildTrigger(id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger == cloudbuild.BuildTrigger(id="id_value") + + +@pytest.mark.asyncio +async def test_create_build_trigger_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_build_trigger( + cloudbuild.CreateBuildTriggerRequest(), + project_id="project_id_value", + trigger=cloudbuild.BuildTrigger(id="id_value"), + ) + + +def test_get_build_trigger(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.GetBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.get_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger( + id="id_value", + description="description_value", + name="name_value", + tags=["tags_value"], + disabled=True, + ignored_files=["ignored_files_value"], + included_files=["included_files_value"], + build=cloudbuild.Build(id="id_value"), + ) + + response = client.get_build_trigger(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, cloudbuild.BuildTrigger) + + assert response.id == "id_value" + + assert response.description == "description_value" + + assert response.name == "name_value" + + assert response.tags == ["tags_value"] + + assert response.disabled is True + + assert response.ignored_files == ["ignored_files_value"] + + assert response.included_files == ["included_files_value"] + + +@pytest.mark.asyncio +async def test_get_build_trigger_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.GetBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.BuildTrigger( + id="id_value", + description="description_value", + name="name_value", + tags=["tags_value"], + disabled=True, + ignored_files=["ignored_files_value"], + included_files=["included_files_value"], + ) + ) + + response = await client.get_build_trigger(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, cloudbuild.BuildTrigger) + + assert response.id == "id_value" + + assert response.description == "description_value" + + assert response.name == "name_value" + + assert response.tags == ["tags_value"] + + assert response.disabled is True + + assert response.ignored_files == ["ignored_files_value"] + + assert response.included_files == ["included_files_value"] + + +def test_get_build_trigger_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.get_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_build_trigger( + project_id="project_id_value", trigger_id="trigger_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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger_id == "trigger_id_value" + + +def test_get_build_trigger_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_build_trigger( + cloudbuild.GetBuildTriggerRequest(), + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + +@pytest.mark.asyncio +async def test_get_build_trigger_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.BuildTrigger() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_build_trigger( + project_id="project_id_value", trigger_id="trigger_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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger_id == "trigger_id_value" + + +@pytest.mark.asyncio +async def test_get_build_trigger_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_build_trigger( + cloudbuild.GetBuildTriggerRequest(), + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + +def test_list_build_triggers(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.ListBuildTriggersRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_build_triggers), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.ListBuildTriggersResponse( + next_page_token="next_page_token_value", + ) + + response = client.list_build_triggers(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, pagers.ListBuildTriggersPager) + + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_build_triggers_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.ListBuildTriggersRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_build_triggers), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.ListBuildTriggersResponse( + next_page_token="next_page_token_value", + ) + ) + + response = await client.list_build_triggers(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, pagers.ListBuildTriggersAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_build_triggers_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_build_triggers), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.ListBuildTriggersResponse() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_build_triggers(project_id="project_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] + + assert args[0].project_id == "project_id_value" + + +def test_list_build_triggers_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_build_triggers( + cloudbuild.ListBuildTriggersRequest(), project_id="project_id_value", + ) + + +@pytest.mark.asyncio +async def test_list_build_triggers_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_build_triggers), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.ListBuildTriggersResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.ListBuildTriggersResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_build_triggers(project_id="project_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] + + assert args[0].project_id == "project_id_value" + + +@pytest.mark.asyncio +async def test_list_build_triggers_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_build_triggers( + cloudbuild.ListBuildTriggersRequest(), project_id="project_id_value", + ) + + +def test_list_build_triggers_pager(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_build_triggers), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloudbuild.ListBuildTriggersResponse( + triggers=[ + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + ], + next_page_token="abc", + ), + cloudbuild.ListBuildTriggersResponse(triggers=[], next_page_token="def",), + cloudbuild.ListBuildTriggersResponse( + triggers=[cloudbuild.BuildTrigger(),], next_page_token="ghi", + ), + cloudbuild.ListBuildTriggersResponse( + triggers=[cloudbuild.BuildTrigger(), cloudbuild.BuildTrigger(),], + ), + RuntimeError, + ) + + metadata = () + pager = client.list_build_triggers(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, cloudbuild.BuildTrigger) for i in results) + + +def test_list_build_triggers_pages(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_build_triggers), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloudbuild.ListBuildTriggersResponse( + triggers=[ + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + ], + next_page_token="abc", + ), + cloudbuild.ListBuildTriggersResponse(triggers=[], next_page_token="def",), + cloudbuild.ListBuildTriggersResponse( + triggers=[cloudbuild.BuildTrigger(),], next_page_token="ghi", + ), + cloudbuild.ListBuildTriggersResponse( + triggers=[cloudbuild.BuildTrigger(), cloudbuild.BuildTrigger(),], + ), + RuntimeError, + ) + pages = list(client.list_build_triggers(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_build_triggers_async_pager(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_build_triggers), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloudbuild.ListBuildTriggersResponse( + triggers=[ + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + ], + next_page_token="abc", + ), + cloudbuild.ListBuildTriggersResponse(triggers=[], next_page_token="def",), + cloudbuild.ListBuildTriggersResponse( + triggers=[cloudbuild.BuildTrigger(),], next_page_token="ghi", + ), + cloudbuild.ListBuildTriggersResponse( + triggers=[cloudbuild.BuildTrigger(), cloudbuild.BuildTrigger(),], + ), + RuntimeError, + ) + async_pager = await client.list_build_triggers(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, cloudbuild.BuildTrigger) for i in responses) + + +@pytest.mark.asyncio +async def test_list_build_triggers_async_pages(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_build_triggers), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + cloudbuild.ListBuildTriggersResponse( + triggers=[ + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + cloudbuild.BuildTrigger(), + ], + next_page_token="abc", + ), + cloudbuild.ListBuildTriggersResponse(triggers=[], next_page_token="def",), + cloudbuild.ListBuildTriggersResponse( + triggers=[cloudbuild.BuildTrigger(),], next_page_token="ghi", + ), + cloudbuild.ListBuildTriggersResponse( + triggers=[cloudbuild.BuildTrigger(), cloudbuild.BuildTrigger(),], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.list_build_triggers(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_delete_build_trigger(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.DeleteBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.delete_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_build_trigger(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_build_trigger_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.DeleteBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + response = await client.delete_build_trigger(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 response is None + + +def test_delete_build_trigger_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.delete_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_build_trigger( + project_id="project_id_value", trigger_id="trigger_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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger_id == "trigger_id_value" + + +def test_delete_build_trigger_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_build_trigger( + cloudbuild.DeleteBuildTriggerRequest(), + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + +@pytest.mark.asyncio +async def test_delete_build_trigger_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_build_trigger( + project_id="project_id_value", trigger_id="trigger_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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger_id == "trigger_id_value" + + +@pytest.mark.asyncio +async def test_delete_build_trigger_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_build_trigger( + cloudbuild.DeleteBuildTriggerRequest(), + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + +def test_update_build_trigger(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.UpdateBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.update_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger( + id="id_value", + description="description_value", + name="name_value", + tags=["tags_value"], + disabled=True, + ignored_files=["ignored_files_value"], + included_files=["included_files_value"], + build=cloudbuild.Build(id="id_value"), + ) + + response = client.update_build_trigger(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, cloudbuild.BuildTrigger) + + assert response.id == "id_value" + + assert response.description == "description_value" + + assert response.name == "name_value" + + assert response.tags == ["tags_value"] + + assert response.disabled is True + + assert response.ignored_files == ["ignored_files_value"] + + assert response.included_files == ["included_files_value"] + + +@pytest.mark.asyncio +async def test_update_build_trigger_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.UpdateBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.BuildTrigger( + id="id_value", + description="description_value", + name="name_value", + tags=["tags_value"], + disabled=True, + ignored_files=["ignored_files_value"], + included_files=["included_files_value"], + ) + ) + + response = await client.update_build_trigger(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, cloudbuild.BuildTrigger) + + assert response.id == "id_value" + + assert response.description == "description_value" + + assert response.name == "name_value" + + assert response.tags == ["tags_value"] + + assert response.disabled is True + + assert response.ignored_files == ["ignored_files_value"] + + assert response.included_files == ["included_files_value"] + + +def test_update_build_trigger_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.update_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_build_trigger( + project_id="project_id_value", + trigger_id="trigger_id_value", + trigger=cloudbuild.BuildTrigger(id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger_id == "trigger_id_value" + + assert args[0].trigger == cloudbuild.BuildTrigger(id="id_value") + + +def test_update_build_trigger_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_build_trigger( + cloudbuild.UpdateBuildTriggerRequest(), + project_id="project_id_value", + trigger_id="trigger_id_value", + trigger=cloudbuild.BuildTrigger(id="id_value"), + ) + + +@pytest.mark.asyncio +async def test_update_build_trigger_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.BuildTrigger() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.BuildTrigger() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_build_trigger( + project_id="project_id_value", + trigger_id="trigger_id_value", + trigger=cloudbuild.BuildTrigger(id="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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger_id == "trigger_id_value" + + assert args[0].trigger == cloudbuild.BuildTrigger(id="id_value") + + +@pytest.mark.asyncio +async def test_update_build_trigger_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=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_build_trigger( + cloudbuild.UpdateBuildTriggerRequest(), + project_id="project_id_value", + trigger_id="trigger_id_value", + trigger=cloudbuild.BuildTrigger(id="id_value"), + ) + + +def test_run_build_trigger(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.RunBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.run_build_trigger), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + + response = client.run_build_trigger(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, future.Future) + + +@pytest.mark.asyncio +async def test_run_build_trigger_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.RunBuildTriggerRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.run_build_trigger), "__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.run_build_trigger(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, future.Future) + + +def test_run_build_trigger_flattened(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.run_build_trigger), "__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.run_build_trigger( + project_id="project_id_value", + trigger_id="trigger_id_value", + source=cloudbuild.RepoSource(project_id="project_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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger_id == "trigger_id_value" + + assert args[0].source == cloudbuild.RepoSource(project_id="project_id_value") + + +def test_run_build_trigger_flattened_error(): + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.run_build_trigger( + cloudbuild.RunBuildTriggerRequest(), + project_id="project_id_value", + trigger_id="trigger_id_value", + source=cloudbuild.RepoSource(project_id="project_id_value"), + ) + + +@pytest.mark.asyncio +async def test_run_build_trigger_flattened_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.run_build_trigger), "__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.run_build_trigger( + project_id="project_id_value", + trigger_id="trigger_id_value", + source=cloudbuild.RepoSource(project_id="project_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] + + assert args[0].project_id == "project_id_value" + + assert args[0].trigger_id == "trigger_id_value" + + assert args[0].source == cloudbuild.RepoSource(project_id="project_id_value") + + +@pytest.mark.asyncio +async def test_run_build_trigger_flattened_error_async(): + client = CloudBuildAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.run_build_trigger( + cloudbuild.RunBuildTriggerRequest(), + project_id="project_id_value", + trigger_id="trigger_id_value", + source=cloudbuild.RepoSource(project_id="project_id_value"), + ) + + +def test_create_worker_pool(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.CreateWorkerPoolRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_worker_pool), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.WorkerPool( + name="name_value", + project_id="project_id_value", + service_account_email="service_account_email_value", + worker_count=1314, + regions=[cloudbuild.WorkerPool.Region.US_CENTRAL1], + status=cloudbuild.WorkerPool.Status.CREATING, + ) + + response = client.create_worker_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cloudbuild.WorkerPool) + + assert response.name == "name_value" + + assert response.project_id == "project_id_value" + + assert response.service_account_email == "service_account_email_value" + + assert response.worker_count == 1314 + + assert response.regions == [cloudbuild.WorkerPool.Region.US_CENTRAL1] + + assert response.status == cloudbuild.WorkerPool.Status.CREATING + + +@pytest.mark.asyncio +async def test_create_worker_pool_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.CreateWorkerPoolRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_worker_pool), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.WorkerPool( + name="name_value", + project_id="project_id_value", + service_account_email="service_account_email_value", + worker_count=1314, + regions=[cloudbuild.WorkerPool.Region.US_CENTRAL1], + status=cloudbuild.WorkerPool.Status.CREATING, + ) + ) + + response = await client.create_worker_pool(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, cloudbuild.WorkerPool) + + assert response.name == "name_value" + + assert response.project_id == "project_id_value" + + assert response.service_account_email == "service_account_email_value" + + assert response.worker_count == 1314 + + assert response.regions == [cloudbuild.WorkerPool.Region.US_CENTRAL1] + + assert response.status == cloudbuild.WorkerPool.Status.CREATING + + +def test_get_worker_pool(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.GetWorkerPoolRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_worker_pool), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.WorkerPool( + name="name_value", + project_id="project_id_value", + service_account_email="service_account_email_value", + worker_count=1314, + regions=[cloudbuild.WorkerPool.Region.US_CENTRAL1], + status=cloudbuild.WorkerPool.Status.CREATING, + ) + + response = client.get_worker_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cloudbuild.WorkerPool) + + assert response.name == "name_value" + + assert response.project_id == "project_id_value" + + assert response.service_account_email == "service_account_email_value" + + assert response.worker_count == 1314 + + assert response.regions == [cloudbuild.WorkerPool.Region.US_CENTRAL1] + + assert response.status == cloudbuild.WorkerPool.Status.CREATING + + +@pytest.mark.asyncio +async def test_get_worker_pool_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.GetWorkerPoolRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_worker_pool), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.WorkerPool( + name="name_value", + project_id="project_id_value", + service_account_email="service_account_email_value", + worker_count=1314, + regions=[cloudbuild.WorkerPool.Region.US_CENTRAL1], + status=cloudbuild.WorkerPool.Status.CREATING, + ) + ) + + response = await client.get_worker_pool(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, cloudbuild.WorkerPool) + + assert response.name == "name_value" + + assert response.project_id == "project_id_value" + + assert response.service_account_email == "service_account_email_value" + + assert response.worker_count == 1314 + + assert response.regions == [cloudbuild.WorkerPool.Region.US_CENTRAL1] + + assert response.status == cloudbuild.WorkerPool.Status.CREATING + + +def test_delete_worker_pool(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.DeleteWorkerPoolRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.delete_worker_pool), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_worker_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_delete_worker_pool_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.DeleteWorkerPoolRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_worker_pool), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + response = await client.delete_worker_pool(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 response is None + + +def test_update_worker_pool(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.UpdateWorkerPoolRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.update_worker_pool), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.WorkerPool( + name="name_value", + project_id="project_id_value", + service_account_email="service_account_email_value", + worker_count=1314, + regions=[cloudbuild.WorkerPool.Region.US_CENTRAL1], + status=cloudbuild.WorkerPool.Status.CREATING, + ) + + response = client.update_worker_pool(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cloudbuild.WorkerPool) + + assert response.name == "name_value" + + assert response.project_id == "project_id_value" + + assert response.service_account_email == "service_account_email_value" + + assert response.worker_count == 1314 + + assert response.regions == [cloudbuild.WorkerPool.Region.US_CENTRAL1] + + assert response.status == cloudbuild.WorkerPool.Status.CREATING + + +@pytest.mark.asyncio +async def test_update_worker_pool_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.UpdateWorkerPoolRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_worker_pool), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.WorkerPool( + name="name_value", + project_id="project_id_value", + service_account_email="service_account_email_value", + worker_count=1314, + regions=[cloudbuild.WorkerPool.Region.US_CENTRAL1], + status=cloudbuild.WorkerPool.Status.CREATING, + ) + ) + + response = await client.update_worker_pool(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, cloudbuild.WorkerPool) + + assert response.name == "name_value" + + assert response.project_id == "project_id_value" + + assert response.service_account_email == "service_account_email_value" + + assert response.worker_count == 1314 + + assert response.regions == [cloudbuild.WorkerPool.Region.US_CENTRAL1] + + assert response.status == cloudbuild.WorkerPool.Status.CREATING + + +def test_list_worker_pools(transport: str = "grpc"): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.ListWorkerPoolsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_worker_pools), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = cloudbuild.ListWorkerPoolsResponse() + + response = client.list_worker_pools(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, cloudbuild.ListWorkerPoolsResponse) + + +@pytest.mark.asyncio +async def test_list_worker_pools_async(transport: str = "grpc_asyncio"): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = cloudbuild.ListWorkerPoolsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_worker_pools), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + cloudbuild.ListWorkerPoolsResponse() + ) + + response = await client.list_worker_pools(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, cloudbuild.ListWorkerPoolsResponse) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.CloudBuildGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.CloudBuildGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudBuildClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.CloudBuildGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CloudBuildClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.CloudBuildGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + client = CloudBuildClient(transport=transport) + assert client._transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.CloudBuildGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.CloudBuildGrpcAsyncIOTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = CloudBuildClient(credentials=credentials.AnonymousCredentials(),) + assert isinstance(client._transport, transports.CloudBuildGrpcTransport,) + + +def test_cloud_build_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(exceptions.DuplicateCredentialArgs): + transport = transports.CloudBuildTransport( + credentials=credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_cloud_build_base_transport(): + # Instantiate the base transport. + transport = transports.CloudBuildTransport( + credentials=credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "create_build", + "get_build", + "list_builds", + "cancel_build", + "retry_build", + "create_build_trigger", + "get_build_trigger", + "list_build_triggers", + "delete_build_trigger", + "update_build_trigger", + "run_build_trigger", + "create_worker_pool", + "get_worker_pool", + "delete_worker_pool", + "update_worker_pool", + "list_worker_pools", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + with pytest.raises(NotImplementedError): + transport.operations_client + + +def test_cloud_build_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object(auth, "load_credentials_from_file") as load_creds: + load_creds.return_value = (credentials.AnonymousCredentials(), None) + transport = transports.CloudBuildTransport(credentials_file="credentials.json",) + load_creds.assert_called_once_with( + "credentials.json", + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ) + + +def test_cloud_build_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + CloudBuildClient() + adc.assert_called_once_with( + scopes=("https://www.googleapis.com/auth/cloud-platform",) + ) + + +def test_cloud_build_transport_auth_adc(): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + transports.CloudBuildGrpcTransport(host="squid.clam.whelk") + adc.assert_called_once_with( + scopes=("https://www.googleapis.com/auth/cloud-platform",) + ) + + +def test_cloud_build_host_no_port(): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="cloudbuild.googleapis.com" + ), + ) + assert client._transport._host == "cloudbuild.googleapis.com:443" + + +def test_cloud_build_host_with_port(): + client = CloudBuildClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="cloudbuild.googleapis.com:8000" + ), + ) + assert client._transport._host == "cloudbuild.googleapis.com:8000" + + +def test_cloud_build_grpc_transport_channel(): + channel = grpc.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.CloudBuildGrpcTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +def test_cloud_build_grpc_asyncio_transport_channel(): + channel = aio.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.CloudBuildGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_cloud_build_grpc_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + 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 + + transport = transports.CloudBuildGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + 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=mock_cred, + credentials_file=None, + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=mock_ssl_cred, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_cloud_build_grpc_asyncio_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + 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 + + transport = transports.CloudBuildGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + 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=mock_cred, + credentials_file=None, + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=mock_ssl_cred, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_cloud_build_grpc_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials 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), + ): + mock_cred = mock.Mock() + transport = transports.CloudBuildGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=mock_ssl_cred, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_cloud_build_grpc_asyncio_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials 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), + ): + mock_cred = mock.Mock() + transport = transports.CloudBuildGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=mock_ssl_cred, + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_cloud_build_grpc_lro_client(): + client = CloudBuildClient( + credentials=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_build_grpc_lro_async_client(): + client = CloudBuildAsyncClient( + credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + ) + transport = client._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 diff --git a/tests/unit/gapic/v1/test_cloud_build_client_v1.py b/tests/unit/gapic/v1/test_cloud_build_client_v1.py deleted file mode 100644 index f4a2bfce..00000000 --- a/tests/unit/gapic/v1/test_cloud_build_client_v1.py +++ /dev/null @@ -1,833 +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. - -"""Unit tests.""" - -import mock -import pytest - -from google.rpc import status_pb2 - -from google.cloud.devtools import cloudbuild_v1 -from google.cloud.devtools.cloudbuild_v1.proto import cloudbuild_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 - - -class MultiCallableStub(object): - """Stub for the grpc.UnaryUnaryMultiCallable interface.""" - - def __init__(self, method, channel_stub): - self.method = method - self.channel_stub = channel_stub - - def __call__(self, request, timeout=None, metadata=None, credentials=None): - self.channel_stub.requests.append((self.method, request)) - - response = None - if self.channel_stub.responses: - response = self.channel_stub.responses.pop() - - if isinstance(response, Exception): - raise response - - if response: - return response - - -class ChannelStub(object): - """Stub for the grpc.Channel interface.""" - - def __init__(self, responses=[]): - self.responses = responses - self.requests = [] - - def unary_unary(self, method, request_serializer=None, response_deserializer=None): - return MultiCallableStub(method, self) - - -class CustomException(Exception): - pass - - -class TestCloudBuildClient(object): - def test_list_builds(self): - # Setup Expected Response - next_page_token = "" - builds_element = {} - builds = [builds_element] - expected_response = {"next_page_token": next_page_token, "builds": builds} - expected_response = cloudbuild_pb2.ListBuildsResponse(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - - paged_list_response = client.list_builds(project_id) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.builds[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.ListBuildsRequest(project_id=project_id) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_list_builds_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup request - project_id = "projectId-1969970175" - - paged_list_response = client.list_builds(project_id) - with pytest.raises(CustomException): - list(paged_list_response) - - def test_delete_build_trigger(self): - channel = ChannelStub() - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - trigger_id = "triggerId1363517698" - - client.delete_build_trigger(project_id, trigger_id) - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.DeleteBuildTriggerRequest( - project_id=project_id, trigger_id=trigger_id - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_delete_build_trigger_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup request - project_id = "projectId-1969970175" - trigger_id = "triggerId1363517698" - - with pytest.raises(CustomException): - client.delete_build_trigger(project_id, trigger_id) - - def test_create_build(self): - # Setup Expected Response - id_ = "id3355" - project_id_2 = "projectId2939242356" - status_detail = "statusDetail2089931070" - logs_bucket = "logsBucket1565363834" - build_trigger_id = "buildTriggerId1105559411" - log_url = "logUrl342054388" - expected_response = { - "id": id_, - "project_id": project_id_2, - "status_detail": status_detail, - "logs_bucket": logs_bucket, - "build_trigger_id": build_trigger_id, - "log_url": log_url, - } - expected_response = cloudbuild_pb2.Build(**expected_response) - operation = operations_pb2.Operation( - name="operations/test_create_build", done=True - ) - operation.response.Pack(expected_response) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - build = {} - - response = client.create_build(project_id, build) - result = response.result() - assert expected_response == result - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.CreateBuildRequest( - project_id=project_id, build=build - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_build_exception(self): - # Setup Response - error = status_pb2.Status() - operation = operations_pb2.Operation( - name="operations/test_create_build_exception", done=True - ) - operation.error.CopyFrom(error) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - build = {} - - response = client.create_build(project_id, build) - exception = response.exception() - assert exception.errors[0] == error - - def test_get_build(self): - # Setup Expected Response - id_2 = "id23227150" - project_id_2 = "projectId2939242356" - status_detail = "statusDetail2089931070" - logs_bucket = "logsBucket1565363834" - build_trigger_id = "buildTriggerId1105559411" - log_url = "logUrl342054388" - expected_response = { - "id": id_2, - "project_id": project_id_2, - "status_detail": status_detail, - "logs_bucket": logs_bucket, - "build_trigger_id": build_trigger_id, - "log_url": log_url, - } - expected_response = cloudbuild_pb2.Build(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - id_ = "id3355" - - response = client.get_build(project_id, id_) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.GetBuildRequest(project_id=project_id, id=id_) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_get_build_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup request - project_id = "projectId-1969970175" - id_ = "id3355" - - with pytest.raises(CustomException): - client.get_build(project_id, id_) - - def test_cancel_build(self): - # Setup Expected Response - id_2 = "id23227150" - project_id_2 = "projectId2939242356" - status_detail = "statusDetail2089931070" - logs_bucket = "logsBucket1565363834" - build_trigger_id = "buildTriggerId1105559411" - log_url = "logUrl342054388" - expected_response = { - "id": id_2, - "project_id": project_id_2, - "status_detail": status_detail, - "logs_bucket": logs_bucket, - "build_trigger_id": build_trigger_id, - "log_url": log_url, - } - expected_response = cloudbuild_pb2.Build(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - id_ = "id3355" - - response = client.cancel_build(project_id, id_) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.CancelBuildRequest( - project_id=project_id, id=id_ - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_cancel_build_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup request - project_id = "projectId-1969970175" - id_ = "id3355" - - with pytest.raises(CustomException): - client.cancel_build(project_id, id_) - - def test_retry_build(self): - # Setup Expected Response - id_2 = "id23227150" - project_id_2 = "projectId2939242356" - status_detail = "statusDetail2089931070" - logs_bucket = "logsBucket1565363834" - build_trigger_id = "buildTriggerId1105559411" - log_url = "logUrl342054388" - expected_response = { - "id": id_2, - "project_id": project_id_2, - "status_detail": status_detail, - "logs_bucket": logs_bucket, - "build_trigger_id": build_trigger_id, - "log_url": log_url, - } - expected_response = cloudbuild_pb2.Build(**expected_response) - operation = operations_pb2.Operation( - name="operations/test_retry_build", done=True - ) - operation.response.Pack(expected_response) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - id_ = "id3355" - - response = client.retry_build(project_id, id_) - result = response.result() - assert expected_response == result - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.RetryBuildRequest( - project_id=project_id, id=id_ - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_retry_build_exception(self): - # Setup Response - error = status_pb2.Status() - operation = operations_pb2.Operation( - name="operations/test_retry_build_exception", done=True - ) - operation.error.CopyFrom(error) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - id_ = "id3355" - - response = client.retry_build(project_id, id_) - exception = response.exception() - assert exception.errors[0] == error - - def test_create_build_trigger(self): - # Setup Expected Response - id_ = "id3355" - description = "description-1724546052" - name = "name3373707" - filename = "filename-734768633" - disabled = True - expected_response = { - "id": id_, - "description": description, - "name": name, - "filename": filename, - "disabled": disabled, - } - expected_response = cloudbuild_pb2.BuildTrigger(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - trigger = {} - - response = client.create_build_trigger(project_id, trigger) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.CreateBuildTriggerRequest( - project_id=project_id, trigger=trigger - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_build_trigger_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup request - project_id = "projectId-1969970175" - trigger = {} - - with pytest.raises(CustomException): - client.create_build_trigger(project_id, trigger) - - def test_get_build_trigger(self): - # Setup Expected Response - id_ = "id3355" - description = "description-1724546052" - name = "name3373707" - filename = "filename-734768633" - disabled = True - expected_response = { - "id": id_, - "description": description, - "name": name, - "filename": filename, - "disabled": disabled, - } - expected_response = cloudbuild_pb2.BuildTrigger(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - trigger_id = "triggerId1363517698" - - response = client.get_build_trigger(project_id, trigger_id) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.GetBuildTriggerRequest( - project_id=project_id, trigger_id=trigger_id - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_get_build_trigger_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup request - project_id = "projectId-1969970175" - trigger_id = "triggerId1363517698" - - with pytest.raises(CustomException): - client.get_build_trigger(project_id, trigger_id) - - def test_list_build_triggers(self): - # Setup Expected Response - next_page_token = "" - triggers_element = {} - triggers = [triggers_element] - expected_response = {"next_page_token": next_page_token, "triggers": triggers} - expected_response = cloudbuild_pb2.ListBuildTriggersResponse( - **expected_response - ) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - - paged_list_response = client.list_build_triggers(project_id) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.triggers[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.ListBuildTriggersRequest( - project_id=project_id - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_list_build_triggers_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup request - project_id = "projectId-1969970175" - - paged_list_response = client.list_build_triggers(project_id) - with pytest.raises(CustomException): - list(paged_list_response) - - def test_update_build_trigger(self): - # Setup Expected Response - id_ = "id3355" - description = "description-1724546052" - name = "name3373707" - filename = "filename-734768633" - disabled = True - expected_response = { - "id": id_, - "description": description, - "name": name, - "filename": filename, - "disabled": disabled, - } - expected_response = cloudbuild_pb2.BuildTrigger(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - trigger_id = "triggerId1363517698" - trigger = {} - - response = client.update_build_trigger(project_id, trigger_id, trigger) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.UpdateBuildTriggerRequest( - project_id=project_id, trigger_id=trigger_id, trigger=trigger - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_update_build_trigger_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup request - project_id = "projectId-1969970175" - trigger_id = "triggerId1363517698" - trigger = {} - - with pytest.raises(CustomException): - client.update_build_trigger(project_id, trigger_id, trigger) - - def test_run_build_trigger(self): - # Setup Expected Response - id_ = "id3355" - project_id_2 = "projectId2939242356" - status_detail = "statusDetail2089931070" - logs_bucket = "logsBucket1565363834" - build_trigger_id = "buildTriggerId1105559411" - log_url = "logUrl342054388" - expected_response = { - "id": id_, - "project_id": project_id_2, - "status_detail": status_detail, - "logs_bucket": logs_bucket, - "build_trigger_id": build_trigger_id, - "log_url": log_url, - } - expected_response = cloudbuild_pb2.Build(**expected_response) - operation = operations_pb2.Operation( - name="operations/test_run_build_trigger", done=True - ) - operation.response.Pack(expected_response) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - trigger_id = "triggerId1363517698" - source = {} - - response = client.run_build_trigger(project_id, trigger_id, source) - result = response.result() - assert expected_response == result - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.RunBuildTriggerRequest( - project_id=project_id, trigger_id=trigger_id, source=source - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_run_build_trigger_exception(self): - # Setup Response - error = status_pb2.Status() - operation = operations_pb2.Operation( - name="operations/test_run_build_trigger_exception", done=True - ) - operation.error.CopyFrom(error) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - # Setup Request - project_id = "projectId-1969970175" - trigger_id = "triggerId1363517698" - source = {} - - response = client.run_build_trigger(project_id, trigger_id, source) - exception = response.exception() - assert exception.errors[0] == error - - def test_create_worker_pool(self): - # Setup Expected Response - name = "name3373707" - project_id = "projectId-1969970175" - service_account_email = "serviceAccountEmail-1300473088" - worker_count = 372044046 - expected_response = { - "name": name, - "project_id": project_id, - "service_account_email": service_account_email, - "worker_count": worker_count, - } - expected_response = cloudbuild_pb2.WorkerPool(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - response = client.create_worker_pool() - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.CreateWorkerPoolRequest() - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_worker_pool_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - with pytest.raises(CustomException): - client.create_worker_pool() - - def test_get_worker_pool(self): - # Setup Expected Response - name = "name3373707" - project_id = "projectId-1969970175" - service_account_email = "serviceAccountEmail-1300473088" - worker_count = 372044046 - expected_response = { - "name": name, - "project_id": project_id, - "service_account_email": service_account_email, - "worker_count": worker_count, - } - expected_response = cloudbuild_pb2.WorkerPool(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - response = client.get_worker_pool() - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.GetWorkerPoolRequest() - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_get_worker_pool_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - with pytest.raises(CustomException): - client.get_worker_pool() - - def test_delete_worker_pool(self): - channel = ChannelStub() - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - client.delete_worker_pool() - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.DeleteWorkerPoolRequest() - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_delete_worker_pool_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - with pytest.raises(CustomException): - client.delete_worker_pool() - - def test_update_worker_pool(self): - # Setup Expected Response - name = "name3373707" - project_id = "projectId-1969970175" - service_account_email = "serviceAccountEmail-1300473088" - worker_count = 372044046 - expected_response = { - "name": name, - "project_id": project_id, - "service_account_email": service_account_email, - "worker_count": worker_count, - } - expected_response = cloudbuild_pb2.WorkerPool(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - response = client.update_worker_pool() - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.UpdateWorkerPoolRequest() - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_update_worker_pool_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - with pytest.raises(CustomException): - client.update_worker_pool() - - def test_list_worker_pools(self): - # Setup Expected Response - expected_response = {} - expected_response = cloudbuild_pb2.ListWorkerPoolsResponse(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - response = client.list_worker_pools() - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = cloudbuild_pb2.ListWorkerPoolsRequest() - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_list_worker_pools_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = cloudbuild_v1.CloudBuildClient() - - with pytest.raises(CustomException): - client.list_worker_pools()