Skip to content

Commit ae4cc8c

Browse files
committed
Addressed review comments
1 parent 85f3b4e commit ae4cc8c

15 files changed

+38
-88
lines changed

src/ResourceManager/DataFactories/Commands.DataFactoryV2.Test/ScenarioTests/RunTests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function Test-Run
4343
Set-AzureRmDataFactoryV2Pipeline -ResourceGroupName $rgname -Name $pipelineName -DataFactoryName $dfname -File ".\Resources\pipeline.json" -Force
4444

4545
$Run = Invoke-AzureRmDataFactoryV2Pipeline -ResourceGroupName $rgname -PipelineName $pipelineName -DataFactoryName $dfname -Parameter @{"OutputBlobName"="test";}
46-
Assert-True { Stop-AzureRmDataFactoryV2PipelineRun -ResourceGroupName $rgname -PipelineRunId $Run -DataFactoryName $dfname -Force -PassThru}
46+
Assert-True { Stop-AzureRmDataFactoryV2PipelineRun -ResourceGroupName $rgname -PipelineRunId $Run -DataFactoryName $dfname -PassThru}
4747

4848
# Trying get activity run.
4949
Get-AzureRmDataFactoryV2ActivityRun -ResourceGroupName $rgname -DataFactoryName $dfname -PipelineRunId $Run -RunStartedBefore $endDate -RunStartedAfter $startDate
@@ -77,7 +77,7 @@ function Test-CancelRunNegative
7777
Set-AzureRmDataFactoryV2 -ResourceGroupName $rgname -Name $dfname -Location $dflocation -Force
7878

7979
$Run = "someGuid"
80-
Assert-ThrowsContains { Stop-AzureRmDataFactoryV2PipelineRun -ResourceGroupName $rgname -DataFactoryName $dfname -PipelineRunId $Run -Force } "Pipeline run does not exist"
80+
Assert-ThrowsContains { Stop-AzureRmDataFactoryV2PipelineRun -ResourceGroupName $rgname -DataFactoryName $dfname -PipelineRunId $Run } "Pipeline run does not exist"
8181
}
8282
finally
8383
{

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Changelog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@
1919
-->
2020

2121
## Current Release
22-
* Added 2 new cmdlets: Update-AzureRmDataFactoryV2 and Stop-AzureRmDataFactoryV2PipelineRun
22+
* Added two new cmdlets: Update-AzureRmDataFactoryV2 and Stop-AzureRmDataFactoryV2PipelineRun
2323

24+
## Version 0.3.0
25+
* Azure DataFactory PowerShell cmdlets for ADF V2 Private Preview

src/ResourceManager/DataFactories/Commands.DataFactoryV2/DataFactories/UpdateAzureDataFactoryCommand.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414

1515
using System;
1616
using System.Collections;
17-
using System.Globalization;
1817
using System.Management.Automation;
1918
using System.Security.Permissions;
2019
using Microsoft.Azure.Commands.DataFactoryV2.Models;
21-
using Microsoft.Azure.Commands.DataFactoryV2.Properties;
2220
using Microsoft.Azure.Management.DataFactory.Models;
2321
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
2422

@@ -49,19 +47,11 @@ public class UpdateAzureDataFactoryCommand : DataFactoryBaseCmdlet
4947
[ValidateNotNullOrEmpty]
5048
public string ResourceId { get; set; }
5149

52-
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryName, Position = 2, Mandatory = false,
53-
HelpMessage = Constants.HelpTagsForFactory)]
54-
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryObject, Position = 1, Mandatory = false,
55-
HelpMessage = Constants.HelpTagsForFactory)]
56-
[Parameter(ParameterSetName = ParameterSetNames.ByResourceId, Position = 1, Mandatory = false,
50+
[Parameter(Mandatory = false,
5751
HelpMessage = Constants.HelpTagsForFactory)]
5852
public Hashtable Tag { get; set; }
5953

60-
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryName, Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true,
61-
HelpMessage = Constants.HelpIdentityForFactory)]
62-
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryObject, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true,
63-
HelpMessage = Constants.HelpIdentityForFactory)]
64-
[Parameter(ParameterSetName = ParameterSetNames.ByResourceId, Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true,
54+
[Parameter(Mandatory = false, ValueFromPipeline = true,
6555
HelpMessage = Constants.HelpIdentityForFactory)]
6656
public FactoryIdentity Identity { get; set; }
6757

@@ -88,7 +78,10 @@ public override void ExecuteCmdlet()
8878
Identity = Identity
8979
};
9080

91-
WriteObject(DataFactoryClient.UpdatePSDataFactory(parameters));
81+
if (ShouldProcess(Name))
82+
{
83+
WriteObject(DataFactoryClient.UpdatePSDataFactory(parameters));
84+
}
9285
}
9386
}
9487
}

src/ResourceManager/DataFactories/Commands.DataFactoryV2/DataFactoryContextBaseCmdlet.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public abstract class DataFactoryContextBaseCmdlet: DataFactoryBaseCmdlet
3737
[ValidateNotNullOrEmpty]
3838
public string DataFactoryName { get; set; }
3939

40-
protected void ByFactoryObject(PSDataFactory dataFactory)
40+
protected void ByFactoryObject()
4141
{
4242
if (ParameterSetName.Equals(ParameterSetNames.ByFactoryObject, StringComparison.OrdinalIgnoreCase))
4343
{
44-
DataFactoryName = dataFactory.DataFactoryName;
45-
ResourceGroupName = dataFactory.ResourceGroupName;
44+
DataFactoryName = DataFactory.DataFactoryName;
45+
ResourceGroupName = DataFactory.ResourceGroupName;
4646
}
4747
}
4848
}

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Datasets/GetAzureDataFactoryDatasetCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class GetAzureDataFactoryDatasetCommand : DataFactoryContextBaseGetCmdlet
3535
public override void ExecuteCmdlet()
3636
{
3737
ByResourceId();
38-
ByFactoryObject(DataFactory);
38+
ByFactoryObject();
3939

4040
var filterOptions = new AdfEntityFilterOptions()
4141
{

src/ResourceManager/DataFactories/Commands.DataFactoryV2/LinkedServices/GetAzureDataFactoryLinkedServiceCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class GetAzureDataFactoryLinkedServiceCommand : DataFactoryContextBaseGet
3636
public override void ExecuteCmdlet()
3737
{
3838
ByResourceId();
39-
ByFactoryObject(DataFactory);
39+
ByFactoryObject();
4040

4141
AdfEntityFilterOptions filterOptions = new AdfEntityFilterOptions()
4242
{

src/ResourceManager/DataFactories/Commands.DataFactoryV2/LinkedServices/NewAzureDataFactoryLinkedServiceEncryptedCredentialCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class NewAzureDataFactoryLinkedServiceEncryptedCredentialCommand : DataFa
4646
[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
4747
public override void ExecuteCmdlet()
4848
{
49-
ByFactoryObject(DataFactory);
49+
ByFactoryObject();
5050

5151
// ValidationNotNullOrEmpty doesn't handle whitespaces well
5252
if (IntegrationRuntimeName.IsEmptyOrWhiteSpace())

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Models/DataFactoryClient.Pipelines.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public virtual string CreatePipelineRun(string resourceGroupName, string dataFac
107107
return response.RunId;
108108
}
109109

110-
public virtual void StopPipelineRun(string resourceGroupName, string dataFactoryName, string pipelineRunId)
110+
public void StopPipelineRun(string resourceGroupName, string dataFactoryName, string pipelineRunId)
111111
{
112112
this.DataFactoryManagementClient.Factories.CancelPipelineRun(resourceGroupName, dataFactoryName, pipelineRunId);
113113
}

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Pipelines/GetAzureDataFactoryPipelineCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class GetAzureDataFactoryPipelineCommand : DataFactoryContextBaseGetCmdle
3636
public override void ExecuteCmdlet()
3737
{
3838
ByResourceId();
39-
ByFactoryObject(DataFactory);
39+
ByFactoryObject();
4040

4141
AdfEntityFilterOptions filterOptions = new AdfEntityFilterOptions()
4242
{

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Runs/GetAzureDataFactoryActivityRunCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public class GetAzureDataFactoryActivityRunCommand : DataFactoryContextBaseCmdle
6969
[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
7070
public override void ExecuteCmdlet()
7171
{
72-
ByFactoryObject(DataFactory);
72+
ByFactoryObject();
7373

7474
ActivityRunFilterOptions activityRunFilter = new ActivityRunFilterOptions
7575
{

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Runs/GetAzureDataFactoryTriggerRunCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class GetAzureDataFactoryTriggerRunCommand : DataFactoryContextBaseCmdlet
4949
[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
5050
public override void ExecuteCmdlet()
5151
{
52-
ByFactoryObject(DataFactory);
52+
ByFactoryObject();
5353

5454
TriggerRunFilterOptions triggerRunFilter = new TriggerRunFilterOptions
5555
{

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Runs/StopAzureDataFactoryPipelineRunCommand.cs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System.Collections.Generic;
16-
using System.Globalization;
15+
using System;
1716
using System.Management.Automation;
1817
using System.Security.Permissions;
1918
using Microsoft.Azure.Commands.DataFactoryV2.Models;
20-
using Microsoft.Azure.Commands.DataFactoryV2.Properties;
21-
using System;
2219

2320
namespace Microsoft.Azure.Commands.DataFactoryV2
2421
{
@@ -37,37 +34,24 @@ public class StopAzureDataFactoryPipelineRunCommand : DataFactoryContextBaseCmdl
3734
[ValidateNotNullOrEmpty]
3835
public string PipelineRunId { get; set; }
3936

40-
[Parameter(Mandatory = false, HelpMessage = Constants.HelpDontAskConfirmation)]
41-
public SwitchParameter Force { get; set; }
42-
4337
[Parameter(Mandatory = false)]
4438
public SwitchParameter PassThru { get; set; }
4539

4640
[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
4741
public override void ExecuteCmdlet()
4842
{
49-
ByFactoryObject(DataFactory);
43+
ByFactoryObject();
5044
if (ParameterSetName.Equals(ParameterSetNames.ByInputObject, StringComparison.OrdinalIgnoreCase))
5145
{
5246
DataFactoryName = InputObject.DataFactoryName;
5347
ResourceGroupName = InputObject.ResourceGroupName;
5448
PipelineRunId = InputObject.RunId;
5549
}
5650

57-
ConfirmAction(
58-
Force.IsPresent,
59-
string.Format(
60-
CultureInfo.InvariantCulture,
61-
Resources.PipelineRunStopConfirmation,
62-
PipelineRunId,
63-
DataFactoryName),
64-
string.Format(
65-
CultureInfo.InvariantCulture,
66-
Resources.PipelineRunStopping,
67-
PipelineRunId,
68-
DataFactoryName),
69-
PipelineRunId,
70-
() => DataFactoryClient.StopPipelineRun(ResourceGroupName, DataFactoryName, PipelineRunId));
51+
if (ShouldProcess(PipelineRunId))
52+
{
53+
DataFactoryClient.StopPipelineRun(ResourceGroupName, DataFactoryName, PipelineRunId);
54+
}
7155

7256
if (PassThru)
7357
{

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Triggers/GetAzureDataFactoryTriggerCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class GetAzureDataFactoryTriggerCommand : DataFactoryContextBaseGetCmdlet
3535
public override void ExecuteCmdlet()
3636
{
3737
ByResourceId();
38-
ByFactoryObject(DataFactory);
38+
ByFactoryObject();
3939

4040
AdfEntityFilterOptions filterOptions = new AdfEntityFilterOptions()
4141
{

src/ResourceManager/DataFactories/Commands.DataFactoryV2/help/Stop-AzureRmDataFactoryV2PipelineRun.md

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,21 @@ Stops a pieline run in a data factory.
1313

1414
### ByFactoryName (Default)
1515
```
16-
Stop-AzureRmDataFactoryV2PipelineRun [-PipelineRunId] <String> [-Force] [-PassThru]
17-
[-ResourceGroupName] <String> [-DataFactoryName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
18-
[-Confirm] [<CommonParameters>]
16+
Stop-AzureRmDataFactoryV2PipelineRun [-PipelineRunId] <String> [-PassThru] [-ResourceGroupName] <String>
17+
[-DataFactoryName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
18+
[<CommonParameters>]
1919
```
2020

2121
### ByInputObject
2222
```
23-
Stop-AzureRmDataFactoryV2PipelineRun [-InputObject] <PSPipelineRun> [-Force] [-PassThru]
23+
Stop-AzureRmDataFactoryV2PipelineRun [-InputObject] <PSPipelineRun> [-PassThru]
2424
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2525
```
2626

2727
### ByFactoryObject
2828
```
29-
Stop-AzureRmDataFactoryV2PipelineRun [-PipelineRunId] <String> [-Force] [-PassThru]
30-
[-DataFactory] <PSDataFactory> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
31-
[<CommonParameters>]
29+
Stop-AzureRmDataFactoryV2PipelineRun [-PipelineRunId] <String> [-PassThru] [-DataFactory] <PSDataFactory>
30+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3231
```
3332

3433
## DESCRIPTION
@@ -96,21 +95,6 @@ Accept pipeline input: False
9695
Accept wildcard characters: False
9796
```
9897
99-
### -Force
100-
Don't ask for confirmation.
101-
102-
```yaml
103-
Type: SwitchParameter
104-
Parameter Sets: (All)
105-
Aliases:
106-
107-
Required: False
108-
Position: Named
109-
Default value: None
110-
Accept pipeline input: False
111-
Accept wildcard characters: False
112-
```
113-
11498
### -InputObject
11599
The Run ID of the pipeline.
116100

src/ResourceManager/DataFactories/Commands.DataFactoryV2/help/Update-AzureRmDataFactoryV2.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ Updates the properties of a data factory.
1414
### ByFactoryName (Default)
1515
```
1616
Update-AzureRmDataFactoryV2 [-ResourceGroupName] <String> [-Name] <String> [[-Tag] <Hashtable>]
17-
[[-Identity] <FactoryIdentity>] [-Force] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
17+
[[-Identity] <FactoryIdentity>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
1818
[<CommonParameters>]
1919
```
2020

2121
### ByFactoryObject
2222
```
2323
Update-AzureRmDataFactoryV2 [-InputObject] <PSDataFactory> [[-Tag] <Hashtable>] [[-Identity] <FactoryIdentity>]
24-
[-Force] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
24+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2525
```
2626

2727
### ByResourceId
2828
```
2929
Update-AzureRmDataFactoryV2 [-ResourceId] <String> [[-Tag] <Hashtable>] [[-Identity] <FactoryIdentity>]
30-
[-Force] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
30+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3131
```
3232

3333
## DESCRIPTION
@@ -73,19 +73,6 @@ Accept pipeline input: False
7373
Accept wildcard characters: False
7474
```
7575
76-
### -Force
77-
Don't ask for confirmation.```yaml
78-
Type: SwitchParameter
79-
Parameter Sets: (All)
80-
Aliases:
81-
82-
Required: False
83-
Position: Named
84-
Default value: None
85-
Accept pipeline input: False
86-
Accept wildcard characters: False
87-
```
88-
8976
### -Identity
9077
The identity for the data factory.
9178
@@ -97,7 +84,7 @@ Aliases:
9784
Required: False
9885
Position: 2
9986
Default value: None
100-
Accept pipeline input: True (ByPropertyName)
87+
Accept pipeline input: True (ByValue)
10188
Accept wildcard characters: False
10289
```
10390

0 commit comments

Comments
 (0)