Skip to content

Commit 5484d9e

Browse files
committed
address feedback
1 parent 85895e5 commit 5484d9e

16 files changed

+173
-23
lines changed

src/DataFactory/DataFactoryV2.Test/ScenarioTests/DataFlowDebugSessionTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function Test-DataFlowDebugScenario
4242
Add-AzDataFactoryV2DataFlowDebugSessionPackage -DataFactory $df -PackageFile .\Resources\dataFlowDebugPackage.json -SessionId $session.SessionId
4343

4444
# Execute debug command
45-
$result = Invoke-AzDataFactoryV2DataFlowDebugSessionCommand -DataFactory $df -Command executePreviewQuery -SessionId $session.SessionId -StreamName source1 -RowLimits 100
45+
$result = Invoke-AzDataFactoryV2DataFlowDebugSessionCommand -DataFactory $df -Command executePreviewQuery -SessionId $session.SessionId -StreamName source1 -RowLimit 100
4646
Assert-AreEqual 'Succeeded' $result.Status
4747
Assert-NotNull $result.Data
4848

src/DataFactory/DataFactoryV2/Constants.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ internal static class Constants
9292

9393
public const string HelpDataFlowDebugColumns = "The columns list for data flow statistics preview.";
9494

95+
public const string HelpDataFlowCreationContext = "Creating or updating data flow '{0}' in resource group '{1}' under data factory '{2}'.";
96+
97+
public const string HelpAddDataFlowPackageContext = "Add data flow package to debug session '{0}' in resource group '{1}' under data factory '{2}'.";
98+
99+
public const string HelpInvokeDebugSessionCommandContext = "Invoke debug command of debug session '{0}' in resource group '{1}' under data factory '{2}'.";
100+
101+
public const string HelpStartDataFlowDebugSessionContext = "Start a data flow debug session in resource group '{0}' under data factory '{1}'.";
102+
95103
public const string HelpLinkedServiceName = "The linked service name.";
96104

97105
public const string HelpLinkedService = "The linked service object.";

src/DataFactory/DataFactoryV2/DataFlowDebugSessions/AddAzureDataFactoryDataFlowDebugSessionPackageCommand.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
namespace Microsoft.Azure.Commands.DataFactoryV2
2222
{
23-
[Cmdlet("Add", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlowDebugSessionPackage", DefaultParameterSetName = ParameterSetNames.ByFactoryName, SupportsShouldProcess = true), OutputType(typeof(void))]
23+
[Cmdlet("Add", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlowDebugSessionPackage", DefaultParameterSetName = ParameterSetNames.ByFactoryName, SupportsShouldProcess = true)]
24+
[OutputType(typeof(void))]
25+
[OutputType(typeof(string))]
2426
public class AddAzureDataFactoryDataFlowDebugSessionDataFlowPackageCommand : DataFactoryDataFlowDebugSessionBaseCmdlet
2527
{
2628
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryName, Position = 2, Mandatory = true,
@@ -55,9 +57,12 @@ public override void ExecuteCmdlet()
5557
package.SessionId = SessionId;
5658
}
5759

58-
DataFactoryClient.AddDataFlowToDebugSession(ResourceGroupName, DataFactoryName, package);
60+
if (ShouldProcess(DataFactoryName, string.Format(Constants.HelpAddDataFlowPackageContext, this.SessionId, this.ResourceGroupName, this.DataFactoryName)))
61+
{
62+
DataFactoryClient.AddDataFlowToDebugSession(ResourceGroupName, DataFactoryName, package);
63+
}
5964

60-
if (PassThru)
65+
if (this.PassThru.IsPresent)
6166
{
6267
WriteObject(true);
6368
}

src/DataFactory/DataFactoryV2/DataFlowDebugSessions/InvokeAzureDataFactoryDataFlowDebugSessionCommandCommand.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class InvokeAzureDataFactoryDataFlowDebugSessionOperationCommand : DataFa
5757
HelpMessage = Constants.HelpDataFlowDebugRowLimits)]
5858
[Parameter(ParameterSetName = ParameterSetNames.ByResourceId, Position = 4, Mandatory = false,
5959
HelpMessage = Constants.HelpDataFlowDebugRowLimits)]
60-
public int? RowLimits { get; set; }
60+
public int? RowLimit { get; set; }
6161

6262
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryName, Position = 6, Mandatory = false,
6363
HelpMessage = Constants.HelpDataFlowDebugExpression)]
@@ -73,7 +73,7 @@ public class InvokeAzureDataFactoryDataFlowDebugSessionOperationCommand : DataFa
7373
HelpMessage = Constants.HelpDataFlowDebugColumns)]
7474
[Parameter(ParameterSetName = ParameterSetNames.ByResourceId, Position = 6, Mandatory = false,
7575
HelpMessage = Constants.HelpDataFlowDebugColumns)]
76-
public List<string> Columns { get; set; }
76+
public List<string> Column { get; set; }
7777

7878
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
7979
public SwitchParameter AsJob { get; set; }
@@ -90,13 +90,17 @@ public override void ExecuteCmdlet()
9090
CommandPayload = new DataFlowDebugCommandPayload
9191
{
9292
StreamName = StreamName,
93-
RowLimits = RowLimits,
93+
RowLimits = RowLimit,
9494
Expression = Expression,
95-
Columns = Columns
95+
Columns = Column
9696
}
9797

9898
};
99-
WriteObject(DataFactoryClient.InvokeDataFlowDebugSessionCommand(ResourceGroupName, DataFactoryName, request));
99+
100+
if (ShouldProcess(DataFactoryName, string.Format(Constants.HelpInvokeDebugSessionCommandContext, this.SessionId, this.ResourceGroupName, this.DataFactoryName)))
101+
{
102+
WriteObject(DataFactoryClient.InvokeDataFlowDebugSessionCommand(ResourceGroupName, DataFactoryName, request));
103+
}
100104
}
101105
}
102106
}

src/DataFactory/DataFactoryV2/DataFlowDebugSessions/StartAzureDataFactoryDataFlowDebugSessionCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ public override void ExecuteCmdlet()
5151
request.IntegrationRuntime = integrationRuntimeResource;
5252
}
5353

54-
WriteObject(DataFactoryClient.StartDebugSession(ResourceGroupName, DataFactoryName, request));
54+
if (ShouldProcess(DataFactoryName, string.Format(Constants.HelpStartDataFlowDebugSessionContext, this.ResourceGroupName, this.DataFactoryName)))
55+
{
56+
WriteObject(DataFactoryClient.StartDebugSession(ResourceGroupName, DataFactoryName, request));
57+
}
5558
}
5659

5760
private IntegrationRuntimeDebugResource ConvertRequestFromJson(string requestFile)

src/DataFactory/DataFactoryV2/DataFlowDebugSessions/StopAzureDataFactoryDataFlowDebugSessionCommand.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
namespace Microsoft.Azure.Commands.DataFactoryV2
2020
{
21-
[Cmdlet("Stop", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlowDebugSession", DefaultParameterSetName = ParameterSetNames.ByFactoryName, SupportsShouldProcess = true), OutputType(typeof(void))]
21+
[Cmdlet("Stop", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlowDebugSession", DefaultParameterSetName = ParameterSetNames.ByFactoryName, SupportsShouldProcess = true)]
22+
[OutputType(typeof(void))]
23+
[OutputType(typeof(string))]
2224
public class StopAzureDataFactoryDataFlowDebugSessionCommand : DataFactoryDataFlowDebugSessionBaseCmdlet
2325
{
2426
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
@@ -61,7 +63,7 @@ private void ExecuteDelete()
6163
{
6264
DataFactoryClient.DeleteDebugSession(ResourceGroupName, DataFactoryName, SessionId);
6365

64-
if (PassThru)
66+
if (this.PassThru.IsPresent)
6567
{
6668
WriteObject(true);
6769
}

src/DataFactory/DataFactoryV2/DataFlows/RemoveAzureDataFactoryDataFlowCommand.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
namespace Microsoft.Azure.Commands.DataFactoryV2
2222
{
23-
[Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlow", DefaultParameterSetName = ParameterSetNames.ByFactoryName,SupportsShouldProcess = true), OutputType(typeof(void))]
23+
[Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlow", DefaultParameterSetName = ParameterSetNames.ByFactoryName, SupportsShouldProcess = true)]
24+
[OutputType(typeof(void))]
25+
[OutputType(typeof(string))]
2426
public class RemoveAzureDataFactoryDataFlowCommand : DataFactoryContextActionBaseCmdlet
2527
{
2628
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryName, Position = 2, Mandatory = true,
@@ -34,6 +36,9 @@ public class RemoveAzureDataFactoryDataFlowCommand : DataFactoryContextActionBas
3436
[ValidateNotNull]
3537
public PSDataFlow InputObject { get; set; }
3638

39+
[Parameter(Mandatory = false, HelpMessage = "If specified will write true in case operation succeeds. This parameter is optional.")]
40+
public SwitchParameter PassThru { get; set; }
41+
3742
public override void ExecuteCmdlet()
3843
{
3944
ByInputObject(InputObject);
@@ -63,6 +68,11 @@ private void ExecuteDelete()
6368
{
6469
WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.DataFlowNotFound, Name, DataFactoryName));
6570
}
71+
72+
if (this.PassThru.IsPresent)
73+
{
74+
WriteObject(true);
75+
}
6676
}
6777
}
6878
}

src/DataFactory/DataFactoryV2/DataFlows/SetAzureDataFactoryDataFlowCommand.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
namespace Microsoft.Azure.Commands.DataFactoryV2
2020
{
21-
[Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlow", DefaultParameterSetName = ParameterSetNames.ByFactoryName,SupportsShouldProcess = true), OutputType(typeof(PSDataFlow))]
21+
[Cmdlet("Set", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlow", DefaultParameterSetName = ParameterSetNames.ByFactoryName, SupportsShouldProcess = true), OutputType(typeof(PSDataFlow))]
2222
[Alias("New-" + ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2DataFlow")]
2323
public class SetAzureDataFactoryDataFlowCommand : DataFactoryContextBaseSetCmdlet
2424
{
@@ -44,7 +44,10 @@ public override void ExecuteCmdlet()
4444
ConfirmAction = ConfirmAction
4545
};
4646

47-
WriteObject(DataFactoryClient.CreatePSDataFlow(parameters));
47+
if (ShouldProcess(Name, string.Format(Constants.HelpDataFlowCreationContext, this.Name, this.ResourceGroupName, this.DataFactoryName)))
48+
{
49+
WriteObject(DataFactoryClient.CreatePSDataFlow(parameters));
50+
}
4851
}
4952
}
5053
}

src/DataFactory/DataFactoryV2/help/Add-AzDataFactoryV2DataFlowDebugSessionPackage.md

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.DataFactoryV2.dll-Help.xml
33
Module Name: Az.DataFactory
4-
online version:
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.datafactory/add-azdatafactoryv2dataflowdebugsessionpackage
55
schema: 2.0.0
66
---
77

@@ -48,6 +48,90 @@ PS C:\WINDOWS\system32> Add-AzDataFactoryV2DataFlowDebugSessionPackage -Resource
4848
```
4949

5050
Add data flow package into debug session "550effe4-93a3-485c-8525-eaf25259efbd" of "UncycloADF" data factory.
51+
Pakcage file contains data flow debug resource, list of dataset debug resouce, list of linked service debug resource, debug setting and session ID. For instance:
52+
53+
```json
54+
{
55+
"dataFlow": {
56+
"name": "dataflow5",
57+
"properties": {
58+
"type": "MappingDataFlow",
59+
"typeProperties": {
60+
"sources": [
61+
{
62+
"dataset": {
63+
"referenceName": "DelimitedTextInput",
64+
"type": "DatasetReference"
65+
},
66+
"name": "source1",
67+
"typeProperties": {}
68+
}
69+
],
70+
"sinks": [],
71+
"transformations": [],
72+
"script": "\n\nsource(output(\n\t\tResourceAgencyNum as string,\n\t\tPublicName as string\n\t),\n\tallowSchemaDrift: true,\n\tvalidateSchema: false) ~> source1"
73+
}
74+
}
75+
},
76+
"datasets": [
77+
{
78+
"name": "DelimitedTextInput",
79+
"properties": {
80+
"linkedServiceName": {
81+
"referenceName": "AzureBlobStorage1",
82+
"type": "LinkedServiceReference"
83+
},
84+
"annotations": [],
85+
"type": "DelimitedText",
86+
"typeProperties": {
87+
"location": {
88+
"type": "AzureBlobStorageLocation",
89+
"container": "20192019"
90+
},
91+
"columnDelimiter": ",",
92+
"escapeChar": "\\",
93+
"firstRowAsHeader": true,
94+
"quoteChar": "\""
95+
},
96+
"schema": [
97+
{
98+
"name": "ResourceAgencyNum",
99+
"type": "String"
100+
},
101+
{
102+
"name": "PublicName",
103+
"type": "String"
104+
}
105+
]
106+
},
107+
"type": "Microsoft.DataFactory/factories/datasets"
108+
}
109+
],
110+
"linkedServices": [
111+
{
112+
"name": "AzureBlobStorage1",
113+
"type": "Microsoft.DataFactory/factories/linkedservices",
114+
"properties": {
115+
"annotations": [],
116+
"type": "AzureBlobStorage",
117+
"typeProperties": {
118+
"connectionString": "DefaultEndpointsProtocol=https;AccountName=name;AccountKey=key;EndpointSuffix=core.windows.net"
119+
}
120+
}
121+
}
122+
],
123+
"debugSettings": {
124+
"sourceSettings": [
125+
{
126+
"sourceName": "source1",
127+
"rowLimit": 1000
128+
}
129+
]
130+
},
131+
"sessionId": "4f988caf-e765-47d2-82cd-430334a6b135"
132+
}
133+
```
134+
51135
SessionID parameter is used to replace the existing sessionId property in the package file.
52136

53137
## PARAMETERS
@@ -201,6 +285,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
201285
202286
### System.Void
203287
288+
### System.String
289+
204290
## NOTES
205291
Keywords: azure, azurerm, arm, resource, management, manager, data, factories
206292

src/DataFactory/DataFactoryV2/help/Get-AzDataFactoryV2DataFlow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.DataFactoryV2.dll-Help.xml
33
Module Name: Az.DataFactory
4-
online version:
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.datafactory/get-azdatafactoryv2dataflow
55
schema: 2.0.0
66
---
77

src/DataFactory/DataFactoryV2/help/Get-AzDataFactoryV2DataFlowDebugSession.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.DataFactoryV2.dll-Help.xml
33
Module Name: Az.DataFactory
4-
online version:
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.datafactory/get-azdatafactoryv2dataflowdebugsession
55
schema: 2.0.0
66
---
77

src/DataFactory/DataFactoryV2/help/Invoke-AzDataFactoryV2DataFlowDebugSessionCommand.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.DataFactoryV2.dll-Help.xml
33
Module Name: Az.DataFactory
4-
online version:
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.datafactory/invoke-azdatafactoryv2dataflowdebugsessioncommand
55
schema: 2.0.0
66
---
77

src/DataFactory/DataFactoryV2/help/Remove-AzDataFactoryV2DataFlow.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.DataFactoryV2.dll-Help.xml
33
Module Name: Az.DataFactory
4-
online version:
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.datafactory/remove-azdatafactoryv2dataflow
55
schema: 2.0.0
66
---
77

@@ -155,6 +155,21 @@ Accept pipeline input: True (ByPropertyName)
155155
Accept wildcard characters: False
156156
```
157157
158+
### -PassThru
159+
If specified will write true in case operation succeeds. This parameter is optional.
160+
161+
```yaml
162+
Type: System.Management.Automation.SwitchParameter
163+
Parameter Sets: (All)
164+
Aliases:
165+
166+
Required: False
167+
Position: Named
168+
Default value: None
169+
Accept pipeline input: False
170+
Accept wildcard characters: False
171+
```
172+
158173
### -Confirm
159174
Prompts you for confirmation before running the cmdlet.
160175
@@ -199,6 +214,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
199214
200215
### System.Void
201216
217+
### System.String
218+
202219
## NOTES
203220
Keywords: azure, azurerm, arm, resource, management, manager, data, factories
204221

src/DataFactory/DataFactoryV2/help/Set-AzDataFactoryV2DataFlow.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.DataFactoryV2.dll-Help.xml
33
Module Name: Az.DataFactory
4-
online version:
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.datafactory/set-azdatafactoryv2dataflow
55
schema: 2.0.0
66
---
77

@@ -38,6 +38,16 @@ DataFlowName : TaxiDemo1
3838
ResourceGroupName : adf
3939
DataFactoryName : UncycloADF
4040
Properties : Microsoft.Azure.Management.DataFactory.Models.MappingDataFlow
41+
42+
OR
43+
44+
PS C:\> Set-AzDataFactoryV2DataFlow -ResourceGroupName "ADF" -DataFactoryName "UncycloADF" -Name "TaxiDemo1" -DefinitionFile "C:\\samples\\UncycloSample\\TaxiDemo1.json" | Format-Table
45+
46+
Name Properties Id ETag ResourceGroupNa
47+
me
48+
---- ---------- -- ---- ---------------
49+
TaxiDemo1 Microsoft.Azure.Management.DataFactory.Models.MappingDataFlow /subscriptions/12345678-1234-2234-3234-123456782234/resourceGroups/adf/providers/Microsoft.DataFactory/factories/UncycloADF/dataflows/TaxiDemo1 7201b8e2-0000-1800-0000-5d92a2c20000 adf
50+
4151
```
4252

4353
This command creates a data flow named TaxiDemo1 in the data factory named UncycloADF.

src/DataFactory/DataFactoryV2/help/Start-AzDataFactoryV2DataFlowDebugSession.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.DataFactoryV2.dll-Help.xml
33
Module Name: Az.DataFactory
4-
online version:
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.datafactory/start-azdatafactoryv2dataflowdebugsession
55
schema: 2.0.0
66
---
77

0 commit comments

Comments
 (0)