Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit 887df00

Browse files
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 <noreply@google.com> Source-Date: Tue Jan 5 16:44:11 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 520682435235d9c503983a360a2090025aa47cd1 Source-Link: googleapis/googleapis@5206824 Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
1 parent ccddf06 commit 887df00

File tree

18 files changed

+284
-157
lines changed

18 files changed

+284
-157
lines changed

.coveragerc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
fail_under = 100
6+
show_missing = True
7+
omit =
8+
google/cloud/workflows/__init__.py
9+
exclude_lines =
10+
# Re-enable the standard pragma
11+
pragma: NO COVER
12+
# Ignore debug-only repr
13+
def __repr__
14+
# Ignore pkg_resources exceptions.
15+
# This is added at the module level as a safeguard for if someone
16+
# generates the code and tries to run it without pip installing. This
17+
# makes it virtually impossible to test properly.
18+
except pkg_resources.DistributionNotFound

docs/executions_v1beta/executions.rst

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Executions
2+
----------------------------
3+
4+
.. automodule:: google.cloud.workflows.executions_v1beta.services.executions
5+
:members:
6+
:inherited-members:
7+
8+
9+
.. automodule:: google.cloud.workflows.executions_v1beta.services.executions.pagers
10+
:members:
11+
:inherited-members:

docs/executions_v1beta/services.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Services for Google Cloud Workflows Executions v1beta API
22
=========================================================
3+
.. toctree::
4+
:maxdepth: 2
35

4-
.. automodule:: google.cloud.workflows.executions_v1beta.services.executions
5-
:members:
6-
:inherited-members:
6+
executions

docs/executions_v1beta/types.rst

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Types for Google Cloud Workflows Executions v1beta API
33

44
.. automodule:: google.cloud.workflows.executions_v1beta.types
55
:members:
6+
:undoc-members:
67
:show-inheritance:

docs/workflows_v1beta/services.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Services for Google Cloud Workflows v1beta API
22
==============================================
3+
.. toctree::
4+
:maxdepth: 2
35

4-
.. automodule:: google.cloud.workflows_v1beta.services.workflows
5-
:members:
6-
:inherited-members:
6+
workflows

docs/workflows_v1beta/types.rst

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Types for Google Cloud Workflows v1beta API
33

44
.. automodule:: google.cloud.workflows_v1beta.types
55
:members:
6+
:undoc-members:
67
:show-inheritance:

docs/workflows_v1beta/workflows.rst

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Workflows
2+
---------------------------
3+
4+
.. automodule:: google.cloud.workflows_v1beta.services.workflows
5+
:members:
6+
:inherited-members:
7+
8+
9+
.. automodule:: google.cloud.workflows_v1beta.services.workflows.pagers
10+
:members:
11+
:inherited-members:

google/cloud/workflows/executions_v1beta/services/executions/async_client.py

+16-11
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class ExecutionsAsyncClient:
7676
ExecutionsClient.parse_common_location_path
7777
)
7878

79+
from_service_account_info = ExecutionsClient.from_service_account_info
7980
from_service_account_file = ExecutionsClient.from_service_account_file
8081
from_service_account_json = from_service_account_file
8182

@@ -156,7 +157,7 @@ async def list_executions(
156157
first).
157158
158159
Args:
159-
request (:class:`~.executions.ListExecutionsRequest`):
160+
request (:class:`google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest`):
160161
The request object. Request for the
161162
[ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions]
162163
method.
@@ -165,6 +166,7 @@ async def list_executions(
165166
which the executions should be listed.
166167
Format:
167168
projects/{project}/locations/{location}/workflows/{workflow}
169+
168170
This corresponds to the ``parent`` field
169171
on the ``request`` instance; if ``request`` is provided, this
170172
should not be set.
@@ -176,10 +178,10 @@ async def list_executions(
176178
sent along with the request as metadata.
177179
178180
Returns:
179-
~.pagers.ListExecutionsAsyncPager:
181+
google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsAsyncPager:
180182
Response for the
181-
[ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions]
182-
method.
183+
[ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions]
184+
method.
183185
184186
Iterating over this object will yield results and
185187
resolve additional pages automatically.
@@ -243,7 +245,7 @@ async def create_execution(
243245
the given workflow.
244246
245247
Args:
246-
request (:class:`~.executions.CreateExecutionRequest`):
248+
request (:class:`google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest`):
247249
The request object. Request for the
248250
[CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution]
249251
method.
@@ -254,10 +256,11 @@ async def create_execution(
254256
projects/{project}/locations/{location}/workflows/{workflow}
255257
The latest revision of the workflow will
256258
be used.
259+
257260
This corresponds to the ``parent`` field
258261
on the ``request`` instance; if ``request`` is provided, this
259262
should not be set.
260-
execution (:class:`~.executions.Execution`):
263+
execution (:class:`google.cloud.workflows.executions_v1beta.types.Execution`):
261264
Required. Execution to be created.
262265
This corresponds to the ``execution`` field
263266
on the ``request`` instance; if ``request`` is provided, this
@@ -270,7 +273,7 @@ async def create_execution(
270273
sent along with the request as metadata.
271274
272275
Returns:
273-
~.executions.Execution:
276+
google.cloud.workflows.executions_v1beta.types.Execution:
274277
A running instance of a
275278
[Workflow][google.cloud.workflows.v1beta.Workflow].
276279
@@ -327,14 +330,15 @@ async def get_execution(
327330
r"""Returns an execution of the given name.
328331
329332
Args:
330-
request (:class:`~.executions.GetExecutionRequest`):
333+
request (:class:`google.cloud.workflows.executions_v1beta.types.GetExecutionRequest`):
331334
The request object. Request for the
332335
[GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution]
333336
method.
334337
name (:class:`str`):
335338
Required. Name of the execution to be
336339
retrieved. Format:
337340
projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
341+
338342
This corresponds to the ``name`` field
339343
on the ``request`` instance; if ``request`` is provided, this
340344
should not be set.
@@ -346,7 +350,7 @@ async def get_execution(
346350
sent along with the request as metadata.
347351
348352
Returns:
349-
~.executions.Execution:
353+
google.cloud.workflows.executions_v1beta.types.Execution:
350354
A running instance of a
351355
[Workflow][google.cloud.workflows.v1beta.Workflow].
352356
@@ -401,14 +405,15 @@ async def cancel_execution(
401405
r"""Cancels an execution of the given name.
402406
403407
Args:
404-
request (:class:`~.executions.CancelExecutionRequest`):
408+
request (:class:`google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest`):
405409
The request object. Request for the
406410
[CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution]
407411
method.
408412
name (:class:`str`):
409413
Required. Name of the execution to be
410414
cancelled. Format:
411415
projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
416+
412417
This corresponds to the ``name`` field
413418
on the ``request`` instance; if ``request`` is provided, this
414419
should not be set.
@@ -420,7 +425,7 @@ async def cancel_execution(
420425
sent along with the request as metadata.
421426
422427
Returns:
423-
~.executions.Execution:
428+
google.cloud.workflows.executions_v1beta.types.Execution:
424429
A running instance of a
425430
[Workflow][google.cloud.workflows.v1beta.Workflow].
426431

google/cloud/workflows/executions_v1beta/services/executions/client.py

+38-18
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,22 @@ def _get_default_mtls_endpoint(api_endpoint):
112112
DEFAULT_ENDPOINT
113113
)
114114

115+
@classmethod
116+
def from_service_account_info(cls, info: dict, *args, **kwargs):
117+
"""Creates an instance of this client using the provided credentials info.
118+
119+
Args:
120+
info (dict): The service account private key info.
121+
args: Additional arguments to pass to the constructor.
122+
kwargs: Additional arguments to pass to the constructor.
123+
124+
Returns:
125+
ExecutionsClient: The constructed client.
126+
"""
127+
credentials = service_account.Credentials.from_service_account_info(info)
128+
kwargs["credentials"] = credentials
129+
return cls(*args, **kwargs)
130+
115131
@classmethod
116132
def from_service_account_file(cls, filename: str, *args, **kwargs):
117133
"""Creates an instance of this client using the provided credentials
@@ -124,7 +140,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):
124140
kwargs: Additional arguments to pass to the constructor.
125141
126142
Returns:
127-
{@api.name}: The constructed client.
143+
ExecutionsClient: The constructed client.
128144
"""
129145
credentials = service_account.Credentials.from_service_account_file(filename)
130146
kwargs["credentials"] = credentials
@@ -250,10 +266,10 @@ def __init__(
250266
credentials identify the application to the service; if none
251267
are specified, the client will attempt to ascertain the
252268
credentials from the environment.
253-
transport (Union[str, ~.ExecutionsTransport]): The
269+
transport (Union[str, ExecutionsTransport]): The
254270
transport to use. If set to None, a transport is chosen
255271
automatically.
256-
client_options (client_options_lib.ClientOptions): Custom options for the
272+
client_options (google.api_core.client_options.ClientOptions): Custom options for the
257273
client. It won't take effect if a ``transport`` instance is provided.
258274
(1) The ``api_endpoint`` property can be used to override the
259275
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
@@ -367,15 +383,16 @@ def list_executions(
367383
first).
368384
369385
Args:
370-
request (:class:`~.executions.ListExecutionsRequest`):
386+
request (google.cloud.workflows.executions_v1beta.types.ListExecutionsRequest):
371387
The request object. Request for the
372388
[ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions]
373389
method.
374-
parent (:class:`str`):
390+
parent (str):
375391
Required. Name of the workflow for
376392
which the executions should be listed.
377393
Format:
378394
projects/{project}/locations/{location}/workflows/{workflow}
395+
379396
This corresponds to the ``parent`` field
380397
on the ``request`` instance; if ``request`` is provided, this
381398
should not be set.
@@ -387,10 +404,10 @@ def list_executions(
387404
sent along with the request as metadata.
388405
389406
Returns:
390-
~.pagers.ListExecutionsPager:
407+
google.cloud.workflows.executions_v1beta.services.executions.pagers.ListExecutionsPager:
391408
Response for the
392-
[ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions]
393-
method.
409+
[ListExecutions][google.cloud.workflows.executions.v1beta.Executions.ListExecutions]
410+
method.
394411
395412
Iterating over this object will yield results and
396413
resolve additional pages automatically.
@@ -455,21 +472,22 @@ def create_execution(
455472
the given workflow.
456473
457474
Args:
458-
request (:class:`~.executions.CreateExecutionRequest`):
475+
request (google.cloud.workflows.executions_v1beta.types.CreateExecutionRequest):
459476
The request object. Request for the
460477
[CreateExecution][google.cloud.workflows.executions.v1beta.Executions.CreateExecution]
461478
method.
462-
parent (:class:`str`):
479+
parent (str):
463480
Required. Name of the workflow for
464481
which an execution should be created.
465482
Format:
466483
projects/{project}/locations/{location}/workflows/{workflow}
467484
The latest revision of the workflow will
468485
be used.
486+
469487
This corresponds to the ``parent`` field
470488
on the ``request`` instance; if ``request`` is provided, this
471489
should not be set.
472-
execution (:class:`~.executions.Execution`):
490+
execution (google.cloud.workflows.executions_v1beta.types.Execution):
473491
Required. Execution to be created.
474492
This corresponds to the ``execution`` field
475493
on the ``request`` instance; if ``request`` is provided, this
@@ -482,7 +500,7 @@ def create_execution(
482500
sent along with the request as metadata.
483501
484502
Returns:
485-
~.executions.Execution:
503+
google.cloud.workflows.executions_v1beta.types.Execution:
486504
A running instance of a
487505
[Workflow][google.cloud.workflows.v1beta.Workflow].
488506
@@ -540,14 +558,15 @@ def get_execution(
540558
r"""Returns an execution of the given name.
541559
542560
Args:
543-
request (:class:`~.executions.GetExecutionRequest`):
561+
request (google.cloud.workflows.executions_v1beta.types.GetExecutionRequest):
544562
The request object. Request for the
545563
[GetExecution][google.cloud.workflows.executions.v1beta.Executions.GetExecution]
546564
method.
547-
name (:class:`str`):
565+
name (str):
548566
Required. Name of the execution to be
549567
retrieved. Format:
550568
projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
569+
551570
This corresponds to the ``name`` field
552571
on the ``request`` instance; if ``request`` is provided, this
553572
should not be set.
@@ -559,7 +578,7 @@ def get_execution(
559578
sent along with the request as metadata.
560579
561580
Returns:
562-
~.executions.Execution:
581+
google.cloud.workflows.executions_v1beta.types.Execution:
563582
A running instance of a
564583
[Workflow][google.cloud.workflows.v1beta.Workflow].
565584
@@ -615,14 +634,15 @@ def cancel_execution(
615634
r"""Cancels an execution of the given name.
616635
617636
Args:
618-
request (:class:`~.executions.CancelExecutionRequest`):
637+
request (google.cloud.workflows.executions_v1beta.types.CancelExecutionRequest):
619638
The request object. Request for the
620639
[CancelExecution][google.cloud.workflows.executions.v1beta.Executions.CancelExecution]
621640
method.
622-
name (:class:`str`):
641+
name (str):
623642
Required. Name of the execution to be
624643
cancelled. Format:
625644
projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
645+
626646
This corresponds to the ``name`` field
627647
on the ``request`` instance; if ``request`` is provided, this
628648
should not be set.
@@ -634,7 +654,7 @@ def cancel_execution(
634654
sent along with the request as metadata.
635655
636656
Returns:
637-
~.executions.Execution:
657+
google.cloud.workflows.executions_v1beta.types.Execution:
638658
A running instance of a
639659
[Workflow][google.cloud.workflows.v1beta.Workflow].
640660

0 commit comments

Comments
 (0)