Skip to content

Commit e21a156

Browse files
feat: [Workflows] add ListWorkflowRevisions method (#8163)
* 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 PiperOrigin-RevId: 737698339 Source-Link: googleapis/googleapis@d7db9c6 Source-Link: googleapis/googleapis-gen@f859edb Copy-Tag: eyJwIjoiV29ya2Zsb3dzLy5Pd2xCb3QueWFtbCIsImgiOiJmODU5ZWRiODIzMjU3MDBlMzVhODBhZTgxZWE1YmQyMWQ5ZTMyYzZlIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 36ebf2b commit e21a156

13 files changed

Lines changed: 824 additions & 16 deletions
1.15 KB
Binary file not shown.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START workflows_v1_generated_Workflows_ListWorkflowRevisions_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\Workflows\V1\Client\WorkflowsClient;
29+
use Google\Cloud\Workflows\V1\ListWorkflowRevisionsRequest;
30+
use Google\Cloud\Workflows\V1\Workflow;
31+
32+
/**
33+
* Lists revisions for a given workflow.
34+
*
35+
* @param string $formattedName Workflow for which the revisions should be listed.
36+
* Format: projects/{project}/locations/{location}/workflows/{workflow}
37+
* Please see {@see WorkflowsClient::workflowName()} for help formatting this field.
38+
*/
39+
function list_workflow_revisions_sample(string $formattedName): void
40+
{
41+
// Create a client.
42+
$workflowsClient = new WorkflowsClient();
43+
44+
// Prepare the request message.
45+
$request = (new ListWorkflowRevisionsRequest())
46+
->setName($formattedName);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var PagedListResponse $response */
51+
$response = $workflowsClient->listWorkflowRevisions($request);
52+
53+
/** @var Workflow $element */
54+
foreach ($response as $element) {
55+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
56+
}
57+
} catch (ApiException $ex) {
58+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
59+
}
60+
}
61+
62+
/**
63+
* Helper to execute the sample.
64+
*
65+
* This sample has been automatically generated and should be regarded as a code
66+
* template only. It will require modifications to work:
67+
* - It may require correct/in-range values for request initialization.
68+
* - It may require specifying regional endpoints when creating the service client,
69+
* please see the apiEndpoint client configuration option for more details.
70+
*/
71+
function callSample(): void
72+
{
73+
$formattedName = WorkflowsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]');
74+
75+
list_workflow_revisions_sample($formattedName);
76+
}
77+
// [END workflows_v1_generated_Workflows_ListWorkflowRevisions_sync]

Workflows/src/V1/Client/WorkflowsClient.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
use Google\Cloud\Workflows\V1\CreateWorkflowRequest;
4141
use Google\Cloud\Workflows\V1\DeleteWorkflowRequest;
4242
use Google\Cloud\Workflows\V1\GetWorkflowRequest;
43+
use Google\Cloud\Workflows\V1\ListWorkflowRevisionsRequest;
4344
use Google\Cloud\Workflows\V1\ListWorkflowsRequest;
4445
use Google\Cloud\Workflows\V1\UpdateWorkflowRequest;
4546
use Google\Cloud\Workflows\V1\Workflow;
@@ -64,6 +65,7 @@
6465
* @method PromiseInterface<OperationResponse> createWorkflowAsync(CreateWorkflowRequest $request, array $optionalArgs = [])
6566
* @method PromiseInterface<OperationResponse> deleteWorkflowAsync(DeleteWorkflowRequest $request, array $optionalArgs = [])
6667
* @method PromiseInterface<Workflow> getWorkflowAsync(GetWorkflowRequest $request, array $optionalArgs = [])
68+
* @method PromiseInterface<PagedListResponse> listWorkflowRevisionsAsync(ListWorkflowRevisionsRequest $request, array $optionalArgs = [])
6769
* @method PromiseInterface<PagedListResponse> listWorkflowsAsync(ListWorkflowsRequest $request, array $optionalArgs = [])
6870
* @method PromiseInterface<OperationResponse> updateWorkflowAsync(UpdateWorkflowRequest $request, array $optionalArgs = [])
6971
* @method PromiseInterface<Location> getLocationAsync(GetLocationRequest $request, array $optionalArgs = [])
@@ -188,6 +190,29 @@ public static function cryptoKeyName(string $project, string $location, string $
188190
]);
189191
}
190192

193+
/**
194+
* Formats a string containing the fully-qualified path to represent a
195+
* crypto_key_version resource.
196+
*
197+
* @param string $project
198+
* @param string $location
199+
* @param string $keyRing
200+
* @param string $cryptoKey
201+
* @param string $cryptoKeyVersion
202+
*
203+
* @return string The formatted crypto_key_version resource.
204+
*/
205+
public static function cryptoKeyVersionName(string $project, string $location, string $keyRing, string $cryptoKey, string $cryptoKeyVersion): string
206+
{
207+
return self::getPathTemplate('cryptoKeyVersion')->render([
208+
'project' => $project,
209+
'location' => $location,
210+
'keyRing' => $keyRing,
211+
'cryptoKey' => $cryptoKey,
212+
'cryptoKeyVersion' => $cryptoKeyVersion,
213+
]);
214+
}
215+
191216
/**
192217
* Formats a string containing the fully-qualified path to represent a location
193218
* resource.
@@ -229,6 +254,7 @@ public static function workflowName(string $project, string $location, string $w
229254
* The following name formats are supported:
230255
* Template: Pattern
231256
* - cryptoKey: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}
257+
* - cryptoKeyVersion: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}
232258
* - location: projects/{project}/locations/{location}
233259
* - workflow: projects/{project}/locations/{location}/workflows/{workflow}
234260
*
@@ -413,6 +439,32 @@ public function getWorkflow(GetWorkflowRequest $request, array $callOptions = []
413439
return $this->startApiCall('GetWorkflow', $request, $callOptions)->wait();
414440
}
415441

442+
/**
443+
* Lists revisions for a given workflow.
444+
*
445+
* The async variant is {@see WorkflowsClient::listWorkflowRevisionsAsync()} .
446+
*
447+
* @example samples/V1/WorkflowsClient/list_workflow_revisions.php
448+
*
449+
* @param ListWorkflowRevisionsRequest $request A request to house fields associated with the call.
450+
* @param array $callOptions {
451+
* Optional.
452+
*
453+
* @type RetrySettings|array $retrySettings
454+
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
455+
* associative array of retry settings parameters. See the documentation on
456+
* {@see RetrySettings} for example usage.
457+
* }
458+
*
459+
* @return PagedListResponse
460+
*
461+
* @throws ApiException Thrown if the API call fails.
462+
*/
463+
public function listWorkflowRevisions(ListWorkflowRevisionsRequest $request, array $callOptions = []): PagedListResponse
464+
{
465+
return $this->startApiCall('ListWorkflowRevisions', $request, $callOptions);
466+
}
467+
416468
/**
417469
* Lists workflows in a given project and location.
418470
* The default order is not specified.

Workflows/src/V1/ExecutionHistoryLevel.php

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Workflows/src/V1/ListWorkflowRevisionsRequest.php

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)