From 887df0046f4350cb515036fba4df608d8adec687 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Thu, 21 Jan 2021 07:42:37 -0800 Subject: [PATCH] chore: upgrade gapic-generator-python to 0.39.1 (#16) feat: add 'from_service_account_info' factory to clients fix: fix sphinx identifiers PiperOrigin-RevId: 350246057 Source-Author: Google APIs Source-Date: Tue Jan 5 16:44:11 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 520682435235d9c503983a360a2090025aa47cd1 Source-Link: https://github.com/googleapis/googleapis/commit/520682435235d9c503983a360a2090025aa47cd1 Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- .coveragerc | 18 ++++ docs/executions_v1beta/executions.rst | 11 +++ docs/executions_v1beta/services.rst | 6 +- docs/executions_v1beta/types.rst | 1 + docs/workflows_v1beta/services.rst | 6 +- docs/workflows_v1beta/types.rst | 1 + docs/workflows_v1beta/workflows.rst | 11 +++ .../services/executions/async_client.py | 27 ++--- .../services/executions/client.py | 56 +++++++---- .../services/executions/pagers.py | 16 +-- .../executions_v1beta/types/executions.py | 16 +-- .../services/workflows/async_client.py | 67 +++++++------ .../services/workflows/client.py | 98 +++++++++++-------- .../services/workflows/pagers.py | 16 +-- .../cloud/workflows_v1beta/types/workflows.py | 22 ++--- synth.metadata | 9 +- .../executions_v1beta/test_executions.py | 30 ++++-- .../gapic/workflows_v1beta/test_workflows.py | 30 ++++-- 18 files changed, 284 insertions(+), 157 deletions(-) create mode 100644 .coveragerc create mode 100644 docs/executions_v1beta/executions.rst create mode 100644 docs/workflows_v1beta/workflows.rst diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..cacb7df --- /dev/null +++ b/.coveragerc @@ -0,0 +1,18 @@ +[run] +branch = True + +[report] +fail_under = 100 +show_missing = True +omit = + google/cloud/workflows/__init__.py +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ + # Ignore pkg_resources exceptions. + # This is added at the module level as a safeguard for if someone + # generates the code and tries to run it without pip installing. This + # makes it virtually impossible to test properly. + except pkg_resources.DistributionNotFound diff --git a/docs/executions_v1beta/executions.rst b/docs/executions_v1beta/executions.rst new file mode 100644 index 0000000..d591170 --- /dev/null +++ b/docs/executions_v1beta/executions.rst @@ -0,0 +1,11 @@ +Executions +---------------------------- + +.. automodule:: google.cloud.workflows.executions_v1beta.services.executions + :members: + :inherited-members: + + +.. automodule:: google.cloud.workflows.executions_v1beta.services.executions.pagers + :members: + :inherited-members: diff --git a/docs/executions_v1beta/services.rst b/docs/executions_v1beta/services.rst index 23a1390..f6ae17a 100644 --- a/docs/executions_v1beta/services.rst +++ b/docs/executions_v1beta/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Workflows Executions v1beta API ========================================================= +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.workflows.executions_v1beta.services.executions - :members: - :inherited-members: + executions diff --git a/docs/executions_v1beta/types.rst b/docs/executions_v1beta/types.rst index 6c92f22..0bb638b 100644 --- a/docs/executions_v1beta/types.rst +++ b/docs/executions_v1beta/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Workflows Executions v1beta API .. automodule:: google.cloud.workflows.executions_v1beta.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/workflows_v1beta/services.rst b/docs/workflows_v1beta/services.rst index a500b9a..ad4e93d 100644 --- a/docs/workflows_v1beta/services.rst +++ b/docs/workflows_v1beta/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Workflows v1beta API ============================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.workflows_v1beta.services.workflows - :members: - :inherited-members: + workflows diff --git a/docs/workflows_v1beta/types.rst b/docs/workflows_v1beta/types.rst index 0b7a857..35bf3fd 100644 --- a/docs/workflows_v1beta/types.rst +++ b/docs/workflows_v1beta/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Workflows v1beta API .. automodule:: google.cloud.workflows_v1beta.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/workflows_v1beta/workflows.rst b/docs/workflows_v1beta/workflows.rst new file mode 100644 index 0000000..381d505 --- /dev/null +++ b/docs/workflows_v1beta/workflows.rst @@ -0,0 +1,11 @@ +Workflows +--------------------------- + +.. automodule:: google.cloud.workflows_v1beta.services.workflows + :members: + :inherited-members: + + +.. automodule:: google.cloud.workflows_v1beta.services.workflows.pagers + :members: + :inherited-members: diff --git a/google/cloud/workflows/executions_v1beta/services/executions/async_client.py b/google/cloud/workflows/executions_v1beta/services/executions/async_client.py index 2fc2efe..5af0504 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/async_client.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/async_client.py @@ -76,6 +76,7 @@ class ExecutionsAsyncClient: ExecutionsClient.parse_common_location_path ) + from_service_account_info = ExecutionsClient.from_service_account_info from_service_account_file = ExecutionsClient.from_service_account_file from_service_account_json = from_service_account_file @@ -156,7 +157,7 @@ async def list_executions( first). Args: - request (:class:`~.executions.ListExecutionsRequest`): + request (:class:`google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest`): The request object. Request for the [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] method. @@ -165,6 +166,7 @@ async def list_executions( which the executions should be listed. Format: projects/{project}/locations/{location}/workflows/{workflow} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -176,10 +178,10 @@ async def list_executions( sent along with the request as metadata. Returns: - ~.pagers.ListExecutionsAsyncPager: + google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsAsyncPager: Response for the - [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] - method. + [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] + method. Iterating over this object will yield results and resolve additional pages automatically. @@ -243,7 +245,7 @@ async def create_execution( the given workflow. Args: - request (:class:`~.executions.CreateExecutionRequest`): + request (:class:`google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest`): The request object. Request for the [CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution] method. @@ -254,10 +256,11 @@ async def create_execution( projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the workflow will be used. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - execution (:class:`~.executions.Execution`): + execution (:class:`google.cloud.workflows.executions_v1beta.types.Execution`): Required. Execution to be created. This corresponds to the ``execution`` field on the ``request`` instance; if ``request`` is provided, this @@ -270,7 +273,7 @@ async def create_execution( sent along with the request as metadata. Returns: - ~.executions.Execution: + google.cloud.workflows.executions_v1beta.types.Execution: A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. @@ -327,7 +330,7 @@ async def get_execution( r"""Returns an execution of the given name. Args: - request (:class:`~.executions.GetExecutionRequest`): + request (:class:`google.cloud.workflows.executions_v1beta.types.GetExecutionRequest`): The request object. Request for the [GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution] method. @@ -335,6 +338,7 @@ async def get_execution( Required. Name of the execution to be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -346,7 +350,7 @@ async def get_execution( sent along with the request as metadata. Returns: - ~.executions.Execution: + google.cloud.workflows.executions_v1beta.types.Execution: A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. @@ -401,7 +405,7 @@ async def cancel_execution( r"""Cancels an execution of the given name. Args: - request (:class:`~.executions.CancelExecutionRequest`): + request (:class:`google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest`): The request object. Request for the [CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution] method. @@ -409,6 +413,7 @@ async def cancel_execution( Required. Name of the execution to be cancelled. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -420,7 +425,7 @@ async def cancel_execution( sent along with the request as metadata. Returns: - ~.executions.Execution: + google.cloud.workflows.executions_v1beta.types.Execution: A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. diff --git a/google/cloud/workflows/executions_v1beta/services/executions/client.py b/google/cloud/workflows/executions_v1beta/services/executions/client.py index 2b8606a..fa61c98 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/client.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/client.py @@ -112,6 +112,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ExecutionsClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -124,7 +140,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ExecutionsClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -250,10 +266,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.ExecutionsTransport]): The + transport (Union[str, ExecutionsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -367,15 +383,16 @@ def list_executions( first). Args: - request (:class:`~.executions.ListExecutionsRequest`): + request (google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest): The request object. Request for the [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] method. - parent (:class:`str`): + parent (str): Required. Name of the workflow for which the executions should be listed. Format: projects/{project}/locations/{location}/workflows/{workflow} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -387,10 +404,10 @@ def list_executions( sent along with the request as metadata. Returns: - ~.pagers.ListExecutionsPager: + google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsPager: Response for the - [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] - method. + [ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions] + method. Iterating over this object will yield results and resolve additional pages automatically. @@ -455,21 +472,22 @@ def create_execution( the given workflow. Args: - request (:class:`~.executions.CreateExecutionRequest`): + request (google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest): The request object. Request for the [CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution] method. - parent (:class:`str`): + parent (str): Required. Name of the workflow for which an execution should be created. Format: projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the workflow will be used. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - execution (:class:`~.executions.Execution`): + execution (google.cloud.workflows.executions_v1beta.types.Execution): Required. Execution to be created. This corresponds to the ``execution`` field on the ``request`` instance; if ``request`` is provided, this @@ -482,7 +500,7 @@ def create_execution( sent along with the request as metadata. Returns: - ~.executions.Execution: + google.cloud.workflows.executions_v1beta.types.Execution: A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. @@ -540,14 +558,15 @@ def get_execution( r"""Returns an execution of the given name. Args: - request (:class:`~.executions.GetExecutionRequest`): + request (google.cloud.workflows.executions_v1beta.types.GetExecutionRequest): The request object. Request for the [GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution] method. - name (:class:`str`): + name (str): Required. Name of the execution to be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -559,7 +578,7 @@ def get_execution( sent along with the request as metadata. Returns: - ~.executions.Execution: + google.cloud.workflows.executions_v1beta.types.Execution: A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. @@ -615,14 +634,15 @@ def cancel_execution( r"""Cancels an execution of the given name. Args: - request (:class:`~.executions.CancelExecutionRequest`): + request (google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest): The request object. Request for the [CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution] method. - name (:class:`str`): + name (str): Required. Name of the execution to be cancelled. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -634,7 +654,7 @@ def cancel_execution( sent along with the request as metadata. Returns: - ~.executions.Execution: + google.cloud.workflows.executions_v1beta.types.Execution: A running instance of a [Workflow][google.cloud.workflows.v1beta.Workflow]. diff --git a/google/cloud/workflows/executions_v1beta/services/executions/pagers.py b/google/cloud/workflows/executions_v1beta/services/executions/pagers.py index 61674d5..97b93c9 100644 --- a/google/cloud/workflows/executions_v1beta/services/executions/pagers.py +++ b/google/cloud/workflows/executions_v1beta/services/executions/pagers.py @@ -24,7 +24,7 @@ class ListExecutionsPager: """A pager for iterating through ``list_executions`` requests. This class thinly wraps an initial - :class:`~.executions.ListExecutionsResponse` object, and + :class:`google.cloud.workflows.executions_v1beta.types.ListExecutionsResponse` object, and provides an ``__iter__`` method to iterate through its ``executions`` field. @@ -33,7 +33,7 @@ class ListExecutionsPager: through the ``executions`` field on the corresponding responses. - All the usual :class:`~.executions.ListExecutionsResponse` + All the usual :class:`google.cloud.workflows.executions_v1beta.types.ListExecutionsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.executions.ListExecutionsRequest`): + request (google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest): The initial request object. - response (:class:`~.executions.ListExecutionsResponse`): + response (google.cloud.workflows.executions_v1beta.types.ListExecutionsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListExecutionsAsyncPager: """A pager for iterating through ``list_executions`` requests. This class thinly wraps an initial - :class:`~.executions.ListExecutionsResponse` object, and + :class:`google.cloud.workflows.executions_v1beta.types.ListExecutionsResponse` object, and provides an ``__aiter__`` method to iterate through its ``executions`` field. @@ -95,7 +95,7 @@ class ListExecutionsAsyncPager: through the ``executions`` field on the corresponding responses. - All the usual :class:`~.executions.ListExecutionsResponse` + All the usual :class:`google.cloud.workflows.executions_v1beta.types.ListExecutionsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -113,9 +113,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.executions.ListExecutionsRequest`): + request (google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest): The initial request object. - response (:class:`~.executions.ListExecutionsResponse`): + response (google.cloud.workflows.executions_v1beta.types.ListExecutionsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/workflows/executions_v1beta/types/executions.py b/google/cloud/workflows/executions_v1beta/types/executions.py index ebcdc49..a69e778 100644 --- a/google/cloud/workflows/executions_v1beta/types/executions.py +++ b/google/cloud/workflows/executions_v1beta/types/executions.py @@ -51,13 +51,13 @@ class Execution(proto.Message): Output only. The resource name of the execution. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Marks the beginning of execution. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Marks the end of execution, successful or not. - state (~.gcwe_executions.Execution.State): + state (google.cloud.workflows.executions_v1beta.types.Execution.State): Output only. Current state of the execution. argument (str): Input parameters of the execution represented @@ -66,7 +66,7 @@ class Execution(proto.Message): Output only. Output of the execution represented as a JSON string. The value can only be present if the execution's state is ``SUCCEEDED``. - error (~.gcwe_executions.Execution.Error): + error (google.cloud.workflows.executions_v1beta.types.Execution.Error): Output only. The error which caused the execution to finish prematurely. The value is only present if the execution's state is ``FAILED`` or ``CANCELLED``. @@ -143,7 +143,7 @@ class ListExecutionsRequest(proto.Message): When paginating, all other parameters provided to ``ListExecutions`` must match the call that provided the page token. - view (~.gcwe_executions.ExecutionView): + view (google.cloud.workflows.executions_v1beta.types.ExecutionView): Optional. A view defining which fields should be filled in the returned executions. The API will default to the BASIC view. @@ -164,7 +164,7 @@ class ListExecutionsResponse(proto.Message): method. Attributes: - executions (Sequence[~.gcwe_executions.Execution]): + executions (Sequence[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 @@ -193,7 +193,7 @@ class CreateExecutionRequest(proto.Message): projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the workflow will be used. - execution (~.gcwe_executions.Execution): + execution (google.cloud.workflows.executions_v1beta.types.Execution): Required. Execution to be created. """ @@ -212,7 +212,7 @@ class GetExecutionRequest(proto.Message): Required. Name of the execution to be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - view (~.gcwe_executions.ExecutionView): + view (google.cloud.workflows.executions_v1beta.types.ExecutionView): Optional. A view defining which fields should be filled in the returned execution. The API will default to the FULL view. diff --git a/google/cloud/workflows_v1beta/services/workflows/async_client.py b/google/cloud/workflows_v1beta/services/workflows/async_client.py index 2e77197..15078b3 100644 --- a/google/cloud/workflows_v1beta/services/workflows/async_client.py +++ b/google/cloud/workflows_v1beta/services/workflows/async_client.py @@ -78,6 +78,7 @@ class WorkflowsAsyncClient: WorkflowsClient.parse_common_location_path ) + from_service_account_info = WorkflowsClient.from_service_account_info from_service_account_file = WorkflowsClient.from_service_account_file from_service_account_json = from_service_account_file @@ -155,7 +156,7 @@ async def list_workflows( The default order is not specified. Args: - request (:class:`~.workflows.ListWorkflowsRequest`): + request (:class:`google.cloud.workflows_v1beta.types.ListWorkflowsRequest`): The request object. Request for the [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] method. @@ -164,6 +165,7 @@ async def list_workflows( which the workflows should be listed. Format: projects/{project}/locations/{location} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -175,10 +177,10 @@ async def list_workflows( sent along with the request as metadata. Returns: - ~.pagers.ListWorkflowsAsyncPager: + google.cloud.workflows_v1beta.services.workflows.pagers.ListWorkflowsAsyncPager: Response for the - [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] - method. + [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] + method. Iterating over this object will yield results and resolve additional pages automatically. @@ -240,7 +242,7 @@ async def get_workflow( r"""Gets details of a single Workflow. Args: - request (:class:`~.workflows.GetWorkflowRequest`): + request (:class:`google.cloud.workflows_v1beta.types.GetWorkflowRequest`): The request object. Request for the [GetWorkflow][google.cloud.workflows.v1beta.Workflows.GetWorkflow] method. @@ -248,6 +250,7 @@ async def get_workflow( Required. Name of the workflow which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -259,7 +262,7 @@ async def get_workflow( sent along with the request as metadata. Returns: - ~.workflows.Workflow: + google.cloud.workflows_v1beta.types.Workflow: Workflow program to be executed by Workflows. @@ -319,7 +322,7 @@ async def create_workflow( [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. Args: - request (:class:`~.workflows.CreateWorkflowRequest`): + request (:class:`google.cloud.workflows_v1beta.types.CreateWorkflowRequest`): The request object. Request for the [CreateWorkflow][google.cloud.workflows.v1beta.Workflows.CreateWorkflow] method. @@ -328,10 +331,11 @@ async def create_workflow( which the workflow should be created. Format: projects/{project}/locations/{location} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - workflow (:class:`~.workflows.Workflow`): + workflow (:class:`google.cloud.workflows_v1beta.types.Workflow`): Required. Workflow to be created. This corresponds to the ``workflow`` field on the ``request`` instance; if ``request`` is provided, this @@ -348,6 +352,7 @@ async def create_workflow( - Must be unique within the customer project and location. + This corresponds to the ``workflow_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -359,12 +364,12 @@ async def create_workflow( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.workflows.Workflow``: Workflow program to be - executed by Workflows. + :class:`google.cloud.workflows_v1beta.types.Workflow` + Workflow program to be executed by Workflows. """ # Create or coerce a protobuf request object. @@ -431,7 +436,7 @@ async def delete_workflow( executions of the workflow. Args: - request (:class:`~.workflows.DeleteWorkflowRequest`): + request (:class:`google.cloud.workflows_v1beta.types.DeleteWorkflowRequest`): The request object. Request for the [DeleteWorkflow][google.cloud.workflows.v1beta.Workflows.DeleteWorkflow] method. @@ -439,6 +444,7 @@ async def delete_workflow( Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -450,24 +456,22 @@ async def delete_workflow( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. @@ -534,19 +538,20 @@ async def update_workflow( used in new workflow executions. Args: - request (:class:`~.workflows.UpdateWorkflowRequest`): + request (:class:`google.cloud.workflows_v1beta.types.UpdateWorkflowRequest`): The request object. Request for the [UpdateWorkflow][google.cloud.workflows.v1beta.Workflows.UpdateWorkflow] method. - workflow (:class:`~.workflows.Workflow`): + workflow (:class:`google.cloud.workflows_v1beta.types.Workflow`): Required. Workflow to be updated. This corresponds to the ``workflow`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): List of fields to be updated. If not present, the entire workflow will be updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -558,12 +563,12 @@ async def update_workflow( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.workflows.Workflow``: Workflow program to be - executed by Workflows. + :class:`google.cloud.workflows_v1beta.types.Workflow` + Workflow program to be executed by Workflows. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/workflows_v1beta/services/workflows/client.py b/google/cloud/workflows_v1beta/services/workflows/client.py index e0c045e..964d0d6 100644 --- a/google/cloud/workflows_v1beta/services/workflows/client.py +++ b/google/cloud/workflows_v1beta/services/workflows/client.py @@ -116,6 +116,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + WorkflowsClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -128,7 +144,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + WorkflowsClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -236,10 +252,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.WorkflowsTransport]): The + transport (Union[str, WorkflowsTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -350,15 +366,16 @@ def list_workflows( The default order is not specified. Args: - request (:class:`~.workflows.ListWorkflowsRequest`): + request (google.cloud.workflows_v1beta.types.ListWorkflowsRequest): The request object. Request for the [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] method. - parent (:class:`str`): + parent (str): Required. Project and location from which the workflows should be listed. Format: projects/{project}/locations/{location} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -370,10 +387,10 @@ def list_workflows( sent along with the request as metadata. Returns: - ~.pagers.ListWorkflowsPager: + google.cloud.workflows_v1beta.services.workflows.pagers.ListWorkflowsPager: Response for the - [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] - method. + [ListWorkflows][google.cloud.workflows.v1beta.Workflows.ListWorkflows] + method. Iterating over this object will yield results and resolve additional pages automatically. @@ -436,14 +453,15 @@ def get_workflow( r"""Gets details of a single Workflow. Args: - request (:class:`~.workflows.GetWorkflowRequest`): + request (google.cloud.workflows_v1beta.types.GetWorkflowRequest): The request object. Request for the [GetWorkflow][google.cloud.workflows.v1beta.Workflows.GetWorkflow] method. - name (:class:`str`): + name (str): Required. Name of the workflow which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -455,7 +473,7 @@ def get_workflow( sent along with the request as metadata. Returns: - ~.workflows.Workflow: + google.cloud.workflows_v1beta.types.Workflow: Workflow program to be executed by Workflows. @@ -516,24 +534,25 @@ def create_workflow( [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. Args: - request (:class:`~.workflows.CreateWorkflowRequest`): + request (google.cloud.workflows_v1beta.types.CreateWorkflowRequest): The request object. Request for the [CreateWorkflow][google.cloud.workflows.v1beta.Workflows.CreateWorkflow] method. - parent (:class:`str`): + parent (str): Required. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - workflow (:class:`~.workflows.Workflow`): + workflow (google.cloud.workflows_v1beta.types.Workflow): Required. Workflow to be created. This corresponds to the ``workflow`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - workflow_id (:class:`str`): + workflow_id (str): Required. The ID of the workflow to be created. It has to fulfill the following requirements: @@ -545,6 +564,7 @@ def create_workflow( - Must be unique within the customer project and location. + This corresponds to the ``workflow_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -556,12 +576,12 @@ def create_workflow( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.workflows.Workflow``: Workflow program to be - executed by Workflows. + :class:`google.cloud.workflows_v1beta.types.Workflow` + Workflow program to be executed by Workflows. """ # Create or coerce a protobuf request object. @@ -629,14 +649,15 @@ def delete_workflow( executions of the workflow. Args: - request (:class:`~.workflows.DeleteWorkflowRequest`): + request (google.cloud.workflows_v1beta.types.DeleteWorkflowRequest): The request object. Request for the [DeleteWorkflow][google.cloud.workflows.v1beta.Workflows.DeleteWorkflow] method. - name (:class:`str`): + name (str): Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -648,24 +669,22 @@ def delete_workflow( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.empty.Empty``: A generic empty message that - you can re-use to avoid defining duplicated empty - messages in your APIs. A typical example is to use it as - the request or the response type of an API method. For - instance: + The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to + use it as the request or the response type of an API + method. For instance: - :: + service Foo { + rpc Bar(google.protobuf.Empty) returns + (google.protobuf.Empty); - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } + } - The JSON representation for ``Empty`` is empty JSON - object ``{}``. + The JSON representation for Empty is empty JSON + object {}. """ # Create or coerce a protobuf request object. @@ -733,19 +752,20 @@ def update_workflow( used in new workflow executions. Args: - request (:class:`~.workflows.UpdateWorkflowRequest`): + request (google.cloud.workflows_v1beta.types.UpdateWorkflowRequest): The request object. Request for the [UpdateWorkflow][google.cloud.workflows.v1beta.Workflows.UpdateWorkflow] method. - workflow (:class:`~.workflows.Workflow`): + workflow (google.cloud.workflows_v1beta.types.Workflow): Required. Workflow to be updated. This corresponds to the ``workflow`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): List of fields to be updated. If not present, the entire workflow will be updated. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -757,12 +777,12 @@ def update_workflow( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.workflows.Workflow``: Workflow program to be - executed by Workflows. + :class:`google.cloud.workflows_v1beta.types.Workflow` + Workflow program to be executed by Workflows. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/workflows_v1beta/services/workflows/pagers.py b/google/cloud/workflows_v1beta/services/workflows/pagers.py index 9fa5ef2..deaa8fc 100644 --- a/google/cloud/workflows_v1beta/services/workflows/pagers.py +++ b/google/cloud/workflows_v1beta/services/workflows/pagers.py @@ -24,7 +24,7 @@ class ListWorkflowsPager: """A pager for iterating through ``list_workflows`` requests. This class thinly wraps an initial - :class:`~.workflows.ListWorkflowsResponse` object, and + :class:`google.cloud.workflows_v1beta.types.ListWorkflowsResponse` object, and provides an ``__iter__`` method to iterate through its ``workflows`` field. @@ -33,7 +33,7 @@ class ListWorkflowsPager: through the ``workflows`` field on the corresponding responses. - All the usual :class:`~.workflows.ListWorkflowsResponse` + All the usual :class:`google.cloud.workflows_v1beta.types.ListWorkflowsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -51,9 +51,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.workflows.ListWorkflowsRequest`): + request (google.cloud.workflows_v1beta.types.ListWorkflowsRequest): The initial request object. - response (:class:`~.workflows.ListWorkflowsResponse`): + response (google.cloud.workflows_v1beta.types.ListWorkflowsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -86,7 +86,7 @@ class ListWorkflowsAsyncPager: """A pager for iterating through ``list_workflows`` requests. This class thinly wraps an initial - :class:`~.workflows.ListWorkflowsResponse` object, and + :class:`google.cloud.workflows_v1beta.types.ListWorkflowsResponse` object, and provides an ``__aiter__`` method to iterate through its ``workflows`` field. @@ -95,7 +95,7 @@ class ListWorkflowsAsyncPager: through the ``workflows`` field on the corresponding responses. - All the usual :class:`~.workflows.ListWorkflowsResponse` + All the usual :class:`google.cloud.workflows_v1beta.types.ListWorkflowsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -113,9 +113,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.workflows.ListWorkflowsRequest`): + request (google.cloud.workflows_v1beta.types.ListWorkflowsRequest): The initial request object. - response (:class:`~.workflows.ListWorkflowsResponse`): + response (google.cloud.workflows_v1beta.types.ListWorkflowsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/workflows_v1beta/types/workflows.py b/google/cloud/workflows_v1beta/types/workflows.py index d4a95f1..e49a90e 100644 --- a/google/cloud/workflows_v1beta/types/workflows.py +++ b/google/cloud/workflows_v1beta/types/workflows.py @@ -49,7 +49,7 @@ class Workflow(proto.Message): Description of the workflow provided by the user. Must be at most 1000 unicode characters long. - state (~.gcw_workflows.Workflow.State): + state (google.cloud.workflows_v1beta.types.Workflow.State): Output only. State of the workflow deployment. revision_id (str): @@ -62,16 +62,16 @@ class Workflow(proto.Message): first 6 characters define the zero-padded revision ordinal number. They are followed by a hyphen and 3 hexadecimal random characters. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp of when the workflow was created. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The last update timestamp of the workflow. - revision_create_time (~.timestamp.Timestamp): + revision_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp that the latest revision of the workflow was created. - labels (Sequence[~.gcw_workflows.Workflow.LabelsEntry]): + labels (Sequence[google.cloud.workflows_v1beta.types.Workflow.LabelsEntry]): Labels associated with this workflow. Labels can contain at most 64 entries. Keys and values can be no longer than 63 characters and @@ -183,7 +183,7 @@ class ListWorkflowsResponse(proto.Message): method. Attributes: - workflows (Sequence[~.gcw_workflows.Workflow]): + workflows (Sequence[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 @@ -229,7 +229,7 @@ class CreateWorkflowRequest(proto.Message): Required. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location} - workflow (~.gcw_workflows.Workflow): + workflow (google.cloud.workflows_v1beta.types.Workflow): Required. Workflow to be created. workflow_id (str): Required. The ID of the workflow to be created. It has to @@ -271,9 +271,9 @@ class UpdateWorkflowRequest(proto.Message): method. Attributes: - workflow (~.gcw_workflows.Workflow): + workflow (google.cloud.workflows_v1beta.types.Workflow): Required. Workflow to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): List of fields to be updated. If not present, the entire workflow will be updated. """ @@ -287,9 +287,9 @@ class OperationMetadata(proto.Message): r"""Represents the metadata of the long-running operation. Attributes: - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time the operation was created. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time the operation finished running. target (str): Server-defined resource path for the target diff --git a/synth.metadata b/synth.metadata index b727337..c89984e 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-workflows.git", - "sha": "20fa0c9290f1ed645d8e39116f7ce985f17c63b0" + "sha": "f5d04e528945751984f5d879a15a6fcda7f21596" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907", - "internalRef": "347055288" + "sha": "520682435235d9c503983a360a2090025aa47cd1", + "internalRef": "350246057" } }, { @@ -51,6 +51,7 @@ } ], "generatedFiles": [ + ".coveragerc", ".flake8", ".github/CONTRIBUTING.md", ".github/ISSUE_TEMPLATE/bug_report.md", @@ -103,11 +104,13 @@ "docs/_static/custom.css", "docs/_templates/layout.html", "docs/conf.py", + "docs/executions_v1beta/executions.rst", "docs/executions_v1beta/services.rst", "docs/executions_v1beta/types.rst", "docs/multiprocessing.rst", "docs/workflows_v1beta/services.rst", "docs/workflows_v1beta/types.rst", + "docs/workflows_v1beta/workflows.rst", "google/cloud/workflows/__init__.py", "google/cloud/workflows/executions/__init__.py", "google/cloud/workflows/executions/py.typed", diff --git a/tests/unit/gapic/executions_v1beta/test_executions.py b/tests/unit/gapic/executions_v1beta/test_executions.py index e81f349..0b959b3 100644 --- a/tests/unit/gapic/executions_v1beta/test_executions.py +++ b/tests/unit/gapic/executions_v1beta/test_executions.py @@ -86,7 +86,20 @@ def test__get_default_mtls_endpoint(): assert ExecutionsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient]) +def test_executions_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ExecutionsClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "workflowexecutions.googleapis.com:443" + + +@pytest.mark.parametrize("client_class", [ExecutionsClient, ExecutionsAsyncClient,]) def test_executions_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -104,7 +117,10 @@ def test_executions_client_from_service_account_file(client_class): def test_executions_client_get_transport_class(): transport = ExecutionsClient.get_transport_class() - assert transport == transports.ExecutionsGrpcTransport + available_transports = [ + transports.ExecutionsGrpcTransport, + ] + assert transport in available_transports transport = ExecutionsClient.get_transport_class("grpc") assert transport == transports.ExecutionsGrpcTransport @@ -1487,7 +1503,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.ExecutionsGrpcTransport, transports.ExecutionsGrpcAsyncIOTransport], + [transports.ExecutionsGrpcTransport, transports.ExecutionsGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1611,7 +1627,7 @@ def test_executions_host_with_port(): def test_executions_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ExecutionsGrpcTransport( @@ -1623,7 +1639,7 @@ def test_executions_grpc_transport_channel(): def test_executions_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ExecutionsGrpcAsyncIOTransport( @@ -1643,7 +1659,7 @@ def test_executions_transport_channel_mtls_with_client_cert_source(transport_cla "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1693,7 +1709,7 @@ def test_executions_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/workflows_v1beta/test_workflows.py b/tests/unit/gapic/workflows_v1beta/test_workflows.py index 5c46620..22cc31c 100644 --- a/tests/unit/gapic/workflows_v1beta/test_workflows.py +++ b/tests/unit/gapic/workflows_v1beta/test_workflows.py @@ -85,7 +85,20 @@ def test__get_default_mtls_endpoint(): assert WorkflowsClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient]) +def test_workflows_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = WorkflowsClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "workflows.googleapis.com:443" + + +@pytest.mark.parametrize("client_class", [WorkflowsClient, WorkflowsAsyncClient,]) def test_workflows_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -103,7 +116,10 @@ def test_workflows_client_from_service_account_file(client_class): def test_workflows_client_get_transport_class(): transport = WorkflowsClient.get_transport_class() - assert transport == transports.WorkflowsGrpcTransport + available_transports = [ + transports.WorkflowsGrpcTransport, + ] + assert transport in available_transports transport = WorkflowsClient.get_transport_class("grpc") assert transport == transports.WorkflowsGrpcTransport @@ -1636,7 +1652,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.WorkflowsGrpcTransport, transports.WorkflowsGrpcAsyncIOTransport], + [transports.WorkflowsGrpcTransport, transports.WorkflowsGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -1766,7 +1782,7 @@ def test_workflows_host_with_port(): def test_workflows_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.WorkflowsGrpcTransport( @@ -1778,7 +1794,7 @@ def test_workflows_grpc_transport_channel(): def test_workflows_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.WorkflowsGrpcAsyncIOTransport( @@ -1798,7 +1814,7 @@ def test_workflows_transport_channel_mtls_with_client_cert_source(transport_clas "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1848,7 +1864,7 @@ def test_workflows_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel