Skip to content

Commit 036658f

Browse files
feat: [google-cloud-workflows] add ListWorkflowRevisions method (#13671)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add ListWorkflowRevisions method feat: add ExecutionHistoryLevel to Workflow feat: add crypto key config to Workflow feat: add tags to Workflow feat: add ExecutionHistoryLevel enum docs: update Workflow some standard field docs END_COMMIT_OVERRIDE PiperOrigin-RevId: 737698339 Source-Link: googleapis/googleapis@d7db9c6 Source-Link: googleapis/googleapis-gen@f859edb Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtmbG93cy8uT3dsQm90LnlhbWwiLCJoIjoiZjg1OWVkYjgyMzI1NzAwZTM1YTgwYWU4MWVhNWJkMjFkOWUzMmM2ZSJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent ba9f843 commit 036658f

30 files changed

+2338
-166
lines changed

packages/google-cloud-workflows/google/cloud/workflows/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
from google.cloud.workflows_v1.types.workflows import (
2626
CreateWorkflowRequest,
2727
DeleteWorkflowRequest,
28+
ExecutionHistoryLevel,
2829
GetWorkflowRequest,
30+
ListWorkflowRevisionsRequest,
31+
ListWorkflowRevisionsResponse,
2932
ListWorkflowsRequest,
3033
ListWorkflowsResponse,
3134
OperationMetadata,
@@ -39,9 +42,12 @@
3942
"CreateWorkflowRequest",
4043
"DeleteWorkflowRequest",
4144
"GetWorkflowRequest",
45+
"ListWorkflowRevisionsRequest",
46+
"ListWorkflowRevisionsResponse",
4247
"ListWorkflowsRequest",
4348
"ListWorkflowsResponse",
4449
"OperationMetadata",
4550
"UpdateWorkflowRequest",
4651
"Workflow",
52+
"ExecutionHistoryLevel",
4753
)

packages/google-cloud-workflows/google/cloud/workflows/executions/gapic_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.17.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-workflows/google/cloud/workflows/executions_v1/gapic_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.17.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-workflows/google/cloud/workflows/executions_v1beta/gapic_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.17.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-workflows/google/cloud/workflows/gapic_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.17.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-workflows/google/cloud/workflows_v1/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
from .types.workflows import (
2323
CreateWorkflowRequest,
2424
DeleteWorkflowRequest,
25+
ExecutionHistoryLevel,
2526
GetWorkflowRequest,
27+
ListWorkflowRevisionsRequest,
28+
ListWorkflowRevisionsResponse,
2629
ListWorkflowsRequest,
2730
ListWorkflowsResponse,
2831
OperationMetadata,
@@ -34,7 +37,10 @@
3437
"WorkflowsAsyncClient",
3538
"CreateWorkflowRequest",
3639
"DeleteWorkflowRequest",
40+
"ExecutionHistoryLevel",
3741
"GetWorkflowRequest",
42+
"ListWorkflowRevisionsRequest",
43+
"ListWorkflowRevisionsResponse",
3844
"ListWorkflowsRequest",
3945
"ListWorkflowsResponse",
4046
"OperationMetadata",

packages/google-cloud-workflows/google/cloud/workflows_v1/gapic_metadata.json

+15
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
"get_workflow"
2626
]
2727
},
28+
"ListWorkflowRevisions": {
29+
"methods": [
30+
"list_workflow_revisions"
31+
]
32+
},
2833
"ListWorkflows": {
2934
"methods": [
3035
"list_workflows"
@@ -55,6 +60,11 @@
5560
"get_workflow"
5661
]
5762
},
63+
"ListWorkflowRevisions": {
64+
"methods": [
65+
"list_workflow_revisions"
66+
]
67+
},
5868
"ListWorkflows": {
5969
"methods": [
6070
"list_workflows"
@@ -85,6 +95,11 @@
8595
"get_workflow"
8696
]
8797
},
98+
"ListWorkflowRevisions": {
99+
"methods": [
100+
"list_workflow_revisions"
101+
]
102+
},
88103
"ListWorkflows": {
89104
"methods": [
90105
"list_workflows"

packages/google-cloud-workflows/google/cloud/workflows_v1/gapic_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.17.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/async_client.py

+107
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ class WorkflowsAsyncClient:
8585

8686
crypto_key_path = staticmethod(WorkflowsClient.crypto_key_path)
8787
parse_crypto_key_path = staticmethod(WorkflowsClient.parse_crypto_key_path)
88+
crypto_key_version_path = staticmethod(WorkflowsClient.crypto_key_version_path)
89+
parse_crypto_key_version_path = staticmethod(
90+
WorkflowsClient.parse_crypto_key_version_path
91+
)
8892
workflow_path = staticmethod(WorkflowsClient.workflow_path)
8993
parse_workflow_path = staticmethod(WorkflowsClient.parse_workflow_path)
9094
common_billing_account_path = staticmethod(
@@ -984,6 +988,109 @@ async def sample_update_workflow():
984988
# Done; return the response.
985989
return response
986990

991+
async def list_workflow_revisions(
992+
self,
993+
request: Optional[Union[workflows.ListWorkflowRevisionsRequest, dict]] = None,
994+
*,
995+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
996+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
997+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
998+
) -> pagers.ListWorkflowRevisionsAsyncPager:
999+
r"""Lists revisions for a given workflow.
1000+
1001+
.. code-block:: python
1002+
1003+
# This snippet has been automatically generated and should be regarded as a
1004+
# code template only.
1005+
# It will require modifications to work:
1006+
# - It may require correct/in-range values for request initialization.
1007+
# - It may require specifying regional endpoints when creating the service
1008+
# client as shown in:
1009+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1010+
from google.cloud import workflows_v1
1011+
1012+
async def sample_list_workflow_revisions():
1013+
# Create a client
1014+
client = workflows_v1.WorkflowsAsyncClient()
1015+
1016+
# Initialize request argument(s)
1017+
request = workflows_v1.ListWorkflowRevisionsRequest(
1018+
name="name_value",
1019+
)
1020+
1021+
# Make the request
1022+
page_result = client.list_workflow_revisions(request=request)
1023+
1024+
# Handle the response
1025+
async for response in page_result:
1026+
print(response)
1027+
1028+
Args:
1029+
request (Optional[Union[google.cloud.workflows_v1.types.ListWorkflowRevisionsRequest, dict]]):
1030+
The request object. Request for the
1031+
[ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1032+
method.
1033+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1034+
should be retried.
1035+
timeout (float): The timeout for this request.
1036+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1037+
sent along with the request as metadata. Normally, each value must be of type `str`,
1038+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1039+
be of type `bytes`.
1040+
1041+
Returns:
1042+
google.cloud.workflows_v1.services.workflows.pagers.ListWorkflowRevisionsAsyncPager:
1043+
Response for the
1044+
[ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1045+
method.
1046+
1047+
Iterating over this object will yield results and
1048+
resolve additional pages automatically.
1049+
1050+
"""
1051+
# Create or coerce a protobuf request object.
1052+
# - Use the request object if provided (there's no risk of modifying the input as
1053+
# there are no flattened fields), or create one.
1054+
if not isinstance(request, workflows.ListWorkflowRevisionsRequest):
1055+
request = workflows.ListWorkflowRevisionsRequest(request)
1056+
1057+
# Wrap the RPC method; this adds retry and timeout information,
1058+
# and friendly error handling.
1059+
rpc = self._client._transport._wrapped_methods[
1060+
self._client._transport.list_workflow_revisions
1061+
]
1062+
1063+
# Certain fields should be provided within the metadata header;
1064+
# add these here.
1065+
metadata = tuple(metadata) + (
1066+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1067+
)
1068+
1069+
# Validate the universe domain.
1070+
self._client._validate_universe_domain()
1071+
1072+
# Send the request.
1073+
response = await rpc(
1074+
request,
1075+
retry=retry,
1076+
timeout=timeout,
1077+
metadata=metadata,
1078+
)
1079+
1080+
# This method is paged; wrap the response in a pager, which provides
1081+
# an `__aiter__` convenience method.
1082+
response = pagers.ListWorkflowRevisionsAsyncPager(
1083+
method=rpc,
1084+
request=request,
1085+
response=response,
1086+
retry=retry,
1087+
timeout=timeout,
1088+
metadata=metadata,
1089+
)
1090+
1091+
# Done; return the response.
1092+
return response
1093+
9871094
async def list_operations(
9881095
self,
9891096
request: Optional[operations_pb2.ListOperationsRequest] = None,

packages/google-cloud-workflows/google/cloud/workflows_v1/services/workflows/client.py

+127
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,32 @@ def parse_crypto_key_path(path: str) -> Dict[str, str]:
228228
)
229229
return m.groupdict() if m else {}
230230

231+
@staticmethod
232+
def crypto_key_version_path(
233+
project: str,
234+
location: str,
235+
keyRing: str,
236+
cryptoKey: str,
237+
cryptoKeyVersion: str,
238+
) -> str:
239+
"""Returns a fully-qualified crypto_key_version string."""
240+
return "projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}".format(
241+
project=project,
242+
location=location,
243+
keyRing=keyRing,
244+
cryptoKey=cryptoKey,
245+
cryptoKeyVersion=cryptoKeyVersion,
246+
)
247+
248+
@staticmethod
249+
def parse_crypto_key_version_path(path: str) -> Dict[str, str]:
250+
"""Parses a crypto_key_version path into its component segments."""
251+
m = re.match(
252+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/keyRings/(?P<keyRing>.+?)/cryptoKeys/(?P<cryptoKey>.+?)/cryptoKeyVersions/(?P<cryptoKeyVersion>.+?)$",
253+
path,
254+
)
255+
return m.groupdict() if m else {}
256+
231257
@staticmethod
232258
def workflow_path(
233259
project: str,
@@ -1415,6 +1441,107 @@ def sample_update_workflow():
14151441
# Done; return the response.
14161442
return response
14171443

1444+
def list_workflow_revisions(
1445+
self,
1446+
request: Optional[Union[workflows.ListWorkflowRevisionsRequest, dict]] = None,
1447+
*,
1448+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1449+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1450+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1451+
) -> pagers.ListWorkflowRevisionsPager:
1452+
r"""Lists revisions for a given workflow.
1453+
1454+
.. code-block:: python
1455+
1456+
# This snippet has been automatically generated and should be regarded as a
1457+
# code template only.
1458+
# It will require modifications to work:
1459+
# - It may require correct/in-range values for request initialization.
1460+
# - It may require specifying regional endpoints when creating the service
1461+
# client as shown in:
1462+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1463+
from google.cloud import workflows_v1
1464+
1465+
def sample_list_workflow_revisions():
1466+
# Create a client
1467+
client = workflows_v1.WorkflowsClient()
1468+
1469+
# Initialize request argument(s)
1470+
request = workflows_v1.ListWorkflowRevisionsRequest(
1471+
name="name_value",
1472+
)
1473+
1474+
# Make the request
1475+
page_result = client.list_workflow_revisions(request=request)
1476+
1477+
# Handle the response
1478+
for response in page_result:
1479+
print(response)
1480+
1481+
Args:
1482+
request (Union[google.cloud.workflows_v1.types.ListWorkflowRevisionsRequest, dict]):
1483+
The request object. Request for the
1484+
[ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1485+
method.
1486+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1487+
should be retried.
1488+
timeout (float): The timeout for this request.
1489+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1490+
sent along with the request as metadata. Normally, each value must be of type `str`,
1491+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1492+
be of type `bytes`.
1493+
1494+
Returns:
1495+
google.cloud.workflows_v1.services.workflows.pagers.ListWorkflowRevisionsPager:
1496+
Response for the
1497+
[ListWorkflowRevisions][google.cloud.workflows.v1.Workflows.ListWorkflowRevisions]
1498+
method.
1499+
1500+
Iterating over this object will yield results and
1501+
resolve additional pages automatically.
1502+
1503+
"""
1504+
# Create or coerce a protobuf request object.
1505+
# - Use the request object if provided (there's no risk of modifying the input as
1506+
# there are no flattened fields), or create one.
1507+
if not isinstance(request, workflows.ListWorkflowRevisionsRequest):
1508+
request = workflows.ListWorkflowRevisionsRequest(request)
1509+
1510+
# Wrap the RPC method; this adds retry and timeout information,
1511+
# and friendly error handling.
1512+
rpc = self._transport._wrapped_methods[self._transport.list_workflow_revisions]
1513+
1514+
# Certain fields should be provided within the metadata header;
1515+
# add these here.
1516+
metadata = tuple(metadata) + (
1517+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1518+
)
1519+
1520+
# Validate the universe domain.
1521+
self._validate_universe_domain()
1522+
1523+
# Send the request.
1524+
response = rpc(
1525+
request,
1526+
retry=retry,
1527+
timeout=timeout,
1528+
metadata=metadata,
1529+
)
1530+
1531+
# This method is paged; wrap the response in a pager, which provides
1532+
# an `__iter__` convenience method.
1533+
response = pagers.ListWorkflowRevisionsPager(
1534+
method=rpc,
1535+
request=request,
1536+
response=response,
1537+
retry=retry,
1538+
timeout=timeout,
1539+
metadata=metadata,
1540+
)
1541+
1542+
# Done; return the response.
1543+
return response
1544+
14181545
def __enter__(self) -> "WorkflowsClient":
14191546
return self
14201547

0 commit comments

Comments
 (0)