From c410bcc60da887152c40d926a12f9ea6981c6570 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Tue, 9 Nov 2021 17:05:47 +0100 Subject: [PATCH 01/21] chore(deps): update dependency google-cloud-build to v3.7.1 (#203) --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 77aafb0b..7d17c9be 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-build==3.7.0 +google-cloud-build==3.7.1 google-auth==2.3.3 \ No newline at end of file From e8dc3ffa9a9d84761d168742b588af5cf6be6127 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:54:24 -0500 Subject: [PATCH 02/21] chore: use gapic-generator-python 0.56.2 (#204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: https://github.com/googleapis/googleapis/commit/2921f9fb3bfbd16f6b2da0104373e2b47a80a65e Source-Link: https://github.com/googleapis/googleapis-gen/commit/6598ca8cbbf5226733a099c4506518a5af6ff74c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/cloud_build/async_client.py | 13 +- .../services/cloud_build/client.py | 25 +- .../services/cloud_build/transports/base.py | 10 +- .../services/cloud_build/transports/grpc.py | 6 +- .../cloud_build/transports/grpc_asyncio.py | 6 +- .../cloudbuild_v1/types/cloudbuild.py | 16 + .../gapic/cloudbuild_v1/test_cloud_build.py | 276 +++++++++++++----- 7 files changed, 250 insertions(+), 102 deletions(-) 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 index 7933689c..03df5242 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py index c0d51137..75127935 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore @@ -408,8 +410,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py index 53917a83..a7862c8d 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py @@ -18,11 +18,11 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py index 2b95df58..a0c583e2 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py @@ -16,9 +16,9 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py index b9c9b072..f01f6c0f 100644 --- 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 @@ -16,9 +16,9 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore -from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py index c76ddc37..4386720d 100644 --- a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py +++ b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py @@ -171,15 +171,18 @@ class RepoSource(proto.Message): The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax + This field is a member of `oneof`_ ``revision``. 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 + This field is a member of `oneof`_ ``revision``. commit_sha (str): Explicit commit SHA to build. + This field is a member of `oneof`_ ``revision``. dir_ (str): Directory, relative to the source root, in which to run the @@ -245,15 +248,18 @@ class Source(proto.Message): storage_source (google.cloud.devtools.cloudbuild_v1.types.StorageSource): If provided, get the source from this location in Google Cloud Storage. + This field is a member of `oneof`_ ``source``. repo_source (google.cloud.devtools.cloudbuild_v1.types.RepoSource): If provided, get the source from this location in a Cloud Source Repository. + This field is a member of `oneof`_ ``source``. storage_source_manifest (google.cloud.devtools.cloudbuild_v1.types.StorageSourceManifest): If provided, get the source from this manifest in Google Cloud Storage. This feature is in Preview; see description `here `__. + This field is a member of `oneof`_ ``source``. """ @@ -1238,13 +1244,16 @@ class BuildTrigger(proto.Message): Currently only available for GitHub App Triggers. + This field is a member of `oneof`_ ``build_template``. build (google.cloud.devtools.cloudbuild_v1.types.Build): Contents of the build template. + This field is a member of `oneof`_ ``build_template``. filename (str): Path, from the source root, to the build configuration file (i.e. cloudbuild.yaml). + This field is a member of `oneof`_ ``build_template``. create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when the trigger was @@ -1341,10 +1350,12 @@ class GitHubEventsConfig(proto.Message): builders is "cloud-builders". pull_request (google.cloud.devtools.cloudbuild_v1.types.PullRequestFilter): filter to match changes in pull requests. + This field is a member of `oneof`_ ``event``. push (google.cloud.devtools.cloudbuild_v1.types.PushFilter): filter to match changes in refs like branches, tags. + This field is a member of `oneof`_ ``event``. """ @@ -1406,6 +1417,7 @@ class WebhookConfig(proto.Message): secret (str): Required. Resource name for the secret required as a URL parameter. + This field is a member of `oneof`_ ``auth_method``. state (google.cloud.devtools.cloudbuild_v1.types.WebhookConfig.State): Potential issues with the underlying Pub/Sub @@ -1438,6 +1450,7 @@ class PullRequestFilter(proto.Message): The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax + This field is a member of `oneof`_ ``git_ref``. comment_control (google.cloud.devtools.cloudbuild_v1.types.PullRequestFilter.CommentControl): Configure builds to run whether a repository owner or @@ -1475,12 +1488,14 @@ class PushFilter(proto.Message): The syntax of the regular expressions accepted is the syntax accepted by RE2 and described at https://github.com/google/re2/wiki/Syntax + This field is a member of `oneof`_ ``git_ref``. 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 + This field is a member of `oneof`_ ``git_ref``. invert_regex (bool): When true, only trigger a build if the revision regex does @@ -1849,6 +1864,7 @@ class WorkerPool(proto.Message): Output only. ``WorkerPool`` state. private_pool_v1_config (google.cloud.devtools.cloudbuild_v1.types.PrivatePoolV1Config): Private Pool using a v1 configuration. + This field is a member of `oneof`_ ``config``. etag (str): Output only. Checksum computed by the server. diff --git a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py index 295b2dd0..cf9dad2d 100644 --- a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py +++ b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py @@ -571,8 +571,12 @@ def test_create_build_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].build == cloudbuild.Build(name="name_value") + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].build + mock_val = cloudbuild.Build(name="name_value") + assert arg == mock_val def test_create_build_flattened_error(): @@ -610,8 +614,12 @@ async def test_create_build_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].build == cloudbuild.Build(name="name_value") + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].build + mock_val = cloudbuild.Build(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -768,8 +776,12 @@ def test_get_build_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].id == "id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].id + mock_val = "id_value" + assert arg == mock_val def test_get_build_flattened_error(): @@ -801,8 +813,12 @@ async def test_get_build_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].id == "id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].id + mock_val = "id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -917,8 +933,12 @@ def test_list_builds_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].filter == "filter_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_builds_flattened_error(): @@ -956,8 +976,12 @@ async def test_list_builds_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].filter == "filter_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1235,8 +1259,12 @@ def test_cancel_build_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].id == "id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].id + mock_val = "id_value" + assert arg == mock_val def test_cancel_build_flattened_error(): @@ -1272,8 +1300,12 @@ async def test_cancel_build_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].id == "id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].id + mock_val = "id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1386,8 +1418,12 @@ def test_retry_build_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].id == "id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].id + mock_val = "id_value" + assert arg == mock_val def test_retry_build_flattened_error(): @@ -1425,8 +1461,12 @@ async def test_retry_build_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].id == "id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].id + mock_val = "id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1593,10 +1633,12 @@ def test_approve_build_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].approval_result == cloudbuild.ApprovalResult( - approver_account="approver_account_value" - ) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].approval_result + mock_val = cloudbuild.ApprovalResult(approver_account="approver_account_value") + assert arg == mock_val def test_approve_build_flattened_error(): @@ -1639,10 +1681,12 @@ async def test_approve_build_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].approval_result == cloudbuild.ApprovalResult( - approver_account="approver_account_value" - ) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].approval_result + mock_val = cloudbuild.ApprovalResult(approver_account="approver_account_value") + assert arg == mock_val @pytest.mark.asyncio @@ -1809,10 +1853,12 @@ def test_create_build_trigger_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger == cloudbuild.BuildTrigger( - resource_name="resource_name_value" - ) + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger + mock_val = cloudbuild.BuildTrigger(resource_name="resource_name_value") + assert arg == mock_val def test_create_build_trigger_flattened_error(): @@ -1853,10 +1899,12 @@ async def test_create_build_trigger_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger == cloudbuild.BuildTrigger( - resource_name="resource_name_value" - ) + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger + mock_val = cloudbuild.BuildTrigger(resource_name="resource_name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -2020,8 +2068,12 @@ def test_get_build_trigger_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger_id == "trigger_id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger_id + mock_val = "trigger_id_value" + assert arg == mock_val def test_get_build_trigger_flattened_error(): @@ -2061,8 +2113,12 @@ async def test_get_build_trigger_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger_id == "trigger_id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger_id + mock_val = "trigger_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2187,7 +2243,9 @@ def test_list_build_triggers_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val def test_list_build_triggers_flattened_error(): @@ -2223,7 +2281,9 @@ async def test_list_build_triggers_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2483,8 +2543,12 @@ def test_delete_build_trigger_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger_id == "trigger_id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger_id + mock_val = "trigger_id_value" + assert arg == mock_val def test_delete_build_trigger_flattened_error(): @@ -2522,8 +2586,12 @@ async def test_delete_build_trigger_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger_id == "trigger_id_value" + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger_id + mock_val = "trigger_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2689,11 +2757,15 @@ def test_update_build_trigger_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger_id == "trigger_id_value" - assert args[0].trigger == cloudbuild.BuildTrigger( - resource_name="resource_name_value" - ) + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger_id + mock_val = "trigger_id_value" + assert arg == mock_val + arg = args[0].trigger + mock_val = cloudbuild.BuildTrigger(resource_name="resource_name_value") + assert arg == mock_val def test_update_build_trigger_flattened_error(): @@ -2736,11 +2808,15 @@ async def test_update_build_trigger_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger_id == "trigger_id_value" - assert args[0].trigger == cloudbuild.BuildTrigger( - resource_name="resource_name_value" - ) + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger_id + mock_val = "trigger_id_value" + assert arg == mock_val + arg = args[0].trigger + mock_val = cloudbuild.BuildTrigger(resource_name="resource_name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -2864,9 +2940,15 @@ def test_run_build_trigger_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger_id == "trigger_id_value" - assert args[0].source == cloudbuild.RepoSource(project_id="project_id_value") + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger_id + mock_val = "trigger_id_value" + assert arg == mock_val + arg = args[0].source + mock_val = cloudbuild.RepoSource(project_id="project_id_value") + assert arg == mock_val def test_run_build_trigger_flattened_error(): @@ -2909,9 +2991,15 @@ async def test_run_build_trigger_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].project_id == "project_id_value" - assert args[0].trigger_id == "trigger_id_value" - assert args[0].source == cloudbuild.RepoSource(project_id="project_id_value") + arg = args[0].project_id + mock_val = "project_id_value" + assert arg == mock_val + arg = args[0].trigger_id + mock_val = "trigger_id_value" + assert arg == mock_val + arg = args[0].source + mock_val = cloudbuild.RepoSource(project_id="project_id_value") + assert arg == mock_val @pytest.mark.asyncio @@ -3176,9 +3264,15 @@ def test_create_worker_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].worker_pool == cloudbuild.WorkerPool(name="name_value") - assert args[0].worker_pool_id == "worker_pool_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].worker_pool + mock_val = cloudbuild.WorkerPool(name="name_value") + assert arg == mock_val + arg = args[0].worker_pool_id + mock_val = "worker_pool_id_value" + assert arg == mock_val def test_create_worker_pool_flattened_error(): @@ -3221,9 +3315,15 @@ async def test_create_worker_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].worker_pool == cloudbuild.WorkerPool(name="name_value") - assert args[0].worker_pool_id == "worker_pool_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].worker_pool + mock_val = cloudbuild.WorkerPool(name="name_value") + assert arg == mock_val + arg = args[0].worker_pool_id + mock_val = "worker_pool_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3413,7 +3513,9 @@ def test_get_worker_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_worker_pool_flattened_error(): @@ -3447,7 +3549,9 @@ async def test_get_worker_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3619,7 +3723,9 @@ def test_delete_worker_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_worker_pool_flattened_error(): @@ -3655,7 +3761,9 @@ async def test_delete_worker_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3834,8 +3942,12 @@ def test_update_worker_pool_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].worker_pool == cloudbuild.WorkerPool(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].worker_pool + mock_val = cloudbuild.WorkerPool(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_worker_pool_flattened_error(): @@ -3876,8 +3988,12 @@ async def test_update_worker_pool_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].worker_pool == cloudbuild.WorkerPool(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].worker_pool + mock_val = cloudbuild.WorkerPool(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -4055,7 +4171,9 @@ def test_list_worker_pools_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_list_worker_pools_flattened_error(): @@ -4091,7 +4209,9 @@ async def test_list_worker_pools_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio From 1c3a18928d0a7828700ba25399d665baccf38ade Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:07:29 -0500 Subject: [PATCH 03/21] chore(python): add .github/CODEOWNERS as a templated file (#205) Source-Link: https://github.com/googleapis/synthtool/commit/c5026b3217973a8db55db8ee85feee0e9a65e295 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/CODEOWNERS | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 108063d4..7519fa3a 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4ee57a76a176ede9087c14330c625a71553cf9c72828b2c0ca12f5338171ba60 + digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b867ca39..52a68a1c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,9 +3,10 @@ # # For syntax help see: # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax +# Note: This file is autogenerated. To make changes to the codeowner team, please update .repo-metadata.json. -# The @googleapis/yoshi-python is the default owner for changes in this repo -* @googleapis/yoshi-python @googleapis/cicd +# @googleapis/yoshi-python @googleapis/cicd are the default owners for changes in this repo +* @googleapis/yoshi-python @googleapis/cicd -# The python-samples-reviewers team is the default owner for samples changes -/samples/ @googleapis/python-samples-owners @googleapis/cicd +# @googleapis/python-samples-owners @googleapis/cicd are the default owners for samples changes +/samples/ @googleapis/python-samples-owners @googleapis/cicd From 10baedee7263288c9fe8394208ec45ed9bdfcf6c Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Thu, 18 Nov 2021 13:07:59 -0500 Subject: [PATCH 04/21] chore: update doc links from googleapis.dev to cloud.google.com (#206) --- .repo-metadata.json | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 8ec2c553..e10f6e5d 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -2,7 +2,7 @@ "name": "cloudbuild", "name_pretty": "Cloud Build", "product_documentation": "https://cloud.google.com/cloud-build/docs/", - "client_documentation": "https://googleapis.dev/python/cloudbuild/latest", + "client_documentation": "https://cloud.google.com/python/docs/reference/cloudbuild/latest", "issue_tracker": "https://issuetracker.google.com/savedsearches/5226584", "release_level": "ga", "language": "python", diff --git a/README.rst b/README.rst index fc03bea3..898327a3 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,7 @@ Python Client for Cloud Build API (`GA`_) .. _GA: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability .. _Cloud Build API: https://cloud.google.com/cloud-build -.. _Client Library Documentation: https://googleapis.dev/python/cloudbuild/latest +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/cloudbuild/latest .. _Product Documentation: https://cloud.google.com/cloud-build Quick Start From fef43a02c9e6973d4df1d1c2a54262caae52eb76 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 12 Dec 2021 12:00:43 -0500 Subject: [PATCH 05/21] chore: update python-docs-samples link to main branch (#207) Source-Link: https://github.com/googleapis/synthtool/commit/0941ef32b18aff0be34a40404f3971d9f51996e9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2f90537dd7df70f6b663cd654b1fa5dee483cf6a4edcfd46072b2775be8a23ec Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- samples/AUTHORING_GUIDE.md | 2 +- samples/CONTRIBUTING.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7519fa3a..0b3c8cd9 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 + digest: sha256:2f90537dd7df70f6b663cd654b1fa5dee483cf6a4edcfd46072b2775be8a23ec diff --git a/samples/AUTHORING_GUIDE.md b/samples/AUTHORING_GUIDE.md index 55c97b32..8249522f 100644 --- a/samples/AUTHORING_GUIDE.md +++ b/samples/AUTHORING_GUIDE.md @@ -1 +1 @@ -See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md \ No newline at end of file +See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md \ No newline at end of file diff --git a/samples/CONTRIBUTING.md b/samples/CONTRIBUTING.md index 34c882b6..f5fe2e6b 100644 --- a/samples/CONTRIBUTING.md +++ b/samples/CONTRIBUTING.md @@ -1 +1 @@ -See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/CONTRIBUTING.md \ No newline at end of file +See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/CONTRIBUTING.md \ No newline at end of file From 018ff94a3851432acf5142b037e29c1aa44c06a8 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 28 Dec 2021 13:20:36 -0500 Subject: [PATCH 06/21] chore: update .repo-metadata.json (#210) --- .repo-metadata.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index e10f6e5d..a795ee53 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/cloud-build/docs/", "client_documentation": "https://cloud.google.com/python/docs/reference/cloudbuild/latest", "issue_tracker": "https://issuetracker.google.com/savedsearches/5226584", - "release_level": "ga", + "release_level": "stable", "language": "python", "library_type": "GAPIC_AUTO", "repo": "googleapis/python-cloudbuild", @@ -12,5 +12,6 @@ "api_id": "cloudbuild.googleapis.com", "codeowner_team": "@googleapis/cicd", "requires_billing": false, - "default_version": "v1" + "default_version": "v1", + "api_shortname": "cloudbuild" } From 2bb1baa80edf64b87d8716a219a60098f058b9fd Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 6 Jan 2022 16:06:23 +0000 Subject: [PATCH 07/21] chore: use python-samples-reviewers (#212) --- .github/.OwlBot.lock.yaml | 2 +- .github/CODEOWNERS | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 0b3c8cd9..f33299dd 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:2f90537dd7df70f6b663cd654b1fa5dee483cf6a4edcfd46072b2775be8a23ec + digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 52a68a1c..318f5e28 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,5 +8,5 @@ # @googleapis/yoshi-python @googleapis/cicd are the default owners for changes in this repo * @googleapis/yoshi-python @googleapis/cicd -# @googleapis/python-samples-owners @googleapis/cicd are the default owners for samples changes -/samples/ @googleapis/python-samples-owners @googleapis/cicd +# @googleapis/python-samples-reviewers @googleapis/cicd are the default owners for samples changes +/samples/ @googleapis/python-samples-reviewers @googleapis/cicd From a0a0647cc0007e69a473b02e25b35138a5d3cb04 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 7 Jan 2022 13:54:08 -0500 Subject: [PATCH 08/21] chore: use gapic-generator-python 0.58.4 (#211) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: https://github.com/googleapis/googleapis/commit/73da6697f598f1ba30618924936a59f8e457ec89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../services/cloud_build/transports/base.py | 1 - .../gapic/cloudbuild_v1/test_cloud_build.py | 212 ++++++------------ 2 files changed, 69 insertions(+), 144 deletions(-) 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 index a7862c8d..5f436d46 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/base.py @@ -102,7 +102,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id diff --git a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py index cf9dad2d..7c013d6f 100644 --- a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py +++ b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py @@ -248,20 +248,20 @@ def test_cloud_build_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -318,7 +318,7 @@ def test_cloud_build_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -413,7 +413,7 @@ def test_cloud_build_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -444,7 +444,7 @@ def test_cloud_build_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -475,9 +475,8 @@ def test_cloud_build_client_client_options_from_dict(): ) -def test_create_build( - transport: str = "grpc", request_type=cloudbuild.CreateBuildRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.CreateBuildRequest, dict,]) +def test_create_build(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -501,10 +500,6 @@ def test_create_build( assert isinstance(response, future.Future) -def test_create_build_from_dict(): - test_create_build(request_type=dict) - - def test_create_build_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -636,7 +631,8 @@ async def test_create_build_flattened_error_async(): ) -def test_get_build(transport: str = "grpc", request_type=cloudbuild.GetBuildRequest): +@pytest.mark.parametrize("request_type", [cloudbuild.GetBuildRequest, dict,]) +def test_get_build(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -683,10 +679,6 @@ def test_get_build(transport: str = "grpc", request_type=cloudbuild.GetBuildRequ assert response.service_account == "service_account_value" -def test_get_build_from_dict(): - test_get_build(request_type=dict) - - def test_get_build_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -833,9 +825,8 @@ async def test_get_build_flattened_error_async(): ) -def test_list_builds( - transport: str = "grpc", request_type=cloudbuild.ListBuildsRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.ListBuildsRequest, dict,]) +def test_list_builds(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -862,10 +853,6 @@ def test_list_builds( assert response.next_page_token == "next_page_token_value" -def test_list_builds_from_dict(): - test_list_builds(request_type=dict) - - def test_list_builds_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -998,8 +985,10 @@ async def test_list_builds_flattened_error_async(): ) -def test_list_builds_pager(): - client = CloudBuildClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_builds_pager(transport_name: str = "grpc"): + client = CloudBuildClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_builds), "__call__") as call: @@ -1029,8 +1018,10 @@ def test_list_builds_pager(): assert all(isinstance(i, cloudbuild.Build) for i in results) -def test_list_builds_pages(): - client = CloudBuildClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_builds_pages(transport_name: str = "grpc"): + client = CloudBuildClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_builds), "__call__") as call: @@ -1117,9 +1108,8 @@ async def test_list_builds_async_pages(): assert page_.raw_page.next_page_token == token -def test_cancel_build( - transport: str = "grpc", request_type=cloudbuild.CancelBuildRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.CancelBuildRequest, dict,]) +def test_cancel_build(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1166,10 +1156,6 @@ def test_cancel_build( assert response.service_account == "service_account_value" -def test_cancel_build_from_dict(): - test_cancel_build(request_type=dict) - - def test_cancel_build_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1322,9 +1308,8 @@ async def test_cancel_build_flattened_error_async(): ) -def test_retry_build( - transport: str = "grpc", request_type=cloudbuild.RetryBuildRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.RetryBuildRequest, dict,]) +def test_retry_build(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1348,10 +1333,6 @@ def test_retry_build( assert isinstance(response, future.Future) -def test_retry_build_from_dict(): - test_retry_build(request_type=dict) - - def test_retry_build_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1483,9 +1464,8 @@ async def test_retry_build_flattened_error_async(): ) -def test_approve_build( - transport: str = "grpc", request_type=cloudbuild.ApproveBuildRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.ApproveBuildRequest, dict,]) +def test_approve_build(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1509,10 +1489,6 @@ def test_approve_build( assert isinstance(response, future.Future) -def test_approve_build_from_dict(): - test_approve_build(request_type=dict) - - def test_approve_build_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1705,9 +1681,8 @@ async def test_approve_build_flattened_error_async(): ) -def test_create_build_trigger( - transport: str = "grpc", request_type=cloudbuild.CreateBuildTriggerRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.CreateBuildTriggerRequest, dict,]) +def test_create_build_trigger(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1755,10 +1730,6 @@ def test_create_build_trigger( assert response.service_account == "service_account_value" -def test_create_build_trigger_from_dict(): - test_create_build_trigger(request_type=dict) - - def test_create_build_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -1921,9 +1892,8 @@ async def test_create_build_trigger_flattened_error_async(): ) -def test_get_build_trigger( - transport: str = "grpc", request_type=cloudbuild.GetBuildTriggerRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.GetBuildTriggerRequest, dict,]) +def test_get_build_trigger(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1971,10 +1941,6 @@ def test_get_build_trigger( assert response.service_account == "service_account_value" -def test_get_build_trigger_from_dict(): - test_get_build_trigger(request_type=dict) - - def test_get_build_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2135,9 +2101,8 @@ async def test_get_build_trigger_flattened_error_async(): ) -def test_list_build_triggers( - transport: str = "grpc", request_type=cloudbuild.ListBuildTriggersRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.ListBuildTriggersRequest, dict,]) +def test_list_build_triggers(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2166,10 +2131,6 @@ def test_list_build_triggers( assert response.next_page_token == "next_page_token_value" -def test_list_build_triggers_from_dict(): - test_list_build_triggers(request_type=dict) - - def test_list_build_triggers_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2298,8 +2259,10 @@ async def test_list_build_triggers_flattened_error_async(): ) -def test_list_build_triggers_pager(): - client = CloudBuildClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_build_triggers_pager(transport_name: str = "grpc"): + client = CloudBuildClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2335,8 +2298,10 @@ def test_list_build_triggers_pager(): assert all(isinstance(i, cloudbuild.BuildTrigger) for i in results) -def test_list_build_triggers_pages(): - client = CloudBuildClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_build_triggers_pages(transport_name: str = "grpc"): + client = CloudBuildClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2441,9 +2406,8 @@ async def test_list_build_triggers_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_build_trigger( - transport: str = "grpc", request_type=cloudbuild.DeleteBuildTriggerRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.DeleteBuildTriggerRequest, dict,]) +def test_delete_build_trigger(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2469,10 +2433,6 @@ def test_delete_build_trigger( assert response is None -def test_delete_build_trigger_from_dict(): - test_delete_build_trigger(request_type=dict) - - def test_delete_build_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2608,9 +2568,8 @@ async def test_delete_build_trigger_flattened_error_async(): ) -def test_update_build_trigger( - transport: str = "grpc", request_type=cloudbuild.UpdateBuildTriggerRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.UpdateBuildTriggerRequest, dict,]) +def test_update_build_trigger(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2658,10 +2617,6 @@ def test_update_build_trigger( assert response.service_account == "service_account_value" -def test_update_build_trigger_from_dict(): - test_update_build_trigger(request_type=dict) - - def test_update_build_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -2834,9 +2789,8 @@ async def test_update_build_trigger_flattened_error_async(): ) -def test_run_build_trigger( - transport: str = "grpc", request_type=cloudbuild.RunBuildTriggerRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.RunBuildTriggerRequest, dict,]) +def test_run_build_trigger(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2862,10 +2816,6 @@ def test_run_build_trigger( assert isinstance(response, future.Future) -def test_run_build_trigger_from_dict(): - test_run_build_trigger(request_type=dict) - - def test_run_build_trigger_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3017,9 +2967,10 @@ async def test_run_build_trigger_flattened_error_async(): ) -def test_receive_trigger_webhook( - transport: str = "grpc", request_type=cloudbuild.ReceiveTriggerWebhookRequest -): +@pytest.mark.parametrize( + "request_type", [cloudbuild.ReceiveTriggerWebhookRequest, dict,] +) +def test_receive_trigger_webhook(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3045,10 +2996,6 @@ def test_receive_trigger_webhook( assert isinstance(response, cloudbuild.ReceiveTriggerWebhookResponse) -def test_receive_trigger_webhook_from_dict(): - test_receive_trigger_webhook(request_type=dict) - - def test_receive_trigger_webhook_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3103,9 +3050,8 @@ async def test_receive_trigger_webhook_async_from_dict(): await test_receive_trigger_webhook_async(request_type=dict) -def test_create_worker_pool( - transport: str = "grpc", request_type=cloudbuild.CreateWorkerPoolRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.CreateWorkerPoolRequest, dict,]) +def test_create_worker_pool(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3131,10 +3077,6 @@ def test_create_worker_pool( assert isinstance(response, future.Future) -def test_create_worker_pool_from_dict(): - test_create_worker_pool(request_type=dict) - - def test_create_worker_pool_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3341,9 +3283,8 @@ async def test_create_worker_pool_flattened_error_async(): ) -def test_get_worker_pool( - transport: str = "grpc", request_type=cloudbuild.GetWorkerPoolRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.GetWorkerPoolRequest, dict,]) +def test_get_worker_pool(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3383,10 +3324,6 @@ def test_get_worker_pool( assert response.etag == "etag_value" -def test_get_worker_pool_from_dict(): - test_get_worker_pool(request_type=dict) - - def test_get_worker_pool_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3566,9 +3503,8 @@ async def test_get_worker_pool_flattened_error_async(): ) -def test_delete_worker_pool( - transport: str = "grpc", request_type=cloudbuild.DeleteWorkerPoolRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.DeleteWorkerPoolRequest, dict,]) +def test_delete_worker_pool(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3594,10 +3530,6 @@ def test_delete_worker_pool( assert isinstance(response, future.Future) -def test_delete_worker_pool_from_dict(): - test_delete_worker_pool(request_type=dict) - - def test_delete_worker_pool_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -3778,9 +3710,8 @@ async def test_delete_worker_pool_flattened_error_async(): ) -def test_update_worker_pool( - transport: str = "grpc", request_type=cloudbuild.UpdateWorkerPoolRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.UpdateWorkerPoolRequest, dict,]) +def test_update_worker_pool(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3806,10 +3737,6 @@ def test_update_worker_pool( assert isinstance(response, future.Future) -def test_update_worker_pool_from_dict(): - test_update_worker_pool(request_type=dict) - - def test_update_worker_pool_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4010,9 +3937,8 @@ async def test_update_worker_pool_flattened_error_async(): ) -def test_list_worker_pools( - transport: str = "grpc", request_type=cloudbuild.ListWorkerPoolsRequest -): +@pytest.mark.parametrize("request_type", [cloudbuild.ListWorkerPoolsRequest, dict,]) +def test_list_worker_pools(request_type, transport: str = "grpc"): client = CloudBuildClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4041,10 +3967,6 @@ def test_list_worker_pools( assert response.next_page_token == "next_page_token_value" -def test_list_worker_pools_from_dict(): - test_list_worker_pools(request_type=dict) - - def test_list_worker_pools_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. @@ -4226,8 +4148,10 @@ async def test_list_worker_pools_flattened_error_async(): ) -def test_list_worker_pools_pager(): - client = CloudBuildClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_worker_pools_pager(transport_name: str = "grpc"): + client = CloudBuildClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4266,8 +4190,10 @@ def test_list_worker_pools_pager(): assert all(isinstance(i, cloudbuild.WorkerPool) for i in results) -def test_list_worker_pools_pages(): - client = CloudBuildClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_worker_pools_pages(transport_name: str = "grpc"): + client = CloudBuildClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5095,7 +5021,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( From 532d4f9499b8aafaac0880fc5c4fe25e9304fb58 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 07:37:43 -0500 Subject: [PATCH 09/21] chore(samples): Add check for tests in directory (#214) Source-Link: https://github.com/googleapis/synthtool/commit/52aef91f8d25223d9dbdb4aebd94ba8eea2101f3 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- samples/snippets/noxfile.py | 70 +++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f33299dd..6b8a73b3 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 + digest: sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 93a9122c..3bbef5d5 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -14,6 +14,7 @@ from __future__ import print_function +import glob import os from pathlib import Path import sys @@ -184,37 +185,44 @@ def blacken(session: nox.sessions.Session) -> None: def _session_tests( session: nox.sessions.Session, post_install: Callable = None ) -> None: - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") - else: - session.install("-r", "requirements-test.txt") - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) + # check for presence of tests + test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + if len(test_list) == 0: + print("No tests found, skipping directory.") + else: + if TEST_CONFIG["pip_version_override"]: + pip_version = TEST_CONFIG["pip_version_override"] + session.install(f"pip=={pip_version}") + """Runs py.test for a particular project.""" + if os.path.exists("requirements.txt"): + if os.path.exists("constraints.txt"): + session.install("-r", "requirements.txt", "-c", "constraints.txt") + else: + session.install("-r", "requirements.txt") + + if os.path.exists("requirements-test.txt"): + if os.path.exists("constraints-test.txt"): + session.install( + "-r", "requirements-test.txt", "-c", "constraints-test.txt" + ) + else: + session.install("-r", "requirements-test.txt") + + if INSTALL_LIBRARY_FROM_SOURCE: + session.install("-e", _get_repo_root()) + + if post_install: + post_install(session) + + session.run( + "pytest", + *(PYTEST_COMMON_ARGS + session.posargs), + # Pytest will return 5 when no tests are collected. This can happen + # on travis where slow and flaky tests are excluded. + # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html + success_codes=[0, 5], + env=get_pytest_env_vars(), + ) @nox.session(python=ALL_VERSIONS) From c5aa0106113313245bca5ebb877955c2967fff30 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 13 Jan 2022 15:52:21 +0000 Subject: [PATCH 10/21] build: switch to release-please for tagging (#215) --- .github/.OwlBot.lock.yaml | 2 +- .github/release-please.yml | 1 + .github/release-trigger.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .github/release-trigger.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 6b8a73b3..ff5126c1 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 + digest: sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 diff --git a/.github/release-please.yml b/.github/release-please.yml index 4507ad05..466597e5 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1 +1,2 @@ releaseType: python +handleGHRelease: true diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 00000000..d4ca9418 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true From fa2529506e4a847a4e0658319f8ecee8d4ccb0be Mon Sep 17 00:00:00 2001 From: Dina Graves Portman Date: Thu, 13 Jan 2022 13:45:16 -0500 Subject: [PATCH 11/21] chore: add aap-dpes to codeowners (#216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: add aap-dpes to codeowners Removing cicd and adding aap-dpes. * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/CODEOWNERS | 8 ++++---- .repo-metadata.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 318f5e28..63a84c3b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,8 +5,8 @@ # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax # Note: This file is autogenerated. To make changes to the codeowner team, please update .repo-metadata.json. -# @googleapis/yoshi-python @googleapis/cicd are the default owners for changes in this repo -* @googleapis/yoshi-python @googleapis/cicd +# @googleapis/yoshi-python @googleapis/aap-dpes are the default owners for changes in this repo +* @googleapis/yoshi-python @googleapis/aap-dpes -# @googleapis/python-samples-reviewers @googleapis/cicd are the default owners for samples changes -/samples/ @googleapis/python-samples-reviewers @googleapis/cicd +# @googleapis/python-samples-reviewers @googleapis/aap-dpes are the default owners for samples changes +/samples/ @googleapis/python-samples-reviewers @googleapis/aap-dpes diff --git a/.repo-metadata.json b/.repo-metadata.json index a795ee53..3d20252b 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -10,7 +10,7 @@ "repo": "googleapis/python-cloudbuild", "distribution_name": "google-cloud-build", "api_id": "cloudbuild.googleapis.com", - "codeowner_team": "@googleapis/cicd", + "codeowner_team": "@googleapis/aap-dpes", "requires_billing": false, "default_version": "v1", "api_shortname": "cloudbuild" From 7e6ef6ba75366affa5a946881024de0cfc188813 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 14 Jan 2022 11:48:07 -0500 Subject: [PATCH 12/21] chore(python): update release.sh to use keystore (#217) Source-Link: https://github.com/googleapis/synthtool/commit/69fda12e2994f0b595a397e8bb6e3e9f380524eb Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/release.sh | 2 +- .kokoro/release/common.cfg | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ff5126c1..eecb84c2 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 + digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index 4d10112c..17105357 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") +TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1") cd github/python-cloudbuild python3 setup.py sdist bdist_wheel twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index 7163be78..1f35bece 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,8 +23,18 @@ env_vars: { value: "github/python-cloudbuild/.kokoro/release.sh" } +# Fetch PyPI password +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "google-cloud-pypi-token-keystore-1" + } + } +} + # Tokens needed to report release status back to GitHub env_vars: { key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } From 93130054626e2a9ccb231b5800705ff70a7cb173 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 18 Jan 2022 19:55:53 -0500 Subject: [PATCH 13/21] chore(python): Noxfile recognizes that tests can live in a folder (#219) Source-Link: https://github.com/googleapis/synthtool/commit/4760d8dce1351d93658cb11d02a1b7ceb23ae5d7 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- samples/snippets/noxfile.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index eecb84c2..52d79c11 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 + digest: sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 3bbef5d5..20cdfc62 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -187,6 +187,7 @@ def _session_tests( ) -> None: # check for presence of tests test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + test_list.extend(glob.glob("tests")) if len(test_list) == 0: print("No tests found, skipping directory.") else: From ac015aecde5a458f61bbda1a5783a13147b81c33 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 20 Jan 2022 14:50:36 -0500 Subject: [PATCH 14/21] ci(python): run lint / unit tests / docs as GH actions (#220) Source-Link: https://github.com/googleapis/synthtool/commit/57be0cdb0b94e1669cee0ca38d790de1dfdbcd44 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 15 ++++++++- .github/workflows/docs.yml | 38 +++++++++++++++++++++++ .github/workflows/lint.yml | 25 +++++++++++++++ .github/workflows/unittest.yml | 57 ++++++++++++++++++++++++++++++++++ 4 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unittest.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 52d79c11..8cb43804 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,16 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 + digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..f7b8344c --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +on: + pull_request: + branches: + - main +name: docs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docs + run: | + nox -s docs + docfx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docfx + run: | + nox -s docfx diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..1e8b05c3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +on: + pull_request: + branches: + - main +name: lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run lint + run: | + nox -s lint + - name: Run lint_setup_py + run: | + nox -s lint_setup_py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 00000000..074ee250 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,57 @@ +on: + pull_request: + branches: + - main +name: unittest +jobs: + unit: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8', '3.9', '3.10'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run unit tests + env: + COVERAGE_FILE: .coverage-${{ matrix.python }} + run: | + nox -s unit-${{ matrix.python }} + - name: Upload coverage results + uses: actions/upload-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + + cover: + runs-on: ubuntu-latest + needs: + - unit + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install coverage + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install coverage + - name: Download coverage results + uses: actions/download-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-results/ + - name: Report coverage results + run: | + coverage combine .coverage-results/.coverage* + coverage report --show-missing --fail-under=100 From c6fee2518549224ba6752c2f7ab963b5ad9fae27 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 22 Jan 2022 10:25:24 -0500 Subject: [PATCH 15/21] chore(python): set coverage level to 100% (#221) * chore(python): use cov_level in unittest gh action Source-Link: https://github.com/googleapis/synthtool/commit/e5aaa84b1dda1829c54d4696827817f133ed9780 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:d22cd2ddce65fdac6986f115563faf2fc81482b09dfbea83ac2808c92ecfdff0 * set coverage to 100% Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 2 +- noxfile.py | 2 +- owlbot.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 8cb43804..39ad3cec 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 + digest: sha256:d22cd2ddce65fdac6986f115563faf2fc81482b09dfbea83ac2808c92ecfdff0 diff --git a/noxfile.py b/noxfile.py index de41c6bf..2a2001c4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -175,7 +175,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=99") + session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") diff --git a/owlbot.py b/owlbot.py index f3ca04ae..8a14a8ef 100644 --- a/owlbot.py +++ b/owlbot.py @@ -38,7 +38,7 @@ templated_files = common.py_library( samples=False, # set to True only if there are samples microgenerator=True, - cov_level=99, + cov_level=100, ) s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file From 9c62e7e60b57ac213e98d6df05f9d9a748134f57 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 12:16:29 -0500 Subject: [PATCH 16/21] feat: add api key support (#222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: upgrade gapic-generator-java, gax-java and gapic-generator-python PiperOrigin-RevId: 423842556 Source-Link: https://github.com/googleapis/googleapis/commit/a616ca08f4b1416abbac7bc5dd6d61c791756a81 Source-Link: https://github.com/googleapis/googleapis-gen/commit/29b938c58c1e51d019f2ee539d55dc0a3c86a905 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjliOTM4YzU4YzFlNTFkMDE5ZjJlZTUzOWQ1NWRjMGEzYzg2YTkwNSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/cloud_build/async_client.py | 38 +++++- .../services/cloud_build/client.py | 127 ++++++++++++------ .../gapic/cloudbuild_v1/test_cloud_build.py | 124 +++++++++++++++++ 3 files changed, 245 insertions(+), 44 deletions(-) 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 index 03df5242..61fd1340 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -132,6 +132,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return CloudBuildClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + @property def transport(self) -> CloudBuildTransport: """Returns the transport used by the client instance. diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py index 75127935..416a6584 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py @@ -359,6 +359,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + def __init__( self, *, @@ -409,57 +476,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. if isinstance(transport, CloudBuildTransport): # transport is a CloudBuildTransport instance. - if credentials or client_options.credentials_file: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -471,6 +503,15 @@ def __init__( ) self._transport = transport else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + Transport = type(self).get_transport_class(transport) self._transport = Transport( credentials=credentials, diff --git a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py index 7c013d6f..58f7ca4e 100644 --- a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py +++ b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py @@ -395,6 +395,83 @@ def test_cloud_build_client_mtls_env_auto( ) +@pytest.mark.parametrize("client_class", [CloudBuildClient, CloudBuildAsyncClient]) +@mock.patch.object( + CloudBuildClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CloudBuildClient) +) +@mock.patch.object( + CloudBuildAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CloudBuildAsyncClient), +) +def test_cloud_build_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + @pytest.mark.parametrize( "client_class,transport_class,transport_name", [ @@ -4318,6 +4395,23 @@ def test_credentials_transport_error(): transport=transport, ) + # It is an error to provide an api_key and a transport instance. + transport = transports.CloudBuildGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CloudBuildClient(client_options=options, transport=transport,) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = CloudBuildClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + # It is an error to provide scopes and a transport instance. transport = transports.CloudBuildGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), @@ -5086,3 +5180,33 @@ def test_client_ctx(): with client: pass close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + (CloudBuildClient, transports.CloudBuildGrpcTransport), + (CloudBuildAsyncClient, transports.CloudBuildGrpcAsyncIOTransport), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) From 2af2b18e87de591b72ee9279a8a3cd54171cb725 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 22:01:04 +0000 Subject: [PATCH 17/21] chore: use gapic-generator-python 0.62.1 (#226) - [x] Regenerate this pull request now. fix: resolve DuplicateCredentialArgs error when using credentials_file committer: parthea PiperOrigin-RevId: 425964861 Source-Link: https://github.com/googleapis/googleapis/commit/84b1a5a4f6fb2d04905be58e586b8a7a4310a8cf Source-Link: https://github.com/googleapis/googleapis-gen/commit/4fb761bbd8506ac156f49bac5f18306aa8eb3aa8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZiNzYxYmJkODUwNmFjMTU2ZjQ5YmFjNWYxODMwNmFhOGViM2FhOCJ9 --- .../services/cloud_build/async_client.py | 34 ++++----- .../services/cloud_build/client.py | 34 ++++----- .../services/cloud_build/transports/grpc.py | 7 +- .../cloud_build/transports/grpc_asyncio.py | 7 +- .../cloudbuild_v1/types/cloudbuild.py | 8 +-- .../gapic/cloudbuild_v1/test_cloud_build.py | 70 ++++++++++++++++++- 6 files changed, 115 insertions(+), 45 deletions(-) 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 index 61fd1340..b6e57628 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py @@ -295,7 +295,7 @@ async def create_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, build]) if request is not None and has_flattened_params: @@ -398,7 +398,7 @@ async def get_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, id]) if request is not None and has_flattened_params: @@ -484,7 +484,7 @@ async def list_builds( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, filter]) if request is not None and has_flattened_params: @@ -591,7 +591,7 @@ async def cancel_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, id]) if request is not None and has_flattened_params: @@ -717,7 +717,7 @@ async def retry_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, id]) if request is not None and has_flattened_params: @@ -827,7 +827,7 @@ async def approve_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, approval_result]) if request is not None and has_flattened_params: @@ -917,7 +917,7 @@ async def create_build_trigger( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger]) if request is not None and has_flattened_params: @@ -995,7 +995,7 @@ async def get_build_trigger( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger_id]) if request is not None and has_flattened_params: @@ -1076,7 +1076,7 @@ async def list_build_triggers( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id]) if request is not None and has_flattened_params: @@ -1158,7 +1158,7 @@ async def delete_build_trigger( 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 + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger_id]) if request is not None and has_flattened_params: @@ -1249,7 +1249,7 @@ async def update_build_trigger( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger_id, trigger]) if request is not None and has_flattened_params: @@ -1353,7 +1353,7 @@ async def run_build_trigger( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger_id, source]) if request is not None and has_flattened_params: @@ -1511,7 +1511,7 @@ async def create_worker_pool( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, worker_pool, worker_pool_id]) if request is not None and has_flattened_params: @@ -1608,7 +1608,7 @@ async def get_worker_pool( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1702,7 +1702,7 @@ async def delete_worker_pool( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1808,7 +1808,7 @@ async def update_worker_pool( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([worker_pool, update_mask]) if request is not None and has_flattened_params: @@ -1893,7 +1893,7 @@ async def list_worker_pools( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py index 416a6584..4d789d42 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py @@ -591,7 +591,7 @@ def create_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, build]) if request is not None and has_flattened_params: @@ -694,7 +694,7 @@ def get_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, id]) if request is not None and has_flattened_params: @@ -770,7 +770,7 @@ def list_builds( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, filter]) if request is not None and has_flattened_params: @@ -867,7 +867,7 @@ def cancel_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, id]) if request is not None and has_flattened_params: @@ -993,7 +993,7 @@ def retry_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, id]) if request is not None and has_flattened_params: @@ -1103,7 +1103,7 @@ def approve_build( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, approval_result]) if request is not None and has_flattened_params: @@ -1193,7 +1193,7 @@ def create_build_trigger( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger]) if request is not None and has_flattened_params: @@ -1271,7 +1271,7 @@ def get_build_trigger( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger_id]) if request is not None and has_flattened_params: @@ -1342,7 +1342,7 @@ def list_build_triggers( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id]) if request is not None and has_flattened_params: @@ -1414,7 +1414,7 @@ def delete_build_trigger( 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 + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger_id]) if request is not None and has_flattened_params: @@ -1495,7 +1495,7 @@ def update_build_trigger( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger_id, trigger]) if request is not None and has_flattened_params: @@ -1599,7 +1599,7 @@ def run_build_trigger( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([project_id, trigger_id, source]) if request is not None and has_flattened_params: @@ -1758,7 +1758,7 @@ def create_worker_pool( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, worker_pool, worker_pool_id]) if request is not None and has_flattened_params: @@ -1855,7 +1855,7 @@ def get_worker_pool( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1939,7 +1939,7 @@ def delete_worker_pool( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2045,7 +2045,7 @@ def update_worker_pool( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([worker_pool, update_mask]) if request is not None and has_flattened_params: @@ -2130,7 +2130,7 @@ def list_worker_pools( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: 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 index a0c583e2..950b2220 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc.py @@ -169,8 +169,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -243,7 +246,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsClient(self.grpc_channel) diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/transports/grpc_asyncio.py index f01f6c0f..c56af9da 100644 --- 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 @@ -214,8 +214,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -245,7 +248,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( self.grpc_channel diff --git a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py index 4386720d..9b7a7bdf 100644 --- a/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py +++ b/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py @@ -1341,13 +1341,13 @@ class GitHubEventsConfig(proto.Message): owner (str): Owner of the repository. For example: The owner for - https://github.com/googlecloudplatform/cloud- - builders is "googlecloudplatform". + 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". + https://github.com/googlecloudplatform/cloud-builders + is "cloud-builders". pull_request (google.cloud.devtools.cloudbuild_v1.types.PullRequestFilter): filter to match changes in pull requests. diff --git a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py index 58f7ca4e..3ffc6a10 100644 --- a/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py +++ b/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py @@ -30,6 +30,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import operation from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 from google.api_core import path_template @@ -504,21 +505,23 @@ def test_cloud_build_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ - (CloudBuildClient, transports.CloudBuildGrpcTransport, "grpc"), + (CloudBuildClient, transports.CloudBuildGrpcTransport, "grpc", grpc_helpers), ( CloudBuildAsyncClient, transports.CloudBuildGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_cloud_build_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -552,6 +555,67 @@ def test_cloud_build_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + (CloudBuildClient, transports.CloudBuildGrpcTransport, "grpc", grpc_helpers), + ( + CloudBuildAsyncClient, + transports.CloudBuildGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_cloud_build_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "cloudbuild.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="cloudbuild.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize("request_type", [cloudbuild.CreateBuildRequest, dict,]) def test_create_build(request_type, transport: str = "grpc"): client = CloudBuildClient( From a4414361e34f61ca0ac022b10f5978cd1240d516 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 7 Feb 2022 17:18:42 +0100 Subject: [PATCH 18/21] chore(deps): update all dependencies (#224) --- samples/snippets/requirements-test.txt | 2 +- samples/snippets/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index 9299a7a8..618cbcc9 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==6.2.5 \ No newline at end of file +pytest==7.0.0 \ No newline at end of file diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 7d17c9be..d6a7af69 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1,2 +1,2 @@ google-cloud-build==3.7.1 -google-auth==2.3.3 \ No newline at end of file +google-auth==2.6.0 \ No newline at end of file From 30df02a2db3975d4f0eace39f34bad5ed1a88d2b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 09:28:40 -0700 Subject: [PATCH 19/21] chore: use gapic-generator-python 0.63.2 (#228) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: https://github.com/googleapis/googleapis/commit/55b9e1e0b3106c850d13958352bc0751147b6b15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bf4e86b753f42cb0edb1fd51fbe840d7da0a1cde Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmY0ZTg2Yjc1M2Y0MmNiMGVkYjFmZDUxZmJlODQwZDdkYTBhMWNkZSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/cloud_build/async_client.py | 395 ++++ .../services/cloud_build/client.py | 413 +++++ ...uild_v1_cloud_build_approve_build_async.py | 49 + ...build_v1_cloud_build_approve_build_sync.py | 49 + ...build_v1_cloud_build_cancel_build_async.py | 46 + ...dbuild_v1_cloud_build_cancel_build_sync.py | 46 + ...build_v1_cloud_build_create_build_async.py | 49 + ...dbuild_v1_cloud_build_create_build_sync.py | 49 + ..._cloud_build_create_build_trigger_async.py | 49 + ...1_cloud_build_create_build_trigger_sync.py | 49 + ...v1_cloud_build_create_worker_pool_async.py | 50 + ..._v1_cloud_build_create_worker_pool_sync.py | 50 + ..._cloud_build_delete_build_trigger_async.py | 44 + ...1_cloud_build_delete_build_trigger_sync.py | 44 + ...v1_cloud_build_delete_worker_pool_async.py | 49 + ..._v1_cloud_build_delete_worker_pool_sync.py | 49 + ...oudbuild_v1_cloud_build_get_build_async.py | 46 + ...loudbuild_v1_cloud_build_get_build_sync.py | 46 + ..._v1_cloud_build_get_build_trigger_async.py | 46 + ...d_v1_cloud_build_get_build_trigger_sync.py | 46 + ...ld_v1_cloud_build_get_worker_pool_async.py | 45 + ...ild_v1_cloud_build_get_worker_pool_sync.py | 45 + ...1_cloud_build_list_build_triggers_async.py | 46 + ...v1_cloud_build_list_build_triggers_sync.py | 46 + ...dbuild_v1_cloud_build_list_builds_async.py | 46 + ...udbuild_v1_cloud_build_list_builds_sync.py | 46 + ..._v1_cloud_build_list_worker_pools_async.py | 46 + ...d_v1_cloud_build_list_worker_pools_sync.py | 46 + ...oud_build_receive_trigger_webhook_async.py | 44 + ...loud_build_receive_trigger_webhook_sync.py | 44 + ...dbuild_v1_cloud_build_retry_build_async.py | 50 + ...udbuild_v1_cloud_build_retry_build_sync.py | 50 + ..._v1_cloud_build_run_build_trigger_async.py | 50 + ...d_v1_cloud_build_run_build_trigger_sync.py | 50 + ..._cloud_build_update_build_trigger_async.py | 50 + ...1_cloud_build_update_build_trigger_sync.py | 50 + ...v1_cloud_build_update_worker_pool_async.py | 48 + ..._v1_cloud_build_update_worker_pool_sync.py | 48 + .../snippet_metadata_cloudbuild_v1.json | 1602 +++++++++++++++++ 39 files changed, 4116 insertions(+) create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_sync.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_async.py create mode 100644 samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_sync.py create mode 100644 samples/generated_samples/snippet_metadata_cloudbuild_v1.json 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 index b6e57628..cfb39f38 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py @@ -244,6 +244,30 @@ async def create_build( the build ID. Pass the build ID to ``GetBuild`` to determine the build status (such as ``SUCCESS`` or ``FAILURE``). + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_create_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CreateBuildRequest( + project_id="project_id_value", + ) + + # Make the request + operation = client.create_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.CreateBuildRequest, dict]): The request object. Request to create a new build. @@ -351,6 +375,27 @@ async def get_build( ``SUCCESS``, ``FAILURE``, or ``WORKING``), and timing information. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_get_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + response = client.get_build(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.GetBuildRequest, dict]): The request object. Request to get a build. @@ -454,6 +499,27 @@ async def list_builds( Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_list_builds(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListBuildsRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_builds(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ListBuildsRequest, dict]): The request object. Request to list builds. @@ -544,6 +610,26 @@ async def cancel_build( ) -> cloudbuild.Build: r"""Cancels a build in progress. + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_cancel_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CancelBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + response = client.cancel_build(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.CancelBuildRequest, dict]): The request object. Request to cancel an ongoing build. @@ -664,6 +750,31 @@ async def retry_build( available depending on the bucket's lifecycle management settings. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_retry_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.RetryBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + operation = client.retry_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.RetryBuildRequest, dict]): The request object. Specifies a build to retry. @@ -773,6 +884,30 @@ async def approve_build( If rejected, the returned LRO will be immediately done. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_approve_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ApproveBuildRequest( + name="name_value", + ) + + # Make the request + operation = client.approve_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ApproveBuildRequest, dict]): The request object. Request to approve or reject a @@ -887,6 +1022,30 @@ async def create_build_trigger( This API is experimental. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_create_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + trigger = cloudbuild_v1.BuildTrigger() + trigger.autodetect = True + + request = cloudbuild_v1.CreateBuildTriggerRequest( + project_id="project_id_value", + trigger=trigger, + ) + + # Make the request + response = client.create_build_trigger(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.CreateBuildTriggerRequest, dict]): The request object. Request to create a new @@ -963,6 +1122,27 @@ async def get_build_trigger( This API is experimental. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_get_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + response = client.get_build_trigger(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.GetBuildTriggerRequest, dict]): The request object. Returns the `BuildTrigger` with the @@ -1050,6 +1230,27 @@ async def list_build_triggers( This API is experimental. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_list_build_triggers(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListBuildTriggersRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_build_triggers(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ListBuildTriggersRequest, dict]): The request object. Request to list existing @@ -1136,6 +1337,24 @@ async def delete_build_trigger( This API is experimental. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_delete_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.DeleteBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + client.delete_build_trigger(request=request) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.DeleteBuildTriggerRequest, dict]): The request object. Request to delete a `BuildTrigger`. @@ -1214,6 +1433,31 @@ async def update_build_trigger( This API is experimental. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_update_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + trigger = cloudbuild_v1.BuildTrigger() + trigger.autodetect = True + + request = cloudbuild_v1.UpdateBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + trigger=trigger, + ) + + # Make the request + response = client.update_build_trigger(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.UpdateBuildTriggerRequest, dict]): The request object. Request to update an existing @@ -1296,6 +1540,30 @@ async def run_build_trigger( ) -> operation_async.AsyncOperation: r"""Runs a ``BuildTrigger`` at a particular source revision. + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_run_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.RunBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + operation = client.run_build_trigger(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.RunBuildTriggerRequest, dict]): The request object. Specifies a build trigger to run and @@ -1406,6 +1674,25 @@ async def receive_trigger_webhook( r"""ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_receive_trigger_webhook(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ReceiveTriggerWebhookRequest( + ) + + # Make the request + response = client.receive_trigger_webhook(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ReceiveTriggerWebhookRequest, dict]): The request object. ReceiveTriggerWebhookRequest @@ -1453,6 +1740,30 @@ async def create_worker_pool( ) -> operation_async.AsyncOperation: r"""Creates a ``WorkerPool``. + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_create_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CreateWorkerPoolRequest( + parent="parent_value", + worker_pool_id="worker_pool_id_value", + ) + + # Make the request + operation = client.create_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.CreateWorkerPoolRequest, dict]): The request object. Request to create a new @@ -1570,6 +1881,25 @@ async def get_worker_pool( ) -> cloudbuild.WorkerPool: r"""Returns details of a ``WorkerPool``. + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_get_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetWorkerPoolRequest( + name="name_value", + ) + + # Make the request + response = client.get_worker_pool(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.GetWorkerPoolRequest, dict]): The request object. Request to get a `WorkerPool` with @@ -1665,6 +1995,29 @@ async def delete_worker_pool( ) -> operation_async.AsyncOperation: r"""Deletes a ``WorkerPool``. + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_delete_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.DeleteWorkerPoolRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.DeleteWorkerPoolRequest, dict]): The request object. Request to delete a `WorkerPool`. @@ -1758,6 +2111,28 @@ async def update_worker_pool( ) -> operation_async.AsyncOperation: r"""Updates a ``WorkerPool``. + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_update_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.UpdateWorkerPoolRequest( + ) + + # Make the request + operation = client.update_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.UpdateWorkerPoolRequest, dict]): The request object. Request to update a `WorkerPool`. @@ -1867,6 +2242,26 @@ async def list_worker_pools( ) -> pagers.ListWorkerPoolsAsyncPager: r"""Lists ``WorkerPool``\ s. + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_list_worker_pools(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListWorkerPoolsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_worker_pools(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ListWorkerPoolsRequest, dict]): The request object. Request to list `WorkerPool`\s. diff --git a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py index 4d789d42..a6fd9f68 100644 --- a/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py +++ b/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py @@ -540,6 +540,31 @@ def create_build( the build ID. Pass the build ID to ``GetBuild`` to determine the build status (such as ``SUCCESS`` or ``FAILURE``). + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_create_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CreateBuildRequest( + project_id="project_id_value", + ) + + # Make the request + operation = client.create_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.CreateBuildRequest, dict]): The request object. Request to create a new build. @@ -647,6 +672,28 @@ def get_build( ``SUCCESS``, ``FAILURE``, or ``WORKING``), and timing information. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_get_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + response = client.get_build(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.GetBuildRequest, dict]): The request object. Request to get a build. @@ -740,6 +787,28 @@ def list_builds( Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_list_builds(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListBuildsRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_builds(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ListBuildsRequest, dict]): The request object. Request to list builds. @@ -820,6 +889,27 @@ def cancel_build( ) -> cloudbuild.Build: r"""Cancels a build in progress. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_cancel_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CancelBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + response = client.cancel_build(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.CancelBuildRequest, dict]): The request object. Request to cancel an ongoing build. @@ -940,6 +1030,32 @@ def retry_build( available depending on the bucket's lifecycle management settings. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_retry_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.RetryBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + operation = client.retry_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.RetryBuildRequest, dict]): The request object. Specifies a build to retry. @@ -1049,6 +1165,31 @@ def approve_build( If rejected, the returned LRO will be immediately done. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_approve_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ApproveBuildRequest( + name="name_value", + ) + + # Make the request + operation = client.approve_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ApproveBuildRequest, dict]): The request object. Request to approve or reject a @@ -1163,6 +1304,31 @@ def create_build_trigger( This API is experimental. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_create_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + trigger = cloudbuild_v1.BuildTrigger() + trigger.autodetect = True + + request = cloudbuild_v1.CreateBuildTriggerRequest( + project_id="project_id_value", + trigger=trigger, + ) + + # Make the request + response = client.create_build_trigger(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.CreateBuildTriggerRequest, dict]): The request object. Request to create a new @@ -1239,6 +1405,28 @@ def get_build_trigger( This API is experimental. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_get_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + response = client.get_build_trigger(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.GetBuildTriggerRequest, dict]): The request object. Returns the `BuildTrigger` with the @@ -1316,6 +1504,28 @@ def list_build_triggers( This API is experimental. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_list_build_triggers(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListBuildTriggersRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_build_triggers(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ListBuildTriggersRequest, dict]): The request object. Request to list existing @@ -1392,6 +1602,25 @@ def delete_build_trigger( This API is experimental. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_delete_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.DeleteBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + client.delete_build_trigger(request=request) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.DeleteBuildTriggerRequest, dict]): The request object. Request to delete a `BuildTrigger`. @@ -1460,6 +1689,32 @@ def update_build_trigger( This API is experimental. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_update_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + trigger = cloudbuild_v1.BuildTrigger() + trigger.autodetect = True + + request = cloudbuild_v1.UpdateBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + trigger=trigger, + ) + + # Make the request + response = client.update_build_trigger(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.UpdateBuildTriggerRequest, dict]): The request object. Request to update an existing @@ -1542,6 +1797,31 @@ def run_build_trigger( ) -> operation.Operation: r"""Runs a ``BuildTrigger`` at a particular source revision. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_run_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.RunBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + operation = client.run_build_trigger(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.RunBuildTriggerRequest, dict]): The request object. Specifies a build trigger to run and @@ -1652,6 +1932,26 @@ def receive_trigger_webhook( r"""ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger. + + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_receive_trigger_webhook(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ReceiveTriggerWebhookRequest( + ) + + # Make the request + response = client.receive_trigger_webhook(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ReceiveTriggerWebhookRequest, dict]): The request object. ReceiveTriggerWebhookRequest @@ -1700,6 +2000,31 @@ def create_worker_pool( ) -> operation.Operation: r"""Creates a ``WorkerPool``. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_create_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CreateWorkerPoolRequest( + parent="parent_value", + worker_pool_id="worker_pool_id_value", + ) + + # Make the request + operation = client.create_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.CreateWorkerPoolRequest, dict]): The request object. Request to create a new @@ -1817,6 +2142,26 @@ def get_worker_pool( ) -> cloudbuild.WorkerPool: r"""Returns details of a ``WorkerPool``. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_get_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetWorkerPoolRequest( + name="name_value", + ) + + # Make the request + response = client.get_worker_pool(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.GetWorkerPoolRequest, dict]): The request object. Request to get a `WorkerPool` with @@ -1902,6 +2247,30 @@ def delete_worker_pool( ) -> operation.Operation: r"""Deletes a ``WorkerPool``. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_delete_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.DeleteWorkerPoolRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.DeleteWorkerPoolRequest, dict]): The request object. Request to delete a `WorkerPool`. @@ -1995,6 +2364,29 @@ def update_worker_pool( ) -> operation.Operation: r"""Updates a ``WorkerPool``. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_update_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.UpdateWorkerPoolRequest( + ) + + # Make the request + operation = client.update_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.UpdateWorkerPoolRequest, dict]): The request object. Request to update a `WorkerPool`. @@ -2104,6 +2496,27 @@ def list_worker_pools( ) -> pagers.ListWorkerPoolsPager: r"""Lists ``WorkerPool``\ s. + + .. code-block:: + + from google.cloud.devtools import cloudbuild_v1 + + def sample_list_worker_pools(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListWorkerPoolsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_worker_pools(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.devtools.cloudbuild_v1.types.ListWorkerPoolsRequest, dict]): The request object. Request to list `WorkerPool`\s. diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_async.py new file mode 100644 index 00000000..193893bb --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ApproveBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ApproveBuild_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_approve_build(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ApproveBuildRequest( + name="name_value", + ) + + # Make the request + operation = client.approve_build(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ApproveBuild_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_sync.py new file mode 100644 index 00000000..0d9e5fb1 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ApproveBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ApproveBuild_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_approve_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ApproveBuildRequest( + name="name_value", + ) + + # Make the request + operation = client.approve_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ApproveBuild_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_async.py new file mode 100644 index 00000000..8d9908fd --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CancelBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_CancelBuild_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_cancel_build(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CancelBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + response = await client.cancel_build(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_CancelBuild_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_sync.py new file mode 100644 index 00000000..345a62ad --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CancelBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_CancelBuild_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_cancel_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CancelBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + response = client.cancel_build(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_CancelBuild_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_async.py new file mode 100644 index 00000000..5a028f7d --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuild_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_create_build(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CreateBuildRequest( + project_id="project_id_value", + ) + + # Make the request + operation = client.create_build(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuild_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_sync.py new file mode 100644 index 00000000..468360a7 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuild_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_create_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CreateBuildRequest( + project_id="project_id_value", + ) + + # Make the request + operation = client.create_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuild_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_async.py new file mode 100644 index 00000000..5b32934d --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuildTrigger_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_create_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + trigger = cloudbuild_v1.BuildTrigger() + trigger.autodetect = True + + request = cloudbuild_v1.CreateBuildTriggerRequest( + project_id="project_id_value", + trigger=trigger, + ) + + # Make the request + response = await client.create_build_trigger(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuildTrigger_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_sync.py new file mode 100644 index 00000000..3ccbb1c9 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuildTrigger_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_create_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + trigger = cloudbuild_v1.BuildTrigger() + trigger.autodetect = True + + request = cloudbuild_v1.CreateBuildTriggerRequest( + project_id="project_id_value", + trigger=trigger, + ) + + # Make the request + response = client.create_build_trigger(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuildTrigger_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_async.py new file mode 100644 index 00000000..490971e2 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateWorkerPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateWorkerPool_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_create_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CreateWorkerPoolRequest( + parent="parent_value", + worker_pool_id="worker_pool_id_value", + ) + + # Make the request + operation = client.create_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateWorkerPool_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_sync.py new file mode 100644 index 00000000..2ff1eb53 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateWorkerPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateWorkerPool_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_create_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.CreateWorkerPoolRequest( + parent="parent_value", + worker_pool_id="worker_pool_id_value", + ) + + # Make the request + operation = client.create_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateWorkerPool_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_async.py new file mode 100644 index 00000000..2ee6a1f8 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteBuildTrigger_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_delete_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.DeleteBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + await client.delete_build_trigger(request=request) + + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteBuildTrigger_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_sync.py new file mode 100644 index 00000000..53fbd095 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteBuildTrigger_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_delete_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.DeleteBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + client.delete_build_trigger(request=request) + + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteBuildTrigger_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_async.py new file mode 100644 index 00000000..5c8d10e3 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_async.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteWorkerPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteWorkerPool_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_delete_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.DeleteWorkerPoolRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteWorkerPool_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_sync.py new file mode 100644 index 00000000..f6eede1b --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_sync.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for DeleteWorkerPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteWorkerPool_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_delete_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.DeleteWorkerPoolRequest( + name="name_value", + ) + + # Make the request + operation = client.delete_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteWorkerPool_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_async.py new file mode 100644 index 00000000..cfa93e72 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuild_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_get_build(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + response = await client.get_build(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuild_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_sync.py new file mode 100644 index 00000000..2d1ec944 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuild_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_get_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + response = client.get_build(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuild_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_async.py new file mode 100644 index 00000000..80bd1f0e --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuildTrigger_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_get_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + response = await client.get_build_trigger(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuildTrigger_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_sync.py new file mode 100644 index 00000000..5cc20671 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuildTrigger_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_get_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + response = client.get_build_trigger(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuildTrigger_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_async.py new file mode 100644 index 00000000..8b13ac7a --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_async.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetWorkerPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_GetWorkerPool_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_get_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetWorkerPoolRequest( + name="name_value", + ) + + # Make the request + response = await client.get_worker_pool(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_GetWorkerPool_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_sync.py new file mode 100644 index 00000000..abd0c28f --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_sync.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetWorkerPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_GetWorkerPool_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_get_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.GetWorkerPoolRequest( + name="name_value", + ) + + # Make the request + response = client.get_worker_pool(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_GetWorkerPool_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_async.py new file mode 100644 index 00000000..1542f337 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListBuildTriggers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuildTriggers_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_list_build_triggers(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListBuildTriggersRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_build_triggers(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuildTriggers_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_sync.py new file mode 100644 index 00000000..a2588e49 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListBuildTriggers +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuildTriggers_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_list_build_triggers(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListBuildTriggersRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_build_triggers(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuildTriggers_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_async.py new file mode 100644 index 00000000..d69907fd --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListBuilds +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuilds_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_list_builds(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListBuildsRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_builds(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuilds_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_sync.py new file mode 100644 index 00000000..595e4c16 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListBuilds +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuilds_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_list_builds(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListBuildsRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_builds(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuilds_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_async.py new file mode 100644 index 00000000..c35cf19c --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListWorkerPools +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ListWorkerPools_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_list_worker_pools(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListWorkerPoolsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_worker_pools(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ListWorkerPools_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_sync.py new file mode 100644 index 00000000..79ba89a9 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListWorkerPools +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ListWorkerPools_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_list_worker_pools(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ListWorkerPoolsRequest( + parent="parent_value", + ) + + # Make the request + page_result = client.list_worker_pools(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ListWorkerPools_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_async.py new file mode 100644 index 00000000..4f65c11b --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_async.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ReceiveTriggerWebhook +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ReceiveTriggerWebhook_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_receive_trigger_webhook(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ReceiveTriggerWebhookRequest( + ) + + # Make the request + response = await client.receive_trigger_webhook(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ReceiveTriggerWebhook_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_sync.py new file mode 100644 index 00000000..f394d227 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_sync.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ReceiveTriggerWebhook +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_ReceiveTriggerWebhook_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_receive_trigger_webhook(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.ReceiveTriggerWebhookRequest( + ) + + # Make the request + response = client.receive_trigger_webhook(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_ReceiveTriggerWebhook_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_async.py new file mode 100644 index 00000000..44fcee7a --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RetryBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_RetryBuild_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_retry_build(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.RetryBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + operation = client.retry_build(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_RetryBuild_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_sync.py new file mode 100644 index 00000000..fc678944 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RetryBuild +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_RetryBuild_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_retry_build(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.RetryBuildRequest( + project_id="project_id_value", + id="id_value", + ) + + # Make the request + operation = client.retry_build(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_RetryBuild_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_async.py new file mode 100644 index 00000000..aede4134 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RunBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_RunBuildTrigger_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_run_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.RunBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + operation = client.run_build_trigger(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_RunBuildTrigger_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_sync.py new file mode 100644 index 00000000..4c8eb863 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for RunBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_RunBuildTrigger_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_run_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.RunBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + ) + + # Make the request + operation = client.run_build_trigger(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_RunBuildTrigger_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_async.py new file mode 100644 index 00000000..9d41fed5 --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_async.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateBuildTrigger_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_update_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + trigger = cloudbuild_v1.BuildTrigger() + trigger.autodetect = True + + request = cloudbuild_v1.UpdateBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + trigger=trigger, + ) + + # Make the request + response = await client.update_build_trigger(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateBuildTrigger_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_sync.py new file mode 100644 index 00000000..485f7cdf --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_sync.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateBuildTrigger +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateBuildTrigger_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_update_build_trigger(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + trigger = cloudbuild_v1.BuildTrigger() + trigger.autodetect = True + + request = cloudbuild_v1.UpdateBuildTriggerRequest( + project_id="project_id_value", + trigger_id="trigger_id_value", + trigger=trigger, + ) + + # Make the request + response = client.update_build_trigger(request=request) + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateBuildTrigger_sync] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_async.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_async.py new file mode 100644 index 00000000..4b880f2f --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateWorkerPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateWorkerPool_async] +from google.cloud.devtools import cloudbuild_v1 + + +async def sample_update_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildAsyncClient() + + # Initialize request argument(s) + request = cloudbuild_v1.UpdateWorkerPoolRequest( + ) + + # Make the request + operation = client.update_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = await operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateWorkerPool_async] diff --git a/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_sync.py b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_sync.py new file mode 100644 index 00000000..4e57a56c --- /dev/null +++ b/samples/generated_samples/cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_sync.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateWorkerPool +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-build + + +# [START cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateWorkerPool_sync] +from google.cloud.devtools import cloudbuild_v1 + + +def sample_update_worker_pool(): + # Create a client + client = cloudbuild_v1.CloudBuildClient() + + # Initialize request argument(s) + request = cloudbuild_v1.UpdateWorkerPoolRequest( + ) + + # Make the request + operation = client.update_worker_pool(request=request) + + print("Waiting for operation to complete...") + + response = operation.result() + + # Handle the response + print(response) + +# [END cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateWorkerPool_sync] diff --git a/samples/generated_samples/snippet_metadata_cloudbuild_v1.json b/samples/generated_samples/snippet_metadata_cloudbuild_v1.json new file mode 100644 index 00000000..7bc48574 --- /dev/null +++ b/samples/generated_samples/snippet_metadata_cloudbuild_v1.json @@ -0,0 +1,1602 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ApproveBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ApproveBuild_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ApproveBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_approve_build_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ApproveBuild_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "CancelBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_CancelBuild_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "CancelBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_cancel_build_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_CancelBuild_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "CreateBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuildTrigger_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "CreateBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_trigger_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuildTrigger_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 42, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 43, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "CreateBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuild_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "CreateBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_create_build_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateBuild_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "CreateWorkerPool" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateWorkerPool_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "CreateWorkerPool" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_create_worker_pool_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_CreateWorkerPool_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "DeleteBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteBuildTrigger_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "DeleteBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_delete_build_trigger_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteBuildTrigger_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "DeleteWorkerPool" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteWorkerPool_async", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "DeleteWorkerPool" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_delete_worker_pool_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_DeleteWorkerPool_sync", + "segments": [ + { + "end": 48, + "start": 27, + "type": "FULL" + }, + { + "end": 48, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 45, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 49, + "start": 46, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "GetBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuildTrigger_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "GetBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_trigger_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuildTrigger_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "GetBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuild_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "GetBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_get_build_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_GetBuild_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "GetWorkerPool" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_GetWorkerPool_async", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "GetWorkerPool" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_get_worker_pool_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_GetWorkerPool_sync", + "segments": [ + { + "end": 44, + "start": 27, + "type": "FULL" + }, + { + "end": 44, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 45, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ListBuildTriggers" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuildTriggers_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ListBuildTriggers" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_list_build_triggers_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuildTriggers_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ListBuilds" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuilds_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ListBuilds" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_list_builds_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ListBuilds_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ListWorkerPools" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ListWorkerPools_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ListWorkerPools" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_list_worker_pools_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ListWorkerPools_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ReceiveTriggerWebhook" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ReceiveTriggerWebhook_async", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "ReceiveTriggerWebhook" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_receive_trigger_webhook_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_ReceiveTriggerWebhook_sync", + "segments": [ + { + "end": 43, + "start": 27, + "type": "FULL" + }, + { + "end": 43, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 40, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 44, + "start": 41, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "RetryBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_RetryBuild_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "RetryBuild" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_retry_build_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_RetryBuild_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "RunBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_RunBuildTrigger_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "RunBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_run_build_trigger_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_RunBuildTrigger_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "UpdateBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateBuildTrigger_async", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "UpdateBuildTrigger" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_update_build_trigger_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateBuildTrigger_sync", + "segments": [ + { + "end": 49, + "start": 27, + "type": "FULL" + }, + { + "end": 49, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 46, + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 50, + "start": 47, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "UpdateWorkerPool" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_async.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateWorkerPool_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "CloudBuild" + }, + "shortName": "UpdateWorkerPool" + } + }, + "file": "cloudbuild_generated_cloudbuild_v1_cloud_build_update_worker_pool_sync.py", + "regionTag": "cloudbuild_generated_cloudbuild_v1_CloudBuild_UpdateWorkerPool_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 44, + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "start": 45, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} From d03f90967302e31521aaccd78938c47e3307f60e Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 14 Feb 2022 16:52:47 +0100 Subject: [PATCH 20/21] chore(deps): update dependency pytest to v7.0.1 (#229) --- samples/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index 618cbcc9..76593bb6 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1 +1 @@ -pytest==7.0.0 \ No newline at end of file +pytest==7.0.1 \ No newline at end of file From 73a8aff37078dbb74dfddde1e015616d21cfb315 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 17 Feb 2022 12:42:45 -0700 Subject: [PATCH 21/21] chore(main): release 3.8.0 (#223) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6f19e97..d7b01acd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ [1]: https://pypi.org/project/google-cloud-build/#history +## [3.8.0](https://github.com/googleapis/python-cloudbuild/compare/v3.7.1...v3.8.0) (2022-02-14) + + +### Features + +* add api key support ([#222](https://github.com/googleapis/python-cloudbuild/issues/222)) ([9c62e7e](https://github.com/googleapis/python-cloudbuild/commit/9c62e7e60b57ac213e98d6df05f9d9a748134f57)) + + +### Bug Fixes + +* resolve DuplicateCredentialArgs error when using credentials_file ([2af2b18](https://github.com/googleapis/python-cloudbuild/commit/2af2b18e87de591b72ee9279a8a3cd54171cb725)) + ### [3.7.1](https://www.github.com/googleapis/python-cloudbuild/compare/v3.7.0...v3.7.1) (2021-11-05) diff --git a/setup.py b/setup.py index f90522ba..401f4672 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "google-cloud-build" description = "Google Cloud Build API client library" -version = "3.7.1" +version = "3.8.0" # Should be one of: # 'Development Status :: 3 - Alpha' # 'Development Status :: 4 - Beta'