Skip to content

Commit 8ace58a

Browse files
authored
Allow Get-AzLogicAppTriggerHistory and Get-AzLogicAppRunAction to return more than 30 results (#13846)
* Allow Get-AzLogicAppTriggerHistory to return more than 30 results. * Allow Get-AzLogicAppRunAction to return more than 30 results * Update change log
1 parent 091881b commit 8ace58a

9 files changed

+185
-58
lines changed

src/LogicApp/LogicApp.sln

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio 15
3-
VisualStudioVersion = 15.0.27703.2042
2+
# Visual Studio Version 16
3+
VisualStudioVersion = 16.0.30703.110
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LogicApp", "LogicApp\LogicApp.csproj", "{FFE4E475-B32C-4F89-9D52-F7CEBF709C74}"
66
EndProject
@@ -38,6 +38,10 @@ Global
3838
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
3939
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
4040
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Release|Any CPU.Build.0 = Release|Any CPU
4145
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4246
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
4347
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Release|Any CPU.ActiveCfg = Release|Any CPU

src/LogicApp/LogicApp/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fix for Get-AzLogicAppTriggerHistory and Get-AzLogicAppRunAction only retrieving the first page of results
2122

2223
## Version 1.4.0
2324
* Fixed for Get-AzLogicAppRunHistory only retrieving the first page of results

src/LogicApp/LogicApp/Cmdlets/LogicApp/GetAzureLogicAppRunActionCommand.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.Azure.Commands.LogicApp.Cmdlets
1818
{
1919
using Microsoft.Azure.Commands.LogicApp.Utilities;
2020
using ResourceManager.Common.ArgumentCompleters;
21+
using System;
2122
using System.Management.Automation;
2223

2324
/// <summary>
@@ -49,6 +50,15 @@ public class GetAzureLogicAppRunActionCommand : LogicAppBaseCmdlet
4950
[ValidateNotNullOrEmpty]
5051
public string ActionName { get; set; }
5152

53+
[Parameter(Mandatory = false, HelpMessage = "Indicates the cmdlet should follow next page links.")]
54+
[Alias("FL")]
55+
public SwitchParameter FollowNextPageLink { get; set; }
56+
57+
[Parameter(Mandatory = false, HelpMessage = "Specifies how many times to follow next page links if FollowNextPageLink is used.")]
58+
[Alias("ML")]
59+
[ValidateRange(1, Int32.MaxValue)]
60+
public int MaximumFollowNextPageLink { get; set; } = int.MaxValue;
61+
5262
#endregion Input Parameters
5363

5464
/// <summary>
@@ -57,17 +67,22 @@ public class GetAzureLogicAppRunActionCommand : LogicAppBaseCmdlet
5767
public override void ExecuteCmdlet()
5868
{
5969
base.ExecuteCmdlet();
60-
6170
if (string.IsNullOrEmpty(this.ActionName))
6271
{
63-
var enumerator = LogicAppClient.GetWorkflowRunActions(this.ResourceGroupName, this.Name, this.RunName).GetEnumerator();
64-
this.WriteObject(enumerator.ToIEnumerable<WorkflowRunAction>(), true);
72+
var page = new Page<WorkflowRunAction>();
73+
int i = 0;
74+
do
75+
{
76+
page = this.LogicAppClient.GetWorkflowRunActions(this.ResourceGroupName, this.Name, this.RunName, page.NextPageLink);
77+
this.WriteObject(page.GetEnumerator().ToIEnumerable<WorkflowRunAction>(), true);
78+
i++;
79+
}
80+
while (this.FollowNextPageLink && !string.IsNullOrWhiteSpace(page.NextPageLink) && i <= this.MaximumFollowNextPageLink);
6581
}
6682
else
6783
{
68-
this.WriteObject(
69-
LogicAppClient.GetWorkflowRunAction(this.ResourceGroupName, this.Name, this.RunName, this.ActionName),
70-
true);
84+
this.WriteObject(LogicAppClient.GetWorkflowRunAction(
85+
this.ResourceGroupName, this.Name, this.RunName, this.ActionName), true);
7186
}
7287
}
7388
}

src/LogicApp/LogicApp/Cmdlets/LogicApp/GetAzureLogicAppTriggerHistoryCommand.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.Azure.Commands.LogicApp.Cmdlets
1818
{
1919
using Microsoft.Azure.Commands.LogicApp.Utilities;
2020
using ResourceManager.Common.ArgumentCompleters;
21+
using System;
2122
using System.Management.Automation;
2223

2324
/// <summary>
@@ -51,6 +52,15 @@ public class GetAzureLogicAppTriggerHistoryCommand : LogicAppBaseCmdlet
5152
[ValidateNotNullOrEmpty]
5253
public string HistoryName { get; set; }
5354

55+
[Parameter(Mandatory = false, HelpMessage = "Indicates the cmdlet should follow next page links.")]
56+
[Alias("FL")]
57+
public SwitchParameter FollowNextPageLink { get; set; }
58+
59+
[Parameter(Mandatory = false, HelpMessage = "Specifies how many times to follow next page links if FollowNextPageLink is used.")]
60+
[Alias("ML")]
61+
[ValidateRange(1, Int32.MaxValue)]
62+
public int MaximumFollowNextPageLink { get; set; } = int.MaxValue;
63+
5464
#endregion Input Parameters
5565

5666
/// <summary>
@@ -61,10 +71,15 @@ public override void ExecuteCmdlet()
6171
base.ExecuteCmdlet();
6272
if (string.IsNullOrEmpty(this.HistoryName))
6373
{
64-
var enumerator =
65-
LogicAppClient.GetWorkflowTriggerHistories(this.ResourceGroupName, this.Name, this.TriggerName)
66-
.GetEnumerator();
67-
this.WriteObject(enumerator.ToIEnumerable<WorkflowTriggerHistory>(), true);
74+
var page = new Page<WorkflowTriggerHistory>();
75+
int i = 0;
76+
do
77+
{
78+
page = this.LogicAppClient.GetWorkflowTriggerHistories(this.ResourceGroupName, this.Name, this.TriggerName, page.NextPageLink);
79+
this.WriteObject(page.GetEnumerator().ToIEnumerable<WorkflowTriggerHistory>(), true);
80+
i++;
81+
}
82+
while (this.FollowNextPageLink && !string.IsNullOrWhiteSpace(page.NextPageLink) && i <= this.MaximumFollowNextPageLink);
6883
}
6984
else
7085
{

src/LogicApp/LogicApp/Utilities/LogicAppClientRunOperations.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ public WorkflowRunAction GetWorkflowRunAction(string resourceGroupName, string w
8282
/// <param name="workflowName">Name of the workflow</param>
8383
/// <param name="runName">Name of the workflow run</param>
8484
/// <returns>Actions of the specified workflow run</returns>
85-
public Page<WorkflowRunAction> GetWorkflowRunActions(string resourceGroupName, string workflowName, string runName)
85+
public Page<WorkflowRunAction> GetWorkflowRunActions(string resourceGroupName, string workflowName, string runName, string nextPageLink = "")
8686
{
87-
return (Page<WorkflowRunAction>)this.LogicManagementClient.WorkflowRunActions.List(resourceGroupName, workflowName, runName);
87+
return string.IsNullOrWhiteSpace(nextPageLink) ?
88+
(Page<WorkflowRunAction>)this.LogicManagementClient.WorkflowRunActions.List(resourceGroupName, workflowName, runName) :
89+
(Page<WorkflowRunAction>)this.LogicManagementClient.WorkflowRunActions.ListNext(nextPageLink);
8890
}
8991
}
9092
}

src/LogicApp/LogicApp/Utilities/LogicAppClientTriggerOperations.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ public WorkflowTriggerCallbackUrl GetWorkflowTriggerCallbackUrl(string resourceG
6666
/// <param name="triggerName">Name of the trigger</param>
6767
/// <returns>List of trigger histories</returns>
6868
public Page<WorkflowTriggerHistory> GetWorkflowTriggerHistories(string resourceGroupName, string workflowName,
69-
string triggerName)
69+
string triggerName, string nextPageLink = "")
7070
{
71-
return
72-
(Page<WorkflowTriggerHistory>)
73-
this.LogicManagementClient.WorkflowTriggerHistories.List(resourceGroupName, workflowName,
74-
triggerName);
71+
return string.IsNullOrWhiteSpace(nextPageLink) ?
72+
(Page<WorkflowTriggerHistory>)this.LogicManagementClient.WorkflowTriggerHistories.List(
73+
resourceGroupName, workflowName, triggerName) :
74+
(Page<WorkflowTriggerHistory>)this.LogicManagementClient.WorkflowTriggerHistories.ListNext(nextPageLink);
7575
}
7676

7777
/// <summary>

src/LogicApp/LogicApp/help/Get-AzLogicAppRunAction.md

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---
1+
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.LogicApp.dll-Help.xml
33
Module Name: Az.LogicApp
44
ms.assetid: 2EA28B90-4BAE-45DF-BD2E-60C74F53FB7B
@@ -9,16 +9,19 @@ schema: 2.0.0
99
# Get-AzLogicAppRunAction
1010

1111
## SYNOPSIS
12+
1213
Gets an action from a logic app run.
1314

1415
## SYNTAX
1516

16-
```
17+
```powershell
1718
Get-AzLogicAppRunAction -ResourceGroupName <String> -Name <String> -RunName <String> [-ActionName <String>]
18-
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
19+
[-FollowNextPageLink] [-MaximumFollowNextPageLink <Int32>] [-DefaultProfile <IAzureContextContainer>]
20+
[<CommonParameters>]
1921
```
2022

2123
## DESCRIPTION
24+
2225
The **Get-AzLogicAppRunAction** cmdlet gets an action from a logic app run.
2326
This cmdlet returns a **WorkflowRunAction** objects.
2427
Specify the logic app, resource group, and run.
@@ -30,8 +33,9 @@ If you omit a required template parameter, the cmdlet prompts you for the value.
3033
## EXAMPLES
3134

3235
### Example 1: Get an action from a Logic App run
36+
3337
```powershell
34-
PS C:\>Get-AzLogicAppActionRun -ResourceGroupName "ResourceGroup11" -Name "LogicApp05" -RunName "LogicAppRun56" -ActionName "LogicAppAction01"
38+
PS C:\>Get-AzLogicAppRunAction -ResourceGroupName "ResourceGroup11" -Name "LogicApp05" -RunName "08585925184423369718380498702CU26" -ActionName "LogicAppAction01"
3539
Code : NotFound
3640
EndTime : 1/13/2016 2:42:56 PM
3741
Error :
@@ -44,36 +48,20 @@ TrackingId :
4448
Type :
4549
```
4650

47-
This command gets a specific Logic App action from the logic app named LogicApp05 for the run named LogicAppRun56.
51+
This command gets a specific Logic App action from the logic app named LogicApp05 for the run with identifier 08585925184423369718380498702CU26.
4852

4953
### Example 2: Get all the actions from a Logic App run
54+
5055
```powershell
51-
PS C:\>Get-AzLogicAppActionRun -ResourceGroupName "ResourceGroup11" -Name "LogicApp05" -RunName "LogicAppRun56"
52-
Code : NotFound
53-
EndTime : 1/13/2016 2:42:56 PM
54-
Error :
55-
InputsLink : Microsoft.Azure.Management.Logic.Models.ContentLink
56-
Name : LogicAppAction1
57-
OutputsLink : Microsoft.Azure.Management.Logic.Models.ContentLink
58-
StartTime : 1/13/2016 2:42:55 PM
59-
Status : Failed
60-
TrackingId :
61-
Type :
56+
PS C:\>Get-AzLogicAppRunAction -ResourceGroupName "ResourceGroup11" -Name "LogicApp05" -RunName "08585925184423369718380498702CU26" -FollowNextPageLink
6257
```
6358

64-
This command gets all Logic App actions from a run named LogicAppRun56 of a logic app named LogicApp05.
65-
66-
### Example 3
67-
68-
This command gets all Logic App actions from a run named LogicAppRun56 of a logic app named LogicApp05. (autogenerated)
69-
70-
```powershell <!-- Aladdin Generated Example -->
71-
Get-AzLogicAppRunAction -Name 'IntegrationAccount31' -ResourceGroupName MyResourceGroup -RunName '08587489104702792076'
72-
```
59+
This command gets all Logic App actions from a run with identifier 08585925184423369718380498702CU26 of a logic app named LogicApp05.
7360

7461
## PARAMETERS
7562

7663
### -ActionName
64+
7765
Specifies the name of an action in a logic app run.
7866
This cmdlet gets the action that this parameter specifies.
7967

@@ -90,6 +78,7 @@ Accept wildcard characters: False
9078
```
9179
9280
### -DefaultProfile
81+
9382
The credentials, account, tenant, and subscription used for communication with azure
9483
9584
```yaml
@@ -104,7 +93,40 @@ Accept pipeline input: False
10493
Accept wildcard characters: False
10594
```
10695
96+
### -FollowNextPageLink
97+
98+
Indicates the cmdlet should follow next page links.
99+
100+
```yaml
101+
Type: System.Management.Automation.SwitchParameter
102+
Parameter Sets: (All)
103+
Aliases: FL
104+
105+
Required: False
106+
Position: Named
107+
Default value: None
108+
Accept pipeline input: False
109+
Accept wildcard characters: False
110+
```
111+
112+
### -MaximumFollowNextPageLink
113+
114+
Specifies how many times to follow next page links if FollowNextPageLink is used.
115+
116+
```yaml
117+
Type: System.Int32
118+
Parameter Sets: (All)
119+
Aliases: ML
120+
121+
Required: False
122+
Position: Named
123+
Default value: None
124+
Accept pipeline input: False
125+
Accept wildcard characters: False
126+
```
127+
107128
### -Name
129+
108130
Specifies the name of a logic app for which this cmdlet gets an action.
109131
110132
```yaml
@@ -120,6 +142,7 @@ Accept wildcard characters: False
120142
```
121143
122144
### -ResourceGroupName
145+
123146
Specifies the name of a resource group in which this cmdlet gets an action.
124147
125148
```yaml
@@ -135,6 +158,7 @@ Accept wildcard characters: False
135158
```
136159
137160
### -RunName
161+
138162
Specifies the name of a run of a logic app.
139163
This cmdlet gets an action for the run that this parameter specifies.
140164
@@ -151,7 +175,8 @@ Accept wildcard characters: False
151175
```
152176
153177
### CommonParameters
154-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
178+
179+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
155180
156181
## INPUTS
157182
@@ -168,5 +193,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
168193
[Get-AzLogicAppRunHistory](./Get-AzLogicAppRunHistory.md)
169194
170195
[Stop-AzLogicAppRun](./Stop-AzLogicAppRun.md)
171-
172-

0 commit comments

Comments
 (0)