Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/LogicApp/LogicApp/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fix for Get-AzLogicAppRunHistory only retrieving the first page of results

## Version 1.3.2
* Update references in .psd1 to use relative path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Microsoft.Azure.Commands.LogicApp.Cmdlets
{
using Microsoft.Azure.Commands.LogicApp.Utilities;
using ResourceManager.Common.ArgumentCompleters;
using System;
using System.Management.Automation;

/// <summary>
Expand Down Expand Up @@ -45,6 +46,15 @@ public class AzureLogicAppRunHistoryCommand : LogicAppBaseCmdlet
[ValidateNotNullOrEmpty]
public string RunName { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Indicates the cmdlet should follow next page links.")]
[Alias("FL")]
public SwitchParameter FollowNextPageLink { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Specifies how many times to follow next page links if FollowNextPageLink is used.")]
[Alias("ML")]
[ValidateRange(1, Int32.MaxValue)]
public int MaximumFollowNextPageLink { get; set; } = int.MaxValue;

#endregion Input Parameters

/// <summary>
Expand All @@ -55,12 +65,19 @@ public override void ExecuteCmdlet()
base.ExecuteCmdlet();
if (string.IsNullOrEmpty(this.RunName))
{
var enumerator = LogicAppClient.GetWorkflowRuns(this.ResourceGroupName, this.Name).GetEnumerator();
this.WriteObject(enumerator.ToIEnumerable<WorkflowRun>(), true);
var page = new Page<WorkflowRun>();
int i = 0;
do
{
page = this.LogicAppClient.GetWorkflowRuns(this.ResourceGroupName, this.Name, page.NextPageLink);
this.WriteObject(page.GetEnumerator().ToIEnumerable<WorkflowRun>(), true);
i++;
}
while (this.FollowNextPageLink && !string.IsNullOrWhiteSpace(page.NextPageLink) && i <= this.MaximumFollowNextPageLink);
}
else
{
this.WriteObject(LogicAppClient.GetWorkflowRun(this.ResourceGroupName, this.Name, this.RunName), true);
this.WriteObject(this.LogicAppClient.GetWorkflowRun(this.ResourceGroupName, this.Name, this.RunName), true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ public void CancelWorkflowRun(string resourceGroupName, string workflowName,
/// <param name="resourceGroupName">Name of the resource group</param>
/// <param name="workflowName">Name of the workflow</param>
/// <returns>List of workflow runs</returns>
public Page<WorkflowRun> GetWorkflowRuns(string resourceGroupName, string workflowName)
public Page<WorkflowRun> GetWorkflowRuns(string resourceGroupName, string workflowName, string nextPageLink = "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please use constant string.Empty

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't think that was possible here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes I forgot, it's not defined as a const but as a read-only static so we can't use it for default parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of empty quotes either

{
return (Page<WorkflowRun>)this.LogicManagementClient.WorkflowRuns.List(resourceGroupName, workflowName);
return string.IsNullOrWhiteSpace(nextPageLink) ?
(Page<WorkflowRun>)this.LogicManagementClient.WorkflowRuns.List(resourceGroupName, workflowName) :
(Page<WorkflowRun>)this.LogicManagementClient.WorkflowRuns.ListNext(nextPageLink);
}

/// <summary>
Expand Down
55 changes: 51 additions & 4 deletions src/LogicApp/LogicApp/help/Get-AzLogicAppRunHistory.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
---
external help file: Microsoft.Azure.PowerShell.Cmdlets.LogicApp.dll-Help.xml
Module Name: Az.LogicApp
ms.assetid: F271BCB1-6D43-48E5-BB51-00288F57BFFB
Expand All @@ -14,8 +14,8 @@ Gets the run history of a logic app.
## SYNTAX

```
Get-AzLogicAppRunHistory -ResourceGroupName <String> -Name <String> [-RunName <String>]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Get-AzLogicAppRunHistory -ResourceGroupName <String> -Name <String> [-RunName <String>] [-FollowNextPageLink]
[-MaximumFollowNextPageLink <Int32>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -82,6 +82,23 @@ This command gets the run history of a logic app named LogicApp03. (autogenerate
Get-AzLogicAppRunHistory -Name 'IntegrationAccount31' -ResourceGroupName MyResourceGroup
```

### Example 4

This command gets the entire run history of a logic app named LogicApp03 by following the NextPageLink.

```powershell
Get-AzLogicAppRunHistory -Name 'LogicApp03' -ResourceGroupName MyResourceGroup -FollowNextPageLink
```

### Example 5

This command gets the first two pages of run history of a logic app named LogicApp03 by following the NextPageLink and limiting the result size to two pages.
Each page contains thirty results.

```powershell
Get-AzLogicAppRunHistory -Name 'LogicApp03' -ResourceGroupName MyResourceGroup -FollowNextPageLink -MaximumFollowNextPageLink 1
```

## PARAMETERS

### -DefaultProfile
Expand All @@ -99,6 +116,36 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -FollowNextPageLink
Indicates the cmdlet should follow next page links.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: FL

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -MaximumFollowNextPageLink
Specifies how many times to follow next page links if FollowNextPageLink is used.

```yaml
Type: System.Int32
Parameter Sets: (All)
Aliases: ML

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Name
Specifies the name of the logic app for which this cmdlet gets run history.

Expand Down Expand Up @@ -146,7 +193,7 @@ Accept wildcard characters: False
```

### CommonParameters
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).
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).

## INPUTS

Expand Down