From 4ea3affc23aee7af7b2d06d51a35dba5ee3872aa Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 26 Nov 2022 07:01:54 -0500 Subject: [PATCH] chore: Update gapic-generator-python to v1.6.1 (#225) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud..__version__` PiperOrigin-RevId: 484665853 Source-Link: https://github.com/googleapis/googleapis/commit/8eb249a19db926c2fbc4ecf1dc09c0e521a88b22 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update version in gapic_version.py * add .release-please-manifest.json with correct version * set manifest to true in .github/release-please.yml * add release-please-config.json * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update to gapic-generator-python 1.6.0 feat(python): Add typing to proto.Message based class attributes feat(python): Snippetgen handling of repeated enum field PiperOrigin-RevId: 487326846 Source-Link: https://github.com/googleapis/googleapis/commit/da380c77bb87ba0f752baf07605dd1db30e1f7e1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: https://github.com/googleapis/googleapis/commit/5be5981f50322cf0c7388595e0f31ac5d0693469 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update path to snippet metadata json * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: https://github.com/googleapis/googleapis/commit/08f275f5c1c0d99056e1cb68376323414459ee19 Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * use templated owlbot.py and setup.py * configure release-please to use manifest * run nox format session Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../.github/release-please.yml | 1 + .../.release-please-manifest.json | 3 + packages/google-cloud-workflows/docs/conf.py | 2 +- .../docs/executions_v1/types.rst | 1 - .../docs/executions_v1beta/types.rst | 1 - .../google-cloud-workflows/docs/index.rst | 17 +- .../docs/workflows_v1/types.rst | 1 - .../docs/workflows_v1beta/types.rst | 1 - .../google/cloud/workflows/__init__.py | 25 +- .../cloud/workflows/executions/__init__.py | 25 +- .../workflows/executions/gapic_version.py | 16 + .../cloud/workflows/executions_v1/__init__.py | 22 +- .../services/executions/__init__.py | 2 +- .../services/executions/async_client.py | 64 +- .../services/executions/client.py | 60 +- .../services/executions/pagers.py | 4 +- .../executions/transports/__init__.py | 1 - .../services/executions/transports/base.py | 8 +- .../services/executions/transports/grpc.py | 29 +- .../executions/transports/grpc_asyncio.py | 25 +- .../workflows/executions_v1/types/__init__.py | 2 +- .../executions_v1/types/executions.py | 68 +- .../workflows/executions_v1beta/__init__.py | 22 +- .../services/executions/__init__.py | 2 +- .../services/executions/async_client.py | 64 +- .../services/executions/client.py | 60 +- .../services/executions/pagers.py | 4 +- .../executions/transports/__init__.py | 1 - .../services/executions/transports/base.py | 8 +- .../services/executions/transports/grpc.py | 29 +- .../executions/transports/grpc_asyncio.py | 25 +- .../executions_v1beta/types/__init__.py | 2 +- .../executions_v1beta/types/executions.py | 48 +- .../google/cloud/workflows/gapic_version.py | 16 + .../google/cloud/workflows_v1/__init__.py | 24 +- .../services/workflows/__init__.py | 2 +- .../services/workflows/async_client.py | 76 +- .../workflows_v1/services/workflows/client.py | 70 +- .../workflows_v1/services/workflows/pagers.py | 4 +- .../services/workflows/transports/__init__.py | 1 - .../services/workflows/transports/base.py | 11 +- .../services/workflows/transports/grpc.py | 32 +- .../workflows/transports/grpc_asyncio.py | 28 +- .../cloud/workflows_v1/types/workflows.py | 70 +- .../google/cloud/workflows_v1beta/__init__.py | 24 +- .../services/workflows/__init__.py | 2 +- .../services/workflows/async_client.py | 76 +- .../services/workflows/client.py | 70 +- .../services/workflows/pagers.py | 4 +- .../services/workflows/transports/__init__.py | 1 - .../services/workflows/transports/base.py | 11 +- .../services/workflows/transports/grpc.py | 32 +- .../workflows/transports/grpc_asyncio.py | 28 +- .../cloud/workflows_v1beta/types/workflows.py | 70 +- packages/google-cloud-workflows/noxfile.py | 1 + packages/google-cloud-workflows/owlbot.py | 67 +- .../release-please-config.json | 29 + .../snippet_metadata_executions_v1.json | 666 ------------------ .../snippet_metadata_executions_v1beta.json | 666 ------------------ ...t_metadata_google.cloud.workflows.v1.json} | 3 +- ...tadata_google.cloud.workflows.v1beta.json} | 3 +- ...rated_executions_cancel_execution_async.py | 52 -- ...erated_executions_cancel_execution_sync.py | 52 -- ...rated_executions_create_execution_async.py | 52 -- ...erated_executions_create_execution_sync.py | 52 -- ...enerated_executions_get_execution_async.py | 52 -- ...generated_executions_get_execution_sync.py | 52 -- ...erated_executions_list_executions_async.py | 53 -- ...nerated_executions_list_executions_sync.py | 53 -- ...rated_executions_cancel_execution_async.py | 52 -- ...erated_executions_cancel_execution_sync.py | 52 -- ...rated_executions_create_execution_async.py | 52 -- ...erated_executions_create_execution_sync.py | 52 -- ...enerated_executions_get_execution_async.py | 52 -- ...generated_executions_get_execution_sync.py | 52 -- ...erated_executions_list_executions_async.py | 53 -- ...nerated_executions_list_executions_sync.py | 53 -- .../scripts/fixup_executions_v1_keywords.py | 179 +++++ .../fixup_executions_v1beta_keywords.py | 179 +++++ .../scripts/fixup_workflows_v1_keywords.py | 180 +++++ .../fixup_workflows_v1beta_keywords.py | 180 +++++ packages/google-cloud-workflows/setup.py | 62 +- .../testing/constraints-3.10.txt | 6 + .../testing/constraints-3.11.txt | 6 + .../testing/constraints-3.7.txt | 9 +- .../testing/constraints-3.8.txt | 6 + .../testing/constraints-3.9.txt | 6 + .../gapic/executions_v1/test_executions.py | 28 +- .../executions_v1beta/test_executions.py | 28 +- .../unit/gapic/workflows_v1/test_workflows.py | 42 +- .../gapic/workflows_v1beta/test_workflows.py | 42 +- 91 files changed, 1647 insertions(+), 2872 deletions(-) create mode 100644 packages/google-cloud-workflows/.release-please-manifest.json create mode 100644 packages/google-cloud-workflows/google/cloud/workflows/executions/gapic_version.py create mode 100644 packages/google-cloud-workflows/google/cloud/workflows/gapic_version.py create mode 100644 packages/google-cloud-workflows/release-please-config.json delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_executions_v1.json delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_executions_v1beta.json rename packages/google-cloud-workflows/samples/generated_samples/{snippet_metadata_workflows_v1.json => snippet_metadata_google.cloud.workflows.v1.json} (99%) rename packages/google-cloud-workflows/samples/generated_samples/{snippet_metadata_workflows_v1beta.json => snippet_metadata_google.cloud.workflows.v1beta.json} (99%) delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_cancel_execution_async.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_cancel_execution_sync.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_create_execution_async.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_create_execution_sync.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_get_execution_async.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_get_execution_sync.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_list_executions_async.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_list_executions_sync.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_cancel_execution_async.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_cancel_execution_sync.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_create_execution_async.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_create_execution_sync.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_get_execution_async.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_get_execution_sync.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_list_executions_async.py delete mode 100644 packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_list_executions_sync.py create mode 100644 packages/google-cloud-workflows/scripts/fixup_executions_v1_keywords.py create mode 100644 packages/google-cloud-workflows/scripts/fixup_executions_v1beta_keywords.py create mode 100644 packages/google-cloud-workflows/scripts/fixup_workflows_v1_keywords.py create mode 100644 packages/google-cloud-workflows/scripts/fixup_workflows_v1beta_keywords.py diff --git a/packages/google-cloud-workflows/.github/release-please.yml b/packages/google-cloud-workflows/.github/release-please.yml index 6def37a84c98..e9a4f0085128 100644 --- a/packages/google-cloud-workflows/.github/release-please.yml +++ b/packages/google-cloud-workflows/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/packages/google-cloud-workflows/.release-please-manifest.json b/packages/google-cloud-workflows/.release-please-manifest.json new file mode 100644 index 000000000000..54e21e5bb94b --- /dev/null +++ b/packages/google-cloud-workflows/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.7.4" +} diff --git a/packages/google-cloud-workflows/docs/conf.py b/packages/google-cloud-workflows/docs/conf.py index a0e91f39a14d..f898a7a7fa88 100644 --- a/packages/google-cloud-workflows/docs/conf.py +++ b/packages/google-cloud-workflows/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/packages/google-cloud-workflows/docs/executions_v1/types.rst b/packages/google-cloud-workflows/docs/executions_v1/types.rst index 9210a22f70ba..e17d766321ac 100644 --- a/packages/google-cloud-workflows/docs/executions_v1/types.rst +++ b/packages/google-cloud-workflows/docs/executions_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Workflows Executions v1 API .. automodule:: google.cloud.workflows.executions_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-workflows/docs/executions_v1beta/types.rst b/packages/google-cloud-workflows/docs/executions_v1beta/types.rst index 0bb638b04a73..6c92f22e378d 100644 --- a/packages/google-cloud-workflows/docs/executions_v1beta/types.rst +++ b/packages/google-cloud-workflows/docs/executions_v1beta/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Workflows Executions v1beta API .. automodule:: google.cloud.workflows.executions_v1beta.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-workflows/docs/index.rst b/packages/google-cloud-workflows/docs/index.rst index 36c5a5f5b252..2198898eb6db 100644 --- a/packages/google-cloud-workflows/docs/index.rst +++ b/packages/google-cloud-workflows/docs/index.rst @@ -2,10 +2,12 @@ .. include:: multiprocessing.rst -This package includes clients for multiple versions of the Workflows API By default, you will get ``v1``, the latest version. +This package includes clients for multiple versions of Cloud Workflows. +By default, you will get version ``workflows_v1``. -v1 ---- + +API Reference +------------- .. toctree:: :maxdepth: 2 @@ -14,9 +16,7 @@ v1 workflows_v1/types executions_v1/types -The previous beta release, spelled ``v1beta`` is provided to continue to support code previously written against it. In order to use it, you will want to import from it e.g., ``google.cloud.workflows_v1`` in lieu of ``google.cloud.workflows`` (or the equivalent ``google.cloud.workflows_v1``). - -v1beta +API Reference ------------- .. toctree:: :maxdepth: 2 @@ -26,12 +26,13 @@ v1beta workflows_v1beta/types executions_v1beta/types + Changelog --------- For a list of all ``google-cloud-workflows`` releases: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - changelog + changelog diff --git a/packages/google-cloud-workflows/docs/workflows_v1/types.rst b/packages/google-cloud-workflows/docs/workflows_v1/types.rst index 31d6c6edfad6..054c4fedc752 100644 --- a/packages/google-cloud-workflows/docs/workflows_v1/types.rst +++ b/packages/google-cloud-workflows/docs/workflows_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Workflows v1 API .. automodule:: google.cloud.workflows_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-workflows/docs/workflows_v1beta/types.rst b/packages/google-cloud-workflows/docs/workflows_v1beta/types.rst index 35bf3fdc3e28..0b7a8571584f 100644 --- a/packages/google-cloud-workflows/docs/workflows_v1beta/types.rst +++ b/packages/google-cloud-workflows/docs/workflows_v1beta/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Workflows v1beta API .. automodule:: google.cloud.workflows_v1beta.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-workflows/google/cloud/workflows/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/__init__.py index 6011caa77941..5ef6e5d9bdf0 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/__init__.py @@ -13,20 +13,25 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.workflows import gapic_version as package_version + +__version__ = package_version.__version__ + -from google.cloud.workflows_v1.services.workflows.client import WorkflowsClient from google.cloud.workflows_v1.services.workflows.async_client import ( WorkflowsAsyncClient, ) - -from google.cloud.workflows_v1.types.workflows import CreateWorkflowRequest -from google.cloud.workflows_v1.types.workflows import DeleteWorkflowRequest -from google.cloud.workflows_v1.types.workflows import GetWorkflowRequest -from google.cloud.workflows_v1.types.workflows import ListWorkflowsRequest -from google.cloud.workflows_v1.types.workflows import ListWorkflowsResponse -from google.cloud.workflows_v1.types.workflows import OperationMetadata -from google.cloud.workflows_v1.types.workflows import UpdateWorkflowRequest -from google.cloud.workflows_v1.types.workflows import Workflow +from google.cloud.workflows_v1.services.workflows.client import WorkflowsClient +from google.cloud.workflows_v1.types.workflows import ( + CreateWorkflowRequest, + DeleteWorkflowRequest, + GetWorkflowRequest, + ListWorkflowsRequest, + ListWorkflowsResponse, + OperationMetadata, + UpdateWorkflowRequest, + Workflow, +) __all__ = ( "WorkflowsClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions/__init__.py index 2b4e7256021c..6ea3ddf7251e 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions/__init__.py @@ -13,22 +13,27 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.workflows.executions import gapic_version as package_version +__version__ = package_version.__version__ + + +from google.cloud.workflows.executions_v1.services.executions.async_client import ( + ExecutionsAsyncClient, +) from google.cloud.workflows.executions_v1.services.executions.client import ( ExecutionsClient, ) -from google.cloud.workflows.executions_v1.services.executions.async_client import ( - ExecutionsAsyncClient, +from google.cloud.workflows.executions_v1.types.executions import ( + CancelExecutionRequest, + CreateExecutionRequest, + Execution, + ExecutionView, + GetExecutionRequest, + ListExecutionsRequest, + ListExecutionsResponse, ) -from google.cloud.workflows.executions_v1.types.executions import CancelExecutionRequest -from google.cloud.workflows.executions_v1.types.executions import CreateExecutionRequest -from google.cloud.workflows.executions_v1.types.executions import Execution -from google.cloud.workflows.executions_v1.types.executions import GetExecutionRequest -from google.cloud.workflows.executions_v1.types.executions import ListExecutionsRequest -from google.cloud.workflows.executions_v1.types.executions import ListExecutionsResponse -from google.cloud.workflows.executions_v1.types.executions import ExecutionView - __all__ = ( "ExecutionsClient", "ExecutionsAsyncClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions/gapic_version.py b/packages/google-cloud-workflows/google/cloud/workflows/executions/gapic_version.py new file mode 100644 index 000000000000..35859c3f7fc1 --- /dev/null +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "0.1.0" diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/__init__.py index 813c180cdd2f..fb930f838b99 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/__init__.py @@ -13,17 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.workflows.executions import gapic_version as package_version -from .services.executions import ExecutionsClient -from .services.executions import ExecutionsAsyncClient +__version__ = package_version.__version__ -from .types.executions import CancelExecutionRequest -from .types.executions import CreateExecutionRequest -from .types.executions import Execution -from .types.executions import GetExecutionRequest -from .types.executions import ListExecutionsRequest -from .types.executions import ListExecutionsResponse -from .types.executions import ExecutionView + +from .services.executions import ExecutionsAsyncClient, ExecutionsClient +from .types.executions import ( + CancelExecutionRequest, + CreateExecutionRequest, + Execution, + ExecutionView, + GetExecutionRequest, + ListExecutionsRequest, + ListExecutionsResponse, +) __all__ = ( "ExecutionsAsyncClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/__init__.py index 4b0fb4b69aed..f92fc714e672 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import ExecutionsClient from .async_client import ExecutionsAsyncClient +from .client import ExecutionsClient __all__ = ( "ExecutionsClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/async_client.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/async_client.py index 46c4aa9e7da6..6c776c47d8bd 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/async_client.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/async_client.py @@ -16,27 +16,39 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.workflows.executions_v1.services.executions import pagers from google.cloud.workflows.executions_v1.types import executions -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ExecutionsTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ExecutionsGrpcAsyncIOTransport + from .client import ExecutionsClient +from .transports.base import DEFAULT_CLIENT_INFO, ExecutionsTransport +from .transports.grpc_asyncio import ExecutionsGrpcAsyncIOTransport class ExecutionsAsyncClient: @@ -157,9 +169,9 @@ def transport(self) -> ExecutionsTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ExecutionsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the executions client. @@ -203,11 +215,11 @@ def __init__( async def list_executions( self, - request: Union[executions.ListExecutionsRequest, dict] = None, + request: Optional[Union[executions.ListExecutionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExecutionsAsyncPager: r"""Returns a list of executions which belong to the @@ -244,7 +256,7 @@ async def sample_list_executions(): print(response) Args: - request (Union[google.cloud.workflows.executions_v1.types.ListExecutionsRequest, dict]): + request (Optional[Union[google.cloud.workflows.executions_v1.types.ListExecutionsRequest, dict]]): The request object. Request for the [ListExecutions][] method. @@ -326,12 +338,12 @@ async def sample_list_executions(): async def create_execution( self, - request: Union[executions.CreateExecutionRequest, dict] = None, + request: Optional[Union[executions.CreateExecutionRequest, dict]] = None, *, - parent: str = None, - execution: executions.Execution = None, + parent: Optional[str] = None, + execution: Optional[executions.Execution] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Creates a new execution using the latest revision of @@ -364,7 +376,7 @@ async def sample_create_execution(): print(response) Args: - request (Union[google.cloud.workflows.executions_v1.types.CreateExecutionRequest, dict]): + request (Optional[Union[google.cloud.workflows.executions_v1.types.CreateExecutionRequest, dict]]): The request object. Request for the [CreateExecution][google.cloud.workflows.executions.v1.Executions.CreateExecution] method. @@ -442,11 +454,11 @@ async def sample_create_execution(): async def get_execution( self, - request: Union[executions.GetExecutionRequest, dict] = None, + request: Optional[Union[executions.GetExecutionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Returns an execution of the given name. @@ -478,7 +490,7 @@ async def sample_get_execution(): print(response) Args: - request (Union[google.cloud.workflows.executions_v1.types.GetExecutionRequest, dict]): + request (Optional[Union[google.cloud.workflows.executions_v1.types.GetExecutionRequest, dict]]): The request object. Request for the [GetExecution][google.cloud.workflows.executions.v1.Executions.GetExecution] method. @@ -546,11 +558,11 @@ async def sample_get_execution(): async def cancel_execution( self, - request: Union[executions.CancelExecutionRequest, dict] = None, + request: Optional[Union[executions.CancelExecutionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Cancels an execution of the given name. @@ -582,7 +594,7 @@ async def sample_cancel_execution(): print(response) Args: - request (Union[google.cloud.workflows.executions_v1.types.CancelExecutionRequest, dict]): + request (Optional[Union[google.cloud.workflows.executions_v1.types.CancelExecutionRequest, dict]]): The request object. Request for the [CancelExecution][google.cloud.workflows.executions.v1.Executions.CancelExecution] method. @@ -658,7 +670,7 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( - "google-cloud-workflow", + "google-cloud-workflows", ).version, ) except pkg_resources.DistributionNotFound: diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/client.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/client.py index 19018b4b3a66..36f9a9581b36 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/client.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/client.py @@ -16,28 +16,41 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.workflows.executions_v1.services.executions import pagers from google.cloud.workflows.executions_v1.types import executions -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ExecutionsTransport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, ExecutionsTransport from .transports.grpc import ExecutionsGrpcTransport from .transports.grpc_asyncio import ExecutionsGrpcAsyncIOTransport @@ -56,7 +69,7 @@ class ExecutionsClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[ExecutionsTransport]: """Returns an appropriate transport class. @@ -357,8 +370,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ExecutionsTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, ExecutionsTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the executions client. @@ -372,7 +385,7 @@ def __init__( transport (Union[str, ExecutionsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -402,6 +415,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -454,11 +468,11 @@ def __init__( def list_executions( self, - request: Union[executions.ListExecutionsRequest, dict] = None, + request: Optional[Union[executions.ListExecutionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExecutionsPager: r"""Returns a list of executions which belong to the @@ -577,12 +591,12 @@ def sample_list_executions(): def create_execution( self, - request: Union[executions.CreateExecutionRequest, dict] = None, + request: Optional[Union[executions.CreateExecutionRequest, dict]] = None, *, - parent: str = None, - execution: executions.Execution = None, + parent: Optional[str] = None, + execution: Optional[executions.Execution] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Creates a new execution using the latest revision of @@ -693,11 +707,11 @@ def sample_create_execution(): def get_execution( self, - request: Union[executions.GetExecutionRequest, dict] = None, + request: Optional[Union[executions.GetExecutionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Returns an execution of the given name. @@ -797,11 +811,11 @@ def sample_get_execution(): def cancel_execution( self, - request: Union[executions.CancelExecutionRequest, dict] = None, + request: Optional[Union[executions.CancelExecutionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Cancels an execution of the given name. @@ -916,7 +930,7 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( - "google-cloud-workflow", + "google-cloud-workflows", ).version, ) except pkg_resources.DistributionNotFound: diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/pagers.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/pagers.py index bae03c59b5f3..ce252385462e 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/pagers.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/pagers.py @@ -18,10 +18,10 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) from google.cloud.workflows.executions_v1.types import executions diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/__init__.py index bfe2147dd7a0..7ee73017b29f 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import ExecutionsGrpcTransport from .grpc_asyncio import ExecutionsGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ExecutionsTransport]] _transport_registry["grpc"] = ExecutionsGrpcTransport diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/base.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/base.py index 74d246f5571a..216d3a4c6b84 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/base.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/base.py @@ -15,22 +15,22 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.workflows.executions_v1.types import executions try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( - "google-cloud-workflow", + "google-cloud-workflows", ).version, ) except pkg_resources.DistributionNotFound: @@ -48,7 +48,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py index c070d84a55c9..35db077ba587 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/grpc.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from google.cloud.workflows.executions_v1.types import executions -from .base import ExecutionsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, ExecutionsTransport class ExecutionsGrpcTransport(ExecutionsTransport): @@ -48,14 +47,14 @@ def __init__( self, *, host: str = "workflowexecutions.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -182,8 +181,8 @@ def __init__( def create_channel( cls, host: str = "workflowexecutions.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/grpc_asyncio.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/grpc_asyncio.py index b3b3d3f23c55..c73f49a4fe8a 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/grpc_asyncio.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/services/executions/transports/grpc_asyncio.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.workflows.executions_v1.types import executions -from .base import ExecutionsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, ExecutionsTransport from .grpc import ExecutionsGrpcTransport @@ -50,7 +49,7 @@ class ExecutionsGrpcAsyncIOTransport(ExecutionsTransport): def create_channel( cls, host: str = "workflowexecutions.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -93,15 +92,15 @@ def __init__( self, *, host: str = "workflowexecutions.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/types/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/types/__init__.py index a68c3aa6112f..2437040d3f45 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/types/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/types/__init__.py @@ -17,10 +17,10 @@ CancelExecutionRequest, CreateExecutionRequest, Execution, + ExecutionView, GetExecutionRequest, ListExecutionsRequest, ListExecutionsResponse, - ExecutionView, ) __all__ = ( diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/types/executions.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/types/executions.py index ae9a43ac0358..6a5e059c4f13 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/types/executions.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1/types/executions.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.workflows.executions.v1", @@ -128,28 +128,28 @@ class Position(proto.Message): this stack trace element. """ - line = proto.Field( + line: int = proto.Field( proto.INT64, number=1, ) - column = proto.Field( + column: int = proto.Field( proto.INT64, number=2, ) - length = proto.Field( + length: int = proto.Field( proto.INT64, number=3, ) - step = proto.Field( + step: str = proto.Field( proto.STRING, number=1, ) - routine = proto.Field( + routine: str = proto.Field( proto.STRING, number=2, ) - position = proto.Field( + position: "Execution.StackTraceElement.Position" = proto.Field( proto.MESSAGE, number=3, message="Execution.StackTraceElement.Position", @@ -160,11 +160,11 @@ class StackTrace(proto.Message): occurred. Attributes: - elements (Sequence[google.cloud.workflows.executions_v1.types.Execution.StackTraceElement]): + elements (MutableSequence[google.cloud.workflows.executions_v1.types.Execution.StackTraceElement]): An array of stack elements. """ - elements = proto.RepeatedField( + elements: MutableSequence["Execution.StackTraceElement"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Execution.StackTraceElement", @@ -184,57 +184,57 @@ class Error(proto.Message): where error was generated. """ - payload = proto.Field( + payload: str = proto.Field( proto.STRING, number=1, ) - context = proto.Field( + context: str = proto.Field( proto.STRING, number=2, ) - stack_trace = proto.Field( + stack_trace: "Execution.StackTrace" = proto.Field( proto.MESSAGE, number=3, message="Execution.StackTrace", ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=4, enum=State, ) - argument = proto.Field( + argument: str = proto.Field( proto.STRING, number=5, ) - result = proto.Field( + result: str = proto.Field( proto.STRING, number=6, ) - error = proto.Field( + error: Error = proto.Field( proto.MESSAGE, number=7, message=Error, ) - workflow_revision_id = proto.Field( + workflow_revision_id: str = proto.Field( proto.STRING, number=8, ) - call_log_level = proto.Field( + call_log_level: CallLogLevel = proto.Field( proto.ENUM, number=9, enum=CallLogLevel, @@ -270,19 +270,19 @@ class ListExecutionsRequest(proto.Message): will default to the BASIC view. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - view = proto.Field( + view: "ExecutionView" = proto.Field( proto.ENUM, number=4, enum="ExecutionView", @@ -295,7 +295,7 @@ class ListExecutionsResponse(proto.Message): method. Attributes: - executions (Sequence[google.cloud.workflows.executions_v1.types.Execution]): + executions (MutableSequence[google.cloud.workflows.executions_v1.types.Execution]): The executions which match the request. next_page_token (str): A token, which can be sent as ``page_token`` to retrieve the @@ -307,12 +307,12 @@ class ListExecutionsResponse(proto.Message): def raw_page(self): return self - executions = proto.RepeatedField( + executions: MutableSequence["Execution"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Execution", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -334,11 +334,11 @@ class CreateExecutionRequest(proto.Message): Required. Execution to be created. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - execution = proto.Field( + execution: "Execution" = proto.Field( proto.MESSAGE, number=2, message="Execution", @@ -361,11 +361,11 @@ class GetExecutionRequest(proto.Message): will default to the FULL view. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - view = proto.Field( + view: "ExecutionView" = proto.Field( proto.ENUM, number=2, enum="ExecutionView", @@ -384,7 +384,7 @@ class CancelExecutionRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/__init__.py index 813c180cdd2f..fb930f838b99 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/__init__.py @@ -13,17 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.workflows.executions import gapic_version as package_version -from .services.executions import ExecutionsClient -from .services.executions import ExecutionsAsyncClient +__version__ = package_version.__version__ -from .types.executions import CancelExecutionRequest -from .types.executions import CreateExecutionRequest -from .types.executions import Execution -from .types.executions import GetExecutionRequest -from .types.executions import ListExecutionsRequest -from .types.executions import ListExecutionsResponse -from .types.executions import ExecutionView + +from .services.executions import ExecutionsAsyncClient, ExecutionsClient +from .types.executions import ( + CancelExecutionRequest, + CreateExecutionRequest, + Execution, + ExecutionView, + GetExecutionRequest, + ListExecutionsRequest, + ListExecutionsResponse, +) __all__ = ( "ExecutionsAsyncClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/__init__.py index 4b0fb4b69aed..f92fc714e672 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import ExecutionsClient from .async_client import ExecutionsAsyncClient +from .client import ExecutionsClient __all__ = ( "ExecutionsClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/async_client.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/async_client.py index 81794d02715a..3cf809402703 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/async_client.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/async_client.py @@ -16,27 +16,39 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.workflows.executions_v1beta.services.executions import pagers from google.cloud.workflows.executions_v1beta.types import executions -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ExecutionsTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import ExecutionsGrpcAsyncIOTransport + from .client import ExecutionsClient +from .transports.base import DEFAULT_CLIENT_INFO, ExecutionsTransport +from .transports.grpc_asyncio import ExecutionsGrpcAsyncIOTransport class ExecutionsAsyncClient: @@ -158,9 +170,9 @@ def transport(self) -> ExecutionsTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, ExecutionsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the executions client. @@ -204,11 +216,11 @@ def __init__( async def list_executions( self, - request: Union[executions.ListExecutionsRequest, dict] = None, + request: Optional[Union[executions.ListExecutionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExecutionsAsyncPager: r"""Returns a list of executions which belong to the @@ -245,7 +257,7 @@ async def sample_list_executions(): print(response) Args: - request (Union[google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest, dict]): + request (Optional[Union[google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest, dict]]): The request object. Request for the [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] method. @@ -327,12 +339,12 @@ async def sample_list_executions(): async def create_execution( self, - request: Union[executions.CreateExecutionRequest, dict] = None, + request: Optional[Union[executions.CreateExecutionRequest, dict]] = None, *, - parent: str = None, - execution: executions.Execution = None, + parent: Optional[str] = None, + execution: Optional[executions.Execution] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Creates a new execution using the latest revision of @@ -365,7 +377,7 @@ async def sample_create_execution(): print(response) Args: - request (Union[google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest, dict]): + request (Optional[Union[google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest, dict]]): The request object. Request for the [CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution] method. @@ -443,11 +455,11 @@ async def sample_create_execution(): async def get_execution( self, - request: Union[executions.GetExecutionRequest, dict] = None, + request: Optional[Union[executions.GetExecutionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Returns an execution of the given name. @@ -479,7 +491,7 @@ async def sample_get_execution(): print(response) Args: - request (Union[google.cloud.workflows.executions_v1beta.types.GetExecutionRequest, dict]): + request (Optional[Union[google.cloud.workflows.executions_v1beta.types.GetExecutionRequest, dict]]): The request object. Request for the [GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution] method. @@ -547,11 +559,11 @@ async def sample_get_execution(): async def cancel_execution( self, - request: Union[executions.CancelExecutionRequest, dict] = None, + request: Optional[Union[executions.CancelExecutionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Cancels an execution of the given name. @@ -583,7 +595,7 @@ async def sample_cancel_execution(): print(response) Args: - request (Union[google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest, dict]): + request (Optional[Union[google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest, dict]]): The request object. Request for the [CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution] method. @@ -659,7 +671,7 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( - "google-cloud-workflow", + "google-cloud-workflows", ).version, ) except pkg_resources.DistributionNotFound: diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/client.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/client.py index 1c4c97eb0985..96d6502eac12 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/client.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/client.py @@ -16,28 +16,41 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.workflows.executions_v1beta.services.executions import pagers from google.cloud.workflows.executions_v1beta.types import executions -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import ExecutionsTransport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, ExecutionsTransport from .transports.grpc import ExecutionsGrpcTransport from .transports.grpc_asyncio import ExecutionsGrpcAsyncIOTransport @@ -56,7 +69,7 @@ class ExecutionsClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[ExecutionsTransport]: """Returns an appropriate transport class. @@ -358,8 +371,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, ExecutionsTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, ExecutionsTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the executions client. @@ -373,7 +386,7 @@ def __init__( transport (Union[str, ExecutionsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -403,6 +416,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -455,11 +469,11 @@ def __init__( def list_executions( self, - request: Union[executions.ListExecutionsRequest, dict] = None, + request: Optional[Union[executions.ListExecutionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExecutionsPager: r"""Returns a list of executions which belong to the @@ -578,12 +592,12 @@ def sample_list_executions(): def create_execution( self, - request: Union[executions.CreateExecutionRequest, dict] = None, + request: Optional[Union[executions.CreateExecutionRequest, dict]] = None, *, - parent: str = None, - execution: executions.Execution = None, + parent: Optional[str] = None, + execution: Optional[executions.Execution] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Creates a new execution using the latest revision of @@ -694,11 +708,11 @@ def sample_create_execution(): def get_execution( self, - request: Union[executions.GetExecutionRequest, dict] = None, + request: Optional[Union[executions.GetExecutionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Returns an execution of the given name. @@ -798,11 +812,11 @@ def sample_get_execution(): def cancel_execution( self, - request: Union[executions.CancelExecutionRequest, dict] = None, + request: Optional[Union[executions.CancelExecutionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> executions.Execution: r"""Cancels an execution of the given name. @@ -917,7 +931,7 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( - "google-cloud-workflow", + "google-cloud-workflows", ).version, ) except pkg_resources.DistributionNotFound: diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/pagers.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/pagers.py index f90d5b10dd48..e54132f6350c 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/pagers.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/pagers.py @@ -18,10 +18,10 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) from google.cloud.workflows.executions_v1beta.types import executions diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/__init__.py index bfe2147dd7a0..7ee73017b29f 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import ExecutionsGrpcTransport from .grpc_asyncio import ExecutionsGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[ExecutionsTransport]] _transport_registry["grpc"] = ExecutionsGrpcTransport diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py index fb5d62e01513..6401f0d1fc61 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/base.py @@ -15,22 +15,22 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.workflows.executions_v1beta.types import executions try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution( - "google-cloud-workflow", + "google-cloud-workflows", ).version, ) except pkg_resources.DistributionNotFound: @@ -48,7 +48,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py index 7f7a360c18b8..c05f745c0ad7 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from google.cloud.workflows.executions_v1beta.types import executions -from .base import ExecutionsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, ExecutionsTransport class ExecutionsGrpcTransport(ExecutionsTransport): @@ -49,14 +48,14 @@ def __init__( self, *, host: str = "workflowexecutions.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -183,8 +182,8 @@ def __init__( def create_channel( cls, host: str = "workflowexecutions.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc_asyncio.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc_asyncio.py index d5601333abef..21dff7c3b43a 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc_asyncio.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/services/executions/transports/grpc_asyncio.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.workflows.executions_v1beta.types import executions -from .base import ExecutionsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, ExecutionsTransport from .grpc import ExecutionsGrpcTransport @@ -51,7 +50,7 @@ class ExecutionsGrpcAsyncIOTransport(ExecutionsTransport): def create_channel( cls, host: str = "workflowexecutions.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -94,15 +93,15 @@ def __init__( self, *, host: str = "workflowexecutions.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/types/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/types/__init__.py index a68c3aa6112f..2437040d3f45 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/types/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/types/__init__.py @@ -17,10 +17,10 @@ CancelExecutionRequest, CreateExecutionRequest, Execution, + ExecutionView, GetExecutionRequest, ListExecutionsRequest, ListExecutionsResponse, - ExecutionView, ) __all__ = ( diff --git a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/types/executions.py b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/types/executions.py index 41f54584af54..856c80aa3e3f 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/types/executions.py +++ b/packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/types/executions.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.workflows.executions.v1beta", @@ -94,48 +94,48 @@ class Error(proto.Message): debugging purposes. """ - payload = proto.Field( + payload: str = proto.Field( proto.STRING, number=1, ) - context = proto.Field( + context: str = proto.Field( proto.STRING, number=2, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=4, enum=State, ) - argument = proto.Field( + argument: str = proto.Field( proto.STRING, number=5, ) - result = proto.Field( + result: str = proto.Field( proto.STRING, number=6, ) - error = proto.Field( + error: Error = proto.Field( proto.MESSAGE, number=7, message=Error, ) - workflow_revision_id = proto.Field( + workflow_revision_id: str = proto.Field( proto.STRING, number=8, ) @@ -172,19 +172,19 @@ class ListExecutionsRequest(proto.Message): will default to the BASIC view. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - view = proto.Field( + view: "ExecutionView" = proto.Field( proto.ENUM, number=4, enum="ExecutionView", @@ -197,7 +197,7 @@ class ListExecutionsResponse(proto.Message): method. Attributes: - executions (Sequence[google.cloud.workflows.executions_v1beta.types.Execution]): + executions (MutableSequence[google.cloud.workflows.executions_v1beta.types.Execution]): The executions which match the request. next_page_token (str): A token, which can be sent as ``page_token`` to retrieve the @@ -209,12 +209,12 @@ class ListExecutionsResponse(proto.Message): def raw_page(self): return self - executions = proto.RepeatedField( + executions: MutableSequence["Execution"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Execution", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -236,11 +236,11 @@ class CreateExecutionRequest(proto.Message): Required. Execution to be created. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - execution = proto.Field( + execution: "Execution" = proto.Field( proto.MESSAGE, number=2, message="Execution", @@ -263,11 +263,11 @@ class GetExecutionRequest(proto.Message): will default to the FULL view. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - view = proto.Field( + view: "ExecutionView" = proto.Field( proto.ENUM, number=2, enum="ExecutionView", @@ -286,7 +286,7 @@ class CancelExecutionRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) diff --git a/packages/google-cloud-workflows/google/cloud/workflows/gapic_version.py b/packages/google-cloud-workflows/google/cloud/workflows/gapic_version.py new file mode 100644 index 000000000000..3372e01bbb4a --- /dev/null +++ b/packages/google-cloud-workflows/google/cloud/workflows/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "1.7.4" # {x-release-please-version} diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/__init__.py index 44a9fc101f4d..f3c84b76f192 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/__init__.py @@ -13,18 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.workflows import gapic_version as package_version -from .services.workflows import WorkflowsClient -from .services.workflows import WorkflowsAsyncClient +__version__ = package_version.__version__ -from .types.workflows import CreateWorkflowRequest -from .types.workflows import DeleteWorkflowRequest -from .types.workflows import GetWorkflowRequest -from .types.workflows import ListWorkflowsRequest -from .types.workflows import ListWorkflowsResponse -from .types.workflows import OperationMetadata -from .types.workflows import UpdateWorkflowRequest -from .types.workflows import Workflow + +from .services.workflows import WorkflowsAsyncClient, WorkflowsClient +from .types.workflows import ( + CreateWorkflowRequest, + DeleteWorkflowRequest, + GetWorkflowRequest, + ListWorkflowsRequest, + ListWorkflowsResponse, + OperationMetadata, + UpdateWorkflowRequest, + Workflow, +) __all__ = ( "WorkflowsAsyncClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/__init__.py index 93a7c4778517..dfc5625c1c5d 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import WorkflowsClient from .async_client import WorkflowsAsyncClient +from .client import WorkflowsClient __all__ = ( "WorkflowsClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/async_client.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/async_client.py index 836d6621ade8..a08f88da44a4 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/async_client.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/async_client.py @@ -16,15 +16,25 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,14 +43,16 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.workflows_v1.services.workflows import pagers -from google.cloud.workflows_v1.types import workflows from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import WorkflowsTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import WorkflowsGrpcAsyncIOTransport + +from google.cloud.workflows_v1.services.workflows import pagers +from google.cloud.workflows_v1.types import workflows + from .client import WorkflowsClient +from .transports.base import DEFAULT_CLIENT_INFO, WorkflowsTransport +from .transports.grpc_asyncio import WorkflowsGrpcAsyncIOTransport class WorkflowsAsyncClient: @@ -160,9 +172,9 @@ def transport(self) -> WorkflowsTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, WorkflowsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the workflows client. @@ -206,11 +218,11 @@ def __init__( async def list_workflows( self, - request: Union[workflows.ListWorkflowsRequest, dict] = None, + request: Optional[Union[workflows.ListWorkflowsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListWorkflowsAsyncPager: r"""Lists Workflows in a given project and location. @@ -244,7 +256,7 @@ async def sample_list_workflows(): print(response) Args: - request (Union[google.cloud.workflows_v1.types.ListWorkflowsRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1.types.ListWorkflowsRequest, dict]]): The request object. Request for the [ListWorkflows][google.cloud.workflows.v1.Workflows.ListWorkflows] method. @@ -326,11 +338,11 @@ async def sample_list_workflows(): async def get_workflow( self, - request: Union[workflows.GetWorkflowRequest, dict] = None, + request: Optional[Union[workflows.GetWorkflowRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> workflows.Workflow: r"""Gets details of a single Workflow. @@ -362,7 +374,7 @@ async def sample_get_workflow(): print(response) Args: - request (Union[google.cloud.workflows_v1.types.GetWorkflowRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1.types.GetWorkflowRequest, dict]]): The request object. Request for the [GetWorkflow][google.cloud.workflows.v1.Workflows.GetWorkflow] method. @@ -430,13 +442,13 @@ async def sample_get_workflow(): async def create_workflow( self, - request: Union[workflows.CreateWorkflowRequest, dict] = None, + request: Optional[Union[workflows.CreateWorkflowRequest, dict]] = None, *, - parent: str = None, - workflow: workflows.Workflow = None, - workflow_id: str = None, + parent: Optional[str] = None, + workflow: Optional[workflows.Workflow] = None, + workflow_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a new workflow. If a workflow with the specified name @@ -480,7 +492,7 @@ async def sample_create_workflow(): print(response) Args: - request (Union[google.cloud.workflows_v1.types.CreateWorkflowRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1.types.CreateWorkflowRequest, dict]]): The request object. Request for the [CreateWorkflow][google.cloud.workflows.v1.Workflows.CreateWorkflow] method. @@ -584,11 +596,11 @@ async def sample_create_workflow(): async def delete_workflow( self, - request: Union[workflows.DeleteWorkflowRequest, dict] = None, + request: Optional[Union[workflows.DeleteWorkflowRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes a workflow with the specified name. @@ -626,7 +638,7 @@ async def sample_delete_workflow(): print(response) Args: - request (Union[google.cloud.workflows_v1.types.DeleteWorkflowRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1.types.DeleteWorkflowRequest, dict]]): The request object. Request for the [DeleteWorkflow][google.cloud.workflows.v1.Workflows.DeleteWorkflow] method. @@ -712,12 +724,12 @@ async def sample_delete_workflow(): async def update_workflow( self, - request: Union[workflows.UpdateWorkflowRequest, dict] = None, + request: Optional[Union[workflows.UpdateWorkflowRequest, dict]] = None, *, - workflow: workflows.Workflow = None, - update_mask: field_mask_pb2.FieldMask = None, + workflow: Optional[workflows.Workflow] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates an existing workflow. @@ -761,7 +773,7 @@ async def sample_update_workflow(): print(response) Args: - request (Union[google.cloud.workflows_v1.types.UpdateWorkflowRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1.types.UpdateWorkflowRequest, dict]]): The request object. Request for the [UpdateWorkflow][google.cloud.workflows.v1.Workflows.UpdateWorkflow] method. diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/client.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/client.py index e809844e8d60..5108ae398648 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/client.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/client.py @@ -16,18 +16,29 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,12 +47,14 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.workflows_v1.services.workflows import pagers -from google.cloud.workflows_v1.types import workflows from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import WorkflowsTransport, DEFAULT_CLIENT_INFO + +from google.cloud.workflows_v1.services.workflows import pagers +from google.cloud.workflows_v1.types import workflows + +from .transports.base import DEFAULT_CLIENT_INFO, WorkflowsTransport from .transports.grpc import WorkflowsGrpcTransport from .transports.grpc_asyncio import WorkflowsGrpcAsyncIOTransport @@ -60,7 +73,7 @@ class WorkflowsClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[WorkflowsTransport]: """Returns an appropriate transport class. @@ -338,8 +351,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, WorkflowsTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, WorkflowsTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the workflows client. @@ -353,7 +366,7 @@ def __init__( transport (Union[str, WorkflowsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -383,6 +396,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -435,11 +449,11 @@ def __init__( def list_workflows( self, - request: Union[workflows.ListWorkflowsRequest, dict] = None, + request: Optional[Union[workflows.ListWorkflowsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListWorkflowsPager: r"""Lists Workflows in a given project and location. @@ -555,11 +569,11 @@ def sample_list_workflows(): def get_workflow( self, - request: Union[workflows.GetWorkflowRequest, dict] = None, + request: Optional[Union[workflows.GetWorkflowRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> workflows.Workflow: r"""Gets details of a single Workflow. @@ -659,13 +673,13 @@ def sample_get_workflow(): def create_workflow( self, - request: Union[workflows.CreateWorkflowRequest, dict] = None, + request: Optional[Union[workflows.CreateWorkflowRequest, dict]] = None, *, - parent: str = None, - workflow: workflows.Workflow = None, - workflow_id: str = None, + parent: Optional[str] = None, + workflow: Optional[workflows.Workflow] = None, + workflow_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates a new workflow. If a workflow with the specified name @@ -813,11 +827,11 @@ def sample_create_workflow(): def delete_workflow( self, - request: Union[workflows.DeleteWorkflowRequest, dict] = None, + request: Optional[Union[workflows.DeleteWorkflowRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes a workflow with the specified name. @@ -941,12 +955,12 @@ def sample_delete_workflow(): def update_workflow( self, - request: Union[workflows.UpdateWorkflowRequest, dict] = None, + request: Optional[Union[workflows.UpdateWorkflowRequest, dict]] = None, *, - workflow: workflows.Workflow = None, - update_mask: field_mask_pb2.FieldMask = None, + workflow: Optional[workflows.Workflow] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Updates an existing workflow. diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/pagers.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/pagers.py index 8917d483bee5..8b726c7cd023 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/pagers.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/pagers.py @@ -18,10 +18,10 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) from google.cloud.workflows_v1.types import workflows diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/__init__.py index 189d3526dffc..3508736b2cc7 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import WorkflowsGrpcTransport from .grpc_asyncio import WorkflowsGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[WorkflowsTransport]] _transport_registry["grpc"] = WorkflowsGrpcTransport diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/base.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/base.py index f8c308edd18b..574f54ec473e 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/base.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/base.py @@ -15,19 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.workflows_v1.types import workflows -from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -50,7 +49,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/grpc.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/grpc.py index 9b5ae61e9c7d..fd2e91a9be8a 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/grpc.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/grpc.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from google.cloud.workflows_v1.types import workflows -from google.longrunning import operations_pb2 # type: ignore -from .base import WorkflowsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, WorkflowsTransport class WorkflowsGrpcTransport(WorkflowsTransport): @@ -51,14 +49,14 @@ def __init__( self, *, host: str = "workflows.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -186,8 +184,8 @@ def __init__( def create_channel( cls, host: str = "workflows.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/grpc_asyncio.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/grpc_asyncio.py index 91dd4112fe40..2c28bc1f8b1a 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/grpc_asyncio.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/transports/grpc_asyncio.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.workflows_v1.types import workflows -from google.longrunning import operations_pb2 # type: ignore -from .base import WorkflowsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, WorkflowsTransport from .grpc import WorkflowsGrpcTransport @@ -53,7 +51,7 @@ class WorkflowsGrpcAsyncIOTransport(WorkflowsTransport): def create_channel( cls, host: str = "workflows.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -96,15 +94,15 @@ def __init__( self, *, host: str = "workflows.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1/types/workflows.py b/packages/google-cloud-workflows/google/cloud/workflows_v1/types/workflows.py index 888bba60f173..92cb9d5696cc 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1/types/workflows.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1/types/workflows.py @@ -13,11 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.workflows.v1", @@ -73,7 +73,7 @@ class Workflow(proto.Message): revision_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp that the latest revision of the workflow was created. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Labels associated with this workflow. Labels can contain at most 64 entries. Keys and values can be no longer than 63 characters and @@ -110,48 +110,48 @@ class State(proto.Enum): STATE_UNSPECIFIED = 0 ACTIVE = 1 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=3, enum=State, ) - revision_id = proto.Field( + revision_id: str = proto.Field( proto.STRING, number=4, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, ) - revision_create_time = proto.Field( + revision_create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=8, ) - service_account = proto.Field( + service_account: str = proto.Field( proto.STRING, number=9, ) - source_contents = proto.Field( + source_contents: str = proto.Field( proto.STRING, number=10, oneof="source_code", @@ -195,23 +195,23 @@ class ListWorkflowsRequest(proto.Message): in an unspecified order. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=4, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=5, ) @@ -223,13 +223,13 @@ class ListWorkflowsResponse(proto.Message): method. Attributes: - workflows (Sequence[google.cloud.workflows_v1.types.Workflow]): + workflows (MutableSequence[google.cloud.workflows_v1.types.Workflow]): The workflows which match the request. next_page_token (str): A token, which can be sent as ``page_token`` to retrieve the next page. If this field is omitted, there are no subsequent pages. - unreachable (Sequence[str]): + unreachable (MutableSequence[str]): Unreachable resources. """ @@ -237,16 +237,16 @@ class ListWorkflowsResponse(proto.Message): def raw_page(self): return self - workflows = proto.RepeatedField( + workflows: MutableSequence["Workflow"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Workflow", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - unreachable = proto.RepeatedField( + unreachable: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) @@ -264,7 +264,7 @@ class GetWorkflowRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -294,16 +294,16 @@ class CreateWorkflowRequest(proto.Message): - Must be unique within the customer project and location. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - workflow = proto.Field( + workflow: "Workflow" = proto.Field( proto.MESSAGE, number=2, message="Workflow", ) - workflow_id = proto.Field( + workflow_id: str = proto.Field( proto.STRING, number=3, ) @@ -321,7 +321,7 @@ class DeleteWorkflowRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -340,12 +340,12 @@ class UpdateWorkflowRequest(proto.Message): the entire workflow will be updated. """ - workflow = proto.Field( + workflow: "Workflow" = proto.Field( proto.MESSAGE, number=1, message="Workflow", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -369,25 +369,25 @@ class OperationMetadata(proto.Message): API version used to start the operation. """ - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - target = proto.Field( + target: str = proto.Field( proto.STRING, number=3, ) - verb = proto.Field( + verb: str = proto.Field( proto.STRING, number=4, ) - api_version = proto.Field( + api_version: str = proto.Field( proto.STRING, number=5, ) diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/__init__.py index 44a9fc101f4d..f3c84b76f192 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/__init__.py @@ -13,18 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.workflows import gapic_version as package_version -from .services.workflows import WorkflowsClient -from .services.workflows import WorkflowsAsyncClient +__version__ = package_version.__version__ -from .types.workflows import CreateWorkflowRequest -from .types.workflows import DeleteWorkflowRequest -from .types.workflows import GetWorkflowRequest -from .types.workflows import ListWorkflowsRequest -from .types.workflows import ListWorkflowsResponse -from .types.workflows import OperationMetadata -from .types.workflows import UpdateWorkflowRequest -from .types.workflows import Workflow + +from .services.workflows import WorkflowsAsyncClient, WorkflowsClient +from .types.workflows import ( + CreateWorkflowRequest, + DeleteWorkflowRequest, + GetWorkflowRequest, + ListWorkflowsRequest, + ListWorkflowsResponse, + OperationMetadata, + UpdateWorkflowRequest, + Workflow, +) __all__ = ( "WorkflowsAsyncClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/__init__.py index 93a7c4778517..dfc5625c1c5d 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import WorkflowsClient from .async_client import WorkflowsAsyncClient +from .client import WorkflowsClient __all__ = ( "WorkflowsClient", diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/async_client.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/async_client.py index 9cccb4cb4f15..6505d3e26edc 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/async_client.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/async_client.py @@ -16,15 +16,25 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -33,14 +43,16 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.workflows_v1beta.services.workflows import pagers -from google.cloud.workflows_v1beta.types import workflows from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import WorkflowsTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import WorkflowsGrpcAsyncIOTransport + +from google.cloud.workflows_v1beta.services.workflows import pagers +from google.cloud.workflows_v1beta.types import workflows + from .client import WorkflowsClient +from .transports.base import DEFAULT_CLIENT_INFO, WorkflowsTransport +from .transports.grpc_asyncio import WorkflowsGrpcAsyncIOTransport class WorkflowsAsyncClient: @@ -160,9 +172,9 @@ def transport(self) -> WorkflowsTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, WorkflowsTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the workflows client. @@ -206,11 +218,11 @@ def __init__( async def list_workflows( self, - request: Union[workflows.ListWorkflowsRequest, dict] = None, + request: Optional[Union[workflows.ListWorkflowsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListWorkflowsAsyncPager: r"""Lists Workflows in a given project and location. @@ -244,7 +256,7 @@ async def sample_list_workflows(): print(response) Args: - request (Union[google.cloud.workflows_v1beta.types.ListWorkflowsRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1beta.types.ListWorkflowsRequest, dict]]): The request object. Request for the [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] method. @@ -326,11 +338,11 @@ async def sample_list_workflows(): async def get_workflow( self, - request: Union[workflows.GetWorkflowRequest, dict] = None, + request: Optional[Union[workflows.GetWorkflowRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> workflows.Workflow: r"""Gets details of a single Workflow. @@ -362,7 +374,7 @@ async def sample_get_workflow(): print(response) Args: - request (Union[google.cloud.workflows_v1beta.types.GetWorkflowRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1beta.types.GetWorkflowRequest, dict]]): The request object. Request for the [GetWorkflow][google.cloud.workflows.v1beta.Workflows.GetWorkflow] method. @@ -430,13 +442,13 @@ async def sample_get_workflow(): async def create_workflow( self, - request: Union[workflows.CreateWorkflowRequest, dict] = None, + request: Optional[Union[workflows.CreateWorkflowRequest, dict]] = None, *, - parent: str = None, - workflow: workflows.Workflow = None, - workflow_id: str = None, + parent: Optional[str] = None, + workflow: Optional[workflows.Workflow] = None, + workflow_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a new workflow. If a workflow with the specified name @@ -480,7 +492,7 @@ async def sample_create_workflow(): print(response) Args: - request (Union[google.cloud.workflows_v1beta.types.CreateWorkflowRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1beta.types.CreateWorkflowRequest, dict]]): The request object. Request for the [CreateWorkflow][google.cloud.workflows.v1beta.Workflows.CreateWorkflow] method. @@ -584,11 +596,11 @@ async def sample_create_workflow(): async def delete_workflow( self, - request: Union[workflows.DeleteWorkflowRequest, dict] = None, + request: Optional[Union[workflows.DeleteWorkflowRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes a workflow with the specified name. @@ -626,7 +638,7 @@ async def sample_delete_workflow(): print(response) Args: - request (Union[google.cloud.workflows_v1beta.types.DeleteWorkflowRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1beta.types.DeleteWorkflowRequest, dict]]): The request object. Request for the [DeleteWorkflow][google.cloud.workflows.v1beta.Workflows.DeleteWorkflow] method. @@ -712,12 +724,12 @@ async def sample_delete_workflow(): async def update_workflow( self, - request: Union[workflows.UpdateWorkflowRequest, dict] = None, + request: Optional[Union[workflows.UpdateWorkflowRequest, dict]] = None, *, - workflow: workflows.Workflow = None, - update_mask: field_mask_pb2.FieldMask = None, + workflow: Optional[workflows.Workflow] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Updates an existing workflow. @@ -761,7 +773,7 @@ async def sample_update_workflow(): print(response) Args: - request (Union[google.cloud.workflows_v1beta.types.UpdateWorkflowRequest, dict]): + request (Optional[Union[google.cloud.workflows_v1beta.types.UpdateWorkflowRequest, dict]]): The request object. Request for the [UpdateWorkflow][google.cloud.workflows.v1beta.Workflows.UpdateWorkflow] method. diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/client.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/client.py index 512876747994..5537779658b0 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/client.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/client.py @@ -16,18 +16,29 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -36,12 +47,14 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore -from google.cloud.workflows_v1beta.services.workflows import pagers -from google.cloud.workflows_v1beta.types import workflows from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import WorkflowsTransport, DEFAULT_CLIENT_INFO + +from google.cloud.workflows_v1beta.services.workflows import pagers +from google.cloud.workflows_v1beta.types import workflows + +from .transports.base import DEFAULT_CLIENT_INFO, WorkflowsTransport from .transports.grpc import WorkflowsGrpcTransport from .transports.grpc_asyncio import WorkflowsGrpcAsyncIOTransport @@ -60,7 +73,7 @@ class WorkflowsClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[WorkflowsTransport]: """Returns an appropriate transport class. @@ -338,8 +351,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, WorkflowsTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, WorkflowsTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the workflows client. @@ -353,7 +366,7 @@ def __init__( transport (Union[str, WorkflowsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -383,6 +396,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -435,11 +449,11 @@ def __init__( def list_workflows( self, - request: Union[workflows.ListWorkflowsRequest, dict] = None, + request: Optional[Union[workflows.ListWorkflowsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListWorkflowsPager: r"""Lists Workflows in a given project and location. @@ -555,11 +569,11 @@ def sample_list_workflows(): def get_workflow( self, - request: Union[workflows.GetWorkflowRequest, dict] = None, + request: Optional[Union[workflows.GetWorkflowRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> workflows.Workflow: r"""Gets details of a single Workflow. @@ -659,13 +673,13 @@ def sample_get_workflow(): def create_workflow( self, - request: Union[workflows.CreateWorkflowRequest, dict] = None, + request: Optional[Union[workflows.CreateWorkflowRequest, dict]] = None, *, - parent: str = None, - workflow: workflows.Workflow = None, - workflow_id: str = None, + parent: Optional[str] = None, + workflow: Optional[workflows.Workflow] = None, + workflow_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates a new workflow. If a workflow with the specified name @@ -813,11 +827,11 @@ def sample_create_workflow(): def delete_workflow( self, - request: Union[workflows.DeleteWorkflowRequest, dict] = None, + request: Optional[Union[workflows.DeleteWorkflowRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes a workflow with the specified name. @@ -941,12 +955,12 @@ def sample_delete_workflow(): def update_workflow( self, - request: Union[workflows.UpdateWorkflowRequest, dict] = None, + request: Optional[Union[workflows.UpdateWorkflowRequest, dict]] = None, *, - workflow: workflows.Workflow = None, - update_mask: field_mask_pb2.FieldMask = None, + workflow: Optional[workflows.Workflow] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Updates an existing workflow. diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/pagers.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/pagers.py index df59d04e4262..a4fd9b28769f 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/pagers.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/pagers.py @@ -18,10 +18,10 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) from google.cloud.workflows_v1beta.types import workflows diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/__init__.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/__init__.py index 189d3526dffc..3508736b2cc7 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/__init__.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import WorkflowsGrpcTransport from .grpc_asyncio import WorkflowsGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[WorkflowsTransport]] _transport_registry["grpc"] = WorkflowsGrpcTransport diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/base.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/base.py index a792d93dafbb..a9e2f1dd8115 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/base.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/base.py @@ -15,19 +15,18 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.workflows_v1beta.types import workflows -from google.longrunning import operations_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -50,7 +49,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py index 6108e1a233e1..59b1d01aa489 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/grpc.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from google.cloud.workflows_v1beta.types import workflows -from google.longrunning import operations_pb2 # type: ignore -from .base import WorkflowsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, WorkflowsTransport class WorkflowsGrpcTransport(WorkflowsTransport): @@ -51,14 +49,14 @@ def __init__( self, *, host: str = "workflows.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -186,8 +184,8 @@ def __init__( def create_channel( cls, host: str = "workflows.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/grpc_asyncio.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/grpc_asyncio.py index dffd53adc1f2..09aa3122bb44 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/grpc_asyncio.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/services/workflows/transports/grpc_asyncio.py @@ -13,21 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async -from google.api_core import operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.workflows_v1beta.types import workflows -from google.longrunning import operations_pb2 # type: ignore -from .base import WorkflowsTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, WorkflowsTransport from .grpc import WorkflowsGrpcTransport @@ -53,7 +51,7 @@ class WorkflowsGrpcAsyncIOTransport(WorkflowsTransport): def create_channel( cls, host: str = "workflows.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -96,15 +94,15 @@ def __init__( self, *, host: str = "workflows.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/types/workflows.py b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/types/workflows.py index 7d1d59da5fd5..385b839b4b42 100644 --- a/packages/google-cloud-workflows/google/cloud/workflows_v1beta/types/workflows.py +++ b/packages/google-cloud-workflows/google/cloud/workflows_v1beta/types/workflows.py @@ -13,11 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.workflows.v1beta", @@ -70,7 +70,7 @@ class Workflow(proto.Message): revision_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp that the latest revision of the workflow was created. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Labels associated with this workflow. Labels can contain at most 64 entries. Keys and values can be no longer than 63 characters and @@ -107,48 +107,48 @@ class State(proto.Enum): STATE_UNSPECIFIED = 0 ACTIVE = 1 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=3, enum=State, ) - revision_id = proto.Field( + revision_id: str = proto.Field( proto.STRING, number=4, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, ) - revision_create_time = proto.Field( + revision_create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=8, ) - service_account = proto.Field( + service_account: str = proto.Field( proto.STRING, number=9, ) - source_contents = proto.Field( + source_contents: str = proto.Field( proto.STRING, number=10, oneof="source_code", @@ -192,23 +192,23 @@ class ListWorkflowsRequest(proto.Message): in an unspecified order. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=4, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=5, ) @@ -220,13 +220,13 @@ class ListWorkflowsResponse(proto.Message): method. Attributes: - workflows (Sequence[google.cloud.workflows_v1beta.types.Workflow]): + workflows (MutableSequence[google.cloud.workflows_v1beta.types.Workflow]): The workflows which match the request. next_page_token (str): A token, which can be sent as ``page_token`` to retrieve the next page. If this field is omitted, there are no subsequent pages. - unreachable (Sequence[str]): + unreachable (MutableSequence[str]): Unreachable resources. """ @@ -234,16 +234,16 @@ class ListWorkflowsResponse(proto.Message): def raw_page(self): return self - workflows = proto.RepeatedField( + workflows: MutableSequence["Workflow"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Workflow", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - unreachable = proto.RepeatedField( + unreachable: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) @@ -261,7 +261,7 @@ class GetWorkflowRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -291,16 +291,16 @@ class CreateWorkflowRequest(proto.Message): - Must be unique within the customer project and location. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - workflow = proto.Field( + workflow: "Workflow" = proto.Field( proto.MESSAGE, number=2, message="Workflow", ) - workflow_id = proto.Field( + workflow_id: str = proto.Field( proto.STRING, number=3, ) @@ -318,7 +318,7 @@ class DeleteWorkflowRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -337,12 +337,12 @@ class UpdateWorkflowRequest(proto.Message): the entire workflow will be updated. """ - workflow = proto.Field( + workflow: "Workflow" = proto.Field( proto.MESSAGE, number=1, message="Workflow", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -366,25 +366,25 @@ class OperationMetadata(proto.Message): API version used to start the operation. """ - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - target = proto.Field( + target: str = proto.Field( proto.STRING, number=3, ) - verb = proto.Field( + verb: str = proto.Field( proto.STRING, number=4, ) - api_version = proto.Field( + api_version: str = proto.Field( proto.STRING, number=5, ) diff --git a/packages/google-cloud-workflows/noxfile.py b/packages/google-cloud-workflows/noxfile.py index d752b54f56da..d8440c023805 100644 --- a/packages/google-cloud-workflows/noxfile.py +++ b/packages/google-cloud-workflows/noxfile.py @@ -17,6 +17,7 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import re diff --git a/packages/google-cloud-workflows/owlbot.py b/packages/google-cloud-workflows/owlbot.py index 4e91774a0700..38b165d26f8e 100644 --- a/packages/google-cloud-workflows/owlbot.py +++ b/packages/google-cloud-workflows/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,15 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This script is used to synthesize generated parts of this library.""" -from pathlib import Path +import json from typing import List, Optional +from pathlib import Path +import shutil import synthtool as s import synthtool.gcp as gcp from synthtool.languages import python -common = gcp.CommonTemplates() +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- + +clean_up_generated_samples = True + +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get( + "default_version" +) # This is a customized version of the s.get_staging_dirs() function from synthtool to # cater for copying 2 different folders from googleapis-gen @@ -62,51 +72,36 @@ def get_staging_dirs( else: return [] -# This library ships clients for two different APIs, -# Workflows and Workflows Executions -workflows_default_version = "v1" -workflows_executions_default_version = "v1" -for library in get_staging_dirs(workflows_executions_default_version, "executions"): +for library in get_staging_dirs(default_version, "executions"): # Make sure this library is named 'google-cloud-workflows' s.replace( - library / "google/**/*.py", "google-cloud-workflows-executions", "google-cloud-workflow" - ) - - s.move( - library, - excludes=[ - "setup.py", - "README.rst", - "docs/index.rst", - f"scripts/fixup_executions_{library.name}_keywords.py", - ], + library / "google/**/*.py", "google-cloud-workflows-executions", "google-cloud-workflows" ) + s.move([library], excludes=["**/gapic_version.py", "docs/index.rst"]) # move workflows after executions, since we want to use "workflows" for the name -for library in get_staging_dirs(workflows_default_version, "workflows"): - s.move( - library, - excludes=[ - "setup.py", - "README.rst", - "docs/index.rst", - f"scripts/fixup_workflows_{library.name}_keywords.py", - ], - ) +for library in get_staging_dirs(default_version, "workflows"): + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + s.move([library], excludes=["**/gapic_version.py", "docs/index.rst"]) s.remove_staging_dirs() # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library(cov_level=100, microgenerator=True) -s.move( - templated_files, excludes=[".coveragerc"] -) # the microgenerator has a good coveragerc file +templated_files = gcp.CommonTemplates().py_library( + cov_level=100, + microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), +) +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml", "docs/index.rst"]) python.py_samples(skip_readmes=True) -python.configure_previous_major_version_branches() -s.shell.run(["nox", "-s", "blacken"], hide_output=False) +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/packages/google-cloud-workflows/release-please-config.json b/packages/google-cloud-workflows/release-please-config.json new file mode 100644 index 000000000000..2cbf9848e287 --- /dev/null +++ b/packages/google-cloud-workflows/release-please-config.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/workflows/executions/gapic_version.py", + "google/cloud/workflows/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.workflows.v1beta.json", + "jsonpath": "$.clientLibrary.version" + }, + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.workflows.v1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_executions_v1.json b/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_executions_v1.json deleted file mode 100644 index fa2266527c87..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_executions_v1.json +++ /dev/null @@ -1,666 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.cloud.workflows.executions.v1", - "version": "v1" - } - ], - "language": "PYTHON", - "name": "google-cloud-workflows-executions" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient", - "shortName": "ExecutionsAsyncClient" - }, - "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient.cancel_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1.Executions", - "shortName": "Executions" - }, - "shortName": "CancelExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1.types.CancelExecutionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1.types.Execution", - "shortName": "cancel_execution" - }, - "description": "Sample for CancelExecution", - "file": "workflowexecutions_v1_generated_executions_cancel_execution_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1_generated_Executions_CancelExecution_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1_generated_executions_cancel_execution_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient", - "shortName": "ExecutionsClient" - }, - "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient.cancel_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1.Executions.CancelExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1.Executions", - "shortName": "Executions" - }, - "shortName": "CancelExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1.types.CancelExecutionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1.types.Execution", - "shortName": "cancel_execution" - }, - "description": "Sample for CancelExecution", - "file": "workflowexecutions_v1_generated_executions_cancel_execution_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1_generated_Executions_CancelExecution_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1_generated_executions_cancel_execution_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient", - "shortName": "ExecutionsAsyncClient" - }, - "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient.create_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1.Executions", - "shortName": "Executions" - }, - "shortName": "CreateExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1.types.CreateExecutionRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "execution", - "type": "google.cloud.workflows.executions_v1.types.Execution" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1.types.Execution", - "shortName": "create_execution" - }, - "description": "Sample for CreateExecution", - "file": "workflowexecutions_v1_generated_executions_create_execution_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1_generated_Executions_CreateExecution_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1_generated_executions_create_execution_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient", - "shortName": "ExecutionsClient" - }, - "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient.create_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1.Executions.CreateExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1.Executions", - "shortName": "Executions" - }, - "shortName": "CreateExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1.types.CreateExecutionRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "execution", - "type": "google.cloud.workflows.executions_v1.types.Execution" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1.types.Execution", - "shortName": "create_execution" - }, - "description": "Sample for CreateExecution", - "file": "workflowexecutions_v1_generated_executions_create_execution_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1_generated_Executions_CreateExecution_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1_generated_executions_create_execution_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient", - "shortName": "ExecutionsAsyncClient" - }, - "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient.get_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1.Executions", - "shortName": "Executions" - }, - "shortName": "GetExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1.types.GetExecutionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1.types.Execution", - "shortName": "get_execution" - }, - "description": "Sample for GetExecution", - "file": "workflowexecutions_v1_generated_executions_get_execution_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1_generated_Executions_GetExecution_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1_generated_executions_get_execution_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient", - "shortName": "ExecutionsClient" - }, - "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient.get_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1.Executions.GetExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1.Executions", - "shortName": "Executions" - }, - "shortName": "GetExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1.types.GetExecutionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1.types.Execution", - "shortName": "get_execution" - }, - "description": "Sample for GetExecution", - "file": "workflowexecutions_v1_generated_executions_get_execution_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1_generated_Executions_GetExecution_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1_generated_executions_get_execution_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient", - "shortName": "ExecutionsAsyncClient" - }, - "fullName": "google.cloud.workflows.executions_v1.ExecutionsAsyncClient.list_executions", - "method": { - "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", - "service": { - "fullName": "google.cloud.workflows.executions.v1.Executions", - "shortName": "Executions" - }, - "shortName": "ListExecutions" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1.types.ListExecutionsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1.services.executions.pagers.ListExecutionsAsyncPager", - "shortName": "list_executions" - }, - "description": "Sample for ListExecutions", - "file": "workflowexecutions_v1_generated_executions_list_executions_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1_generated_Executions_ListExecutions_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1_generated_executions_list_executions_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient", - "shortName": "ExecutionsClient" - }, - "fullName": "google.cloud.workflows.executions_v1.ExecutionsClient.list_executions", - "method": { - "fullName": "google.cloud.workflows.executions.v1.Executions.ListExecutions", - "service": { - "fullName": "google.cloud.workflows.executions.v1.Executions", - "shortName": "Executions" - }, - "shortName": "ListExecutions" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1.types.ListExecutionsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1.services.executions.pagers.ListExecutionsPager", - "shortName": "list_executions" - }, - "description": "Sample for ListExecutions", - "file": "workflowexecutions_v1_generated_executions_list_executions_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1_generated_Executions_ListExecutions_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1_generated_executions_list_executions_sync.py" - } - ] -} diff --git a/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_executions_v1beta.json b/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_executions_v1beta.json deleted file mode 100644 index 8c508acad443..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_executions_v1beta.json +++ /dev/null @@ -1,666 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.cloud.workflows.executions.v1beta", - "version": "v1beta" - } - ], - "language": "PYTHON", - "name": "google-cloud-workflows-executions" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient", - "shortName": "ExecutionsAsyncClient" - }, - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient.cancel_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions", - "shortName": "Executions" - }, - "shortName": "CancelExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", - "shortName": "cancel_execution" - }, - "description": "Sample for CancelExecution", - "file": "workflowexecutions_v1beta_generated_executions_cancel_execution_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1beta_generated_Executions_CancelExecution_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1beta_generated_executions_cancel_execution_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient", - "shortName": "ExecutionsClient" - }, - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient.cancel_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CancelExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions", - "shortName": "Executions" - }, - "shortName": "CancelExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", - "shortName": "cancel_execution" - }, - "description": "Sample for CancelExecution", - "file": "workflowexecutions_v1beta_generated_executions_cancel_execution_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1beta_generated_Executions_CancelExecution_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1beta_generated_executions_cancel_execution_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient", - "shortName": "ExecutionsAsyncClient" - }, - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient.create_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions", - "shortName": "Executions" - }, - "shortName": "CreateExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "execution", - "type": "google.cloud.workflows.executions_v1beta.types.Execution" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", - "shortName": "create_execution" - }, - "description": "Sample for CreateExecution", - "file": "workflowexecutions_v1beta_generated_executions_create_execution_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1beta_generated_Executions_CreateExecution_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1beta_generated_executions_create_execution_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient", - "shortName": "ExecutionsClient" - }, - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient.create_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions.CreateExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions", - "shortName": "Executions" - }, - "shortName": "CreateExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "execution", - "type": "google.cloud.workflows.executions_v1beta.types.Execution" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", - "shortName": "create_execution" - }, - "description": "Sample for CreateExecution", - "file": "workflowexecutions_v1beta_generated_executions_create_execution_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1beta_generated_Executions_CreateExecution_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1beta_generated_executions_create_execution_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient", - "shortName": "ExecutionsAsyncClient" - }, - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient.get_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions", - "shortName": "Executions" - }, - "shortName": "GetExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1beta.types.GetExecutionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", - "shortName": "get_execution" - }, - "description": "Sample for GetExecution", - "file": "workflowexecutions_v1beta_generated_executions_get_execution_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1beta_generated_Executions_GetExecution_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1beta_generated_executions_get_execution_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient", - "shortName": "ExecutionsClient" - }, - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient.get_execution", - "method": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions.GetExecution", - "service": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions", - "shortName": "Executions" - }, - "shortName": "GetExecution" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1beta.types.GetExecutionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1beta.types.Execution", - "shortName": "get_execution" - }, - "description": "Sample for GetExecution", - "file": "workflowexecutions_v1beta_generated_executions_get_execution_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1beta_generated_Executions_GetExecution_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1beta_generated_executions_get_execution_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient", - "shortName": "ExecutionsAsyncClient" - }, - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsAsyncClient.list_executions", - "method": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", - "service": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions", - "shortName": "Executions" - }, - "shortName": "ListExecutions" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsAsyncPager", - "shortName": "list_executions" - }, - "description": "Sample for ListExecutions", - "file": "workflowexecutions_v1beta_generated_executions_list_executions_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1beta_generated_Executions_ListExecutions_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1beta_generated_executions_list_executions_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient", - "shortName": "ExecutionsClient" - }, - "fullName": "google.cloud.workflows.executions_v1beta.ExecutionsClient.list_executions", - "method": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions.ListExecutions", - "service": { - "fullName": "google.cloud.workflows.executions.v1beta.Executions", - "shortName": "Executions" - }, - "shortName": "ListExecutions" - }, - "parameters": [ - { - "name": "request", - "type": "google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsPager", - "shortName": "list_executions" - }, - "description": "Sample for ListExecutions", - "file": "workflowexecutions_v1beta_generated_executions_list_executions_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "workflowexecutions_v1beta_generated_Executions_ListExecutions_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "workflowexecutions_v1beta_generated_executions_list_executions_sync.py" - } - ] -} diff --git a/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_workflows_v1.json b/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_google.cloud.workflows.v1.json similarity index 99% rename from packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_workflows_v1.json rename to packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_google.cloud.workflows.v1.json index b5192d085bcb..5eeb3c21a076 100644 --- a/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_workflows_v1.json +++ b/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_google.cloud.workflows.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-workflows" + "name": "google-cloud-workflows", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_workflows_v1beta.json b/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_google.cloud.workflows.v1beta.json similarity index 99% rename from packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_workflows_v1beta.json rename to packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_google.cloud.workflows.v1beta.json index 92e925678449..e6e1022f77a9 100644 --- a/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_workflows_v1beta.json +++ b/packages/google-cloud-workflows/samples/generated_samples/snippet_metadata_google.cloud.workflows.v1beta.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-workflows" + "name": "google-cloud-workflows", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_cancel_execution_async.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_cancel_execution_async.py deleted file mode 100644 index dec5b2f76b96..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_cancel_execution_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CancelExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1_generated_Executions_CancelExecution_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1 - - -async def sample_cancel_execution(): - # Create a client - client = executions_v1.ExecutionsAsyncClient() - - # Initialize request argument(s) - request = executions_v1.CancelExecutionRequest( - name="name_value", - ) - - # Make the request - response = await client.cancel_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1_generated_Executions_CancelExecution_async] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_cancel_execution_sync.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_cancel_execution_sync.py deleted file mode 100644 index 5a21a7f43e34..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_cancel_execution_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CancelExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1_generated_Executions_CancelExecution_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1 - - -def sample_cancel_execution(): - # Create a client - client = executions_v1.ExecutionsClient() - - # Initialize request argument(s) - request = executions_v1.CancelExecutionRequest( - name="name_value", - ) - - # Make the request - response = client.cancel_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1_generated_Executions_CancelExecution_sync] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_create_execution_async.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_create_execution_async.py deleted file mode 100644 index d8ea196946c7..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_create_execution_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1_generated_Executions_CreateExecution_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1 - - -async def sample_create_execution(): - # Create a client - client = executions_v1.ExecutionsAsyncClient() - - # Initialize request argument(s) - request = executions_v1.CreateExecutionRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1_generated_Executions_CreateExecution_async] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_create_execution_sync.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_create_execution_sync.py deleted file mode 100644 index ff6adb4396b9..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_create_execution_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1_generated_Executions_CreateExecution_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1 - - -def sample_create_execution(): - # Create a client - client = executions_v1.ExecutionsClient() - - # Initialize request argument(s) - request = executions_v1.CreateExecutionRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1_generated_Executions_CreateExecution_sync] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_get_execution_async.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_get_execution_async.py deleted file mode 100644 index 1bb1ca219895..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_get_execution_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1_generated_Executions_GetExecution_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1 - - -async def sample_get_execution(): - # Create a client - client = executions_v1.ExecutionsAsyncClient() - - # Initialize request argument(s) - request = executions_v1.GetExecutionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1_generated_Executions_GetExecution_async] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_get_execution_sync.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_get_execution_sync.py deleted file mode 100644 index 8e3dab630c9d..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_get_execution_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1_generated_Executions_GetExecution_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1 - - -def sample_get_execution(): - # Create a client - client = executions_v1.ExecutionsClient() - - # Initialize request argument(s) - request = executions_v1.GetExecutionRequest( - name="name_value", - ) - - # Make the request - response = client.get_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1_generated_Executions_GetExecution_sync] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_list_executions_async.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_list_executions_async.py deleted file mode 100644 index df9626848045..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_list_executions_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListExecutions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1_generated_Executions_ListExecutions_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1 - - -async def sample_list_executions(): - # Create a client - client = executions_v1.ExecutionsAsyncClient() - - # Initialize request argument(s) - request = executions_v1.ListExecutionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_executions(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END workflowexecutions_v1_generated_Executions_ListExecutions_async] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_list_executions_sync.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_list_executions_sync.py deleted file mode 100644 index 229c9bc78cfa..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1_generated_executions_list_executions_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListExecutions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1_generated_Executions_ListExecutions_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1 - - -def sample_list_executions(): - # Create a client - client = executions_v1.ExecutionsClient() - - # Initialize request argument(s) - request = executions_v1.ListExecutionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_executions(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END workflowexecutions_v1_generated_Executions_ListExecutions_sync] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_cancel_execution_async.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_cancel_execution_async.py deleted file mode 100644 index ca8a19225978..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_cancel_execution_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CancelExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1beta_generated_Executions_CancelExecution_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1beta - - -async def sample_cancel_execution(): - # Create a client - client = executions_v1beta.ExecutionsAsyncClient() - - # Initialize request argument(s) - request = executions_v1beta.CancelExecutionRequest( - name="name_value", - ) - - # Make the request - response = await client.cancel_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1beta_generated_Executions_CancelExecution_async] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_cancel_execution_sync.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_cancel_execution_sync.py deleted file mode 100644 index 7c93d18a41b8..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_cancel_execution_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CancelExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1beta_generated_Executions_CancelExecution_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1beta - - -def sample_cancel_execution(): - # Create a client - client = executions_v1beta.ExecutionsClient() - - # Initialize request argument(s) - request = executions_v1beta.CancelExecutionRequest( - name="name_value", - ) - - # Make the request - response = client.cancel_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1beta_generated_Executions_CancelExecution_sync] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_create_execution_async.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_create_execution_async.py deleted file mode 100644 index 65472310ce40..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_create_execution_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1beta_generated_Executions_CreateExecution_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1beta - - -async def sample_create_execution(): - # Create a client - client = executions_v1beta.ExecutionsAsyncClient() - - # Initialize request argument(s) - request = executions_v1beta.CreateExecutionRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1beta_generated_Executions_CreateExecution_async] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_create_execution_sync.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_create_execution_sync.py deleted file mode 100644 index 52033ce4ed5d..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_create_execution_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1beta_generated_Executions_CreateExecution_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1beta - - -def sample_create_execution(): - # Create a client - client = executions_v1beta.ExecutionsClient() - - # Initialize request argument(s) - request = executions_v1beta.CreateExecutionRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1beta_generated_Executions_CreateExecution_sync] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_get_execution_async.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_get_execution_async.py deleted file mode 100644 index 5cdbbecf5f86..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_get_execution_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1beta_generated_Executions_GetExecution_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1beta - - -async def sample_get_execution(): - # Create a client - client = executions_v1beta.ExecutionsAsyncClient() - - # Initialize request argument(s) - request = executions_v1beta.GetExecutionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1beta_generated_Executions_GetExecution_async] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_get_execution_sync.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_get_execution_sync.py deleted file mode 100644 index 9e92969ace90..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_get_execution_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetExecution -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1beta_generated_Executions_GetExecution_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1beta - - -def sample_get_execution(): - # Create a client - client = executions_v1beta.ExecutionsClient() - - # Initialize request argument(s) - request = executions_v1beta.GetExecutionRequest( - name="name_value", - ) - - # Make the request - response = client.get_execution(request=request) - - # Handle the response - print(response) - -# [END workflowexecutions_v1beta_generated_Executions_GetExecution_sync] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_list_executions_async.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_list_executions_async.py deleted file mode 100644 index c81130a24dd7..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_list_executions_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListExecutions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1beta_generated_Executions_ListExecutions_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1beta - - -async def sample_list_executions(): - # Create a client - client = executions_v1beta.ExecutionsAsyncClient() - - # Initialize request argument(s) - request = executions_v1beta.ListExecutionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_executions(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END workflowexecutions_v1beta_generated_Executions_ListExecutions_async] diff --git a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_list_executions_sync.py b/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_list_executions_sync.py deleted file mode 100644 index a47db99597f9..000000000000 --- a/packages/google-cloud-workflows/samples/generated_samples/workflowexecutions_v1beta_generated_executions_list_executions_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListExecutions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-workflows-executions - - -# [START workflowexecutions_v1beta_generated_Executions_ListExecutions_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.cloud.workflows import executions_v1beta - - -def sample_list_executions(): - # Create a client - client = executions_v1beta.ExecutionsClient() - - # Initialize request argument(s) - request = executions_v1beta.ListExecutionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_executions(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END workflowexecutions_v1beta_generated_Executions_ListExecutions_sync] diff --git a/packages/google-cloud-workflows/scripts/fixup_executions_v1_keywords.py b/packages/google-cloud-workflows/scripts/fixup_executions_v1_keywords.py new file mode 100644 index 000000000000..63927a2bc697 --- /dev/null +++ b/packages/google-cloud-workflows/scripts/fixup_executions_v1_keywords.py @@ -0,0 +1,179 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class executionsCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'cancel_execution': ('name', ), + 'create_execution': ('parent', 'execution', ), + 'get_execution': ('name', 'view', ), + 'list_executions': ('parent', 'page_size', 'page_token', 'view', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=executionsCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the executions client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/packages/google-cloud-workflows/scripts/fixup_executions_v1beta_keywords.py b/packages/google-cloud-workflows/scripts/fixup_executions_v1beta_keywords.py new file mode 100644 index 000000000000..63927a2bc697 --- /dev/null +++ b/packages/google-cloud-workflows/scripts/fixup_executions_v1beta_keywords.py @@ -0,0 +1,179 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class executionsCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'cancel_execution': ('name', ), + 'create_execution': ('parent', 'execution', ), + 'get_execution': ('name', 'view', ), + 'list_executions': ('parent', 'page_size', 'page_token', 'view', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=executionsCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the executions client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/packages/google-cloud-workflows/scripts/fixup_workflows_v1_keywords.py b/packages/google-cloud-workflows/scripts/fixup_workflows_v1_keywords.py new file mode 100644 index 000000000000..a48ee47f8fd3 --- /dev/null +++ b/packages/google-cloud-workflows/scripts/fixup_workflows_v1_keywords.py @@ -0,0 +1,180 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class workflowsCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'create_workflow': ('parent', 'workflow', 'workflow_id', ), + 'delete_workflow': ('name', ), + 'get_workflow': ('name', ), + 'list_workflows': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'update_workflow': ('workflow', 'update_mask', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=workflowsCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the workflows client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/packages/google-cloud-workflows/scripts/fixup_workflows_v1beta_keywords.py b/packages/google-cloud-workflows/scripts/fixup_workflows_v1beta_keywords.py new file mode 100644 index 000000000000..a48ee47f8fd3 --- /dev/null +++ b/packages/google-cloud-workflows/scripts/fixup_workflows_v1beta_keywords.py @@ -0,0 +1,180 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class workflowsCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'create_workflow': ('parent', 'workflow', 'workflow_id', ), + 'delete_workflow': ('name', ), + 'get_workflow': ('name', ), + 'list_workflows': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), + 'update_workflow': ('workflow', 'update_mask', ), + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: a.keyword.value not in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), +cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=workflowsCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the workflows client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/packages/google-cloud-workflows/setup.py b/packages/google-cloud-workflows/setup.py index 2aaac40a9221..601a86a1b3bb 100644 --- a/packages/google-cloud-workflows/setup.py +++ b/packages/google-cloud-workflows/setup.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,12 +13,34 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import io import os + import setuptools # type: ignore -version = "1.7.4" +package_root = os.path.abspath(os.path.dirname(__file__)) + +name = "google-cloud-workflows" + + +description = "Google Cloud Workflows API client library" + +version = {} +with open(os.path.join(package_root, "google/cloud/workflows/gapic_version.py")) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + +dependencies = [ + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "proto-plus >= 1.22.0, <2.0.0dev", + "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", +] +url = "https://github.com/googleapis/python-workflows" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -33,34 +54,37 @@ if package.startswith("google") ] +namespaces = ["google"] +if "google.cloud" in packages: + namespaces.append("google.cloud") + setuptools.setup( - name="google-cloud-workflows", + name=name, version=version, + description=description, long_description=readme, author="Google LLC", author_email="googleapis-packages@google.com", license="Apache 2.0", - url="https://github.com/googleapis/python-workflows", - packages=packages, - namespace_packages=("google", "google.cloud"), - platforms="Posix; MacOS X; Windows", - include_package_data=True, - install_requires=( - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", - "proto-plus >= 1.22.0, <2.0.0dev", - "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", - ), - python_requires=">=3.7", + url=url, classifiers=[ - "Development Status :: 5 - Production/Stable", + release_status, "Intended Audience :: Developers", - "Operating System :: OS Independent", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Operating System :: OS Independent", "Topic :: Internet", - "Topic :: Software Development :: Libraries :: Python Modules", ], + platforms="Posix; MacOS X; Windows", + packages=packages, + python_requires=">=3.7", + namespace_packages=namespaces, + install_requires=dependencies, + include_package_data=True, zip_safe=False, ) diff --git a/packages/google-cloud-workflows/testing/constraints-3.10.txt b/packages/google-cloud-workflows/testing/constraints-3.10.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-workflows/testing/constraints-3.10.txt +++ b/packages/google-cloud-workflows/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-workflows/testing/constraints-3.11.txt b/packages/google-cloud-workflows/testing/constraints-3.11.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-workflows/testing/constraints-3.11.txt +++ b/packages/google-cloud-workflows/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-workflows/testing/constraints-3.7.txt b/packages/google-cloud-workflows/testing/constraints-3.7.txt index 5dcaa6fd1884..6f3158cc2034 100644 --- a/packages/google-cloud-workflows/testing/constraints-3.7.txt +++ b/packages/google-cloud-workflows/testing/constraints-3.7.txt @@ -1,10 +1,9 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.32.0 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5 diff --git a/packages/google-cloud-workflows/testing/constraints-3.8.txt b/packages/google-cloud-workflows/testing/constraints-3.8.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-workflows/testing/constraints-3.8.txt +++ b/packages/google-cloud-workflows/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-workflows/testing/constraints-3.9.txt b/packages/google-cloud-workflows/testing/constraints-3.9.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-workflows/testing/constraints-3.9.txt +++ b/packages/google-cloud-workflows/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-workflows/tests/unit/gapic/executions_v1/test_executions.py b/packages/google-cloud-workflows/tests/unit/gapic/executions_v1/test_executions.py index 890f8bb6c16e..349515084023 100644 --- a/packages/google-cloud-workflows/tests/unit/gapic/executions_v1/test_executions.py +++ b/packages/google-cloud-workflows/tests/unit/gapic/executions_v1/test_executions.py @@ -22,31 +22,29 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.workflows.executions_v1.services.executions import ( ExecutionsAsyncClient, + ExecutionsClient, + pagers, + transports, ) -from google.cloud.workflows.executions_v1.services.executions import ExecutionsClient -from google.cloud.workflows.executions_v1.services.executions import pagers -from google.cloud.workflows.executions_v1.services.executions import transports from google.cloud.workflows.executions_v1.types import executions -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth def client_cert_source_callback(): diff --git a/packages/google-cloud-workflows/tests/unit/gapic/executions_v1beta/test_executions.py b/packages/google-cloud-workflows/tests/unit/gapic/executions_v1beta/test_executions.py index 715fc7e4a3e4..d974e600f52a 100644 --- a/packages/google-cloud-workflows/tests/unit/gapic/executions_v1beta/test_executions.py +++ b/packages/google-cloud-workflows/tests/unit/gapic/executions_v1beta/test_executions.py @@ -22,33 +22,29 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.workflows.executions_v1beta.services.executions import ( ExecutionsAsyncClient, -) -from google.cloud.workflows.executions_v1beta.services.executions import ( ExecutionsClient, + pagers, + transports, ) -from google.cloud.workflows.executions_v1beta.services.executions import pagers -from google.cloud.workflows.executions_v1beta.services.executions import transports from google.cloud.workflows.executions_v1beta.types import executions -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth def client_cert_source_callback(): diff --git a/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1/test_workflows.py b/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1/test_workflows.py index 27c285756ac2..46009d9c4244 100644 --- a/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1/test_workflows.py +++ b/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1/test_workflows.py @@ -22,35 +22,41 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.workflows_v1.services.workflows import WorkflowsAsyncClient -from google.cloud.workflows_v1.services.workflows import WorkflowsClient -from google.cloud.workflows_v1.services.workflows import pagers -from google.cloud.workflows_v1.services.workflows import transports -from google.cloud.workflows_v1.types import workflows from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.workflows_v1.services.workflows import ( + WorkflowsAsyncClient, + WorkflowsClient, + pagers, + transports, +) +from google.cloud.workflows_v1.types import workflows def client_cert_source_callback(): diff --git a/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1beta/test_workflows.py b/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1beta/test_workflows.py index 5226989f6d47..8c863d5c6f44 100644 --- a/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1beta/test_workflows.py +++ b/packages/google-cloud-workflows/tests/unit/gapic/workflows_v1beta/test_workflows.py @@ -22,35 +22,41 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.workflows_v1beta.services.workflows import WorkflowsAsyncClient -from google.cloud.workflows_v1beta.services.workflows import WorkflowsClient -from google.cloud.workflows_v1beta.services.workflows import pagers -from google.cloud.workflows_v1beta.services.workflows import transports -from google.cloud.workflows_v1beta.types import workflows from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import empty_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.workflows_v1beta.services.workflows import ( + WorkflowsAsyncClient, + WorkflowsClient, + pagers, + transports, +) +from google.cloud.workflows_v1beta.types import workflows def client_cert_source_callback():