Skip to content

Commit 4389e60

Browse files
committed
Resolve review comments, merged the Get-AzureRmDataFactoryV2IntegrationRuntimeNodeIp into Get-AzureRmDataFactoryV2IntegrationRuntimeNode
1 parent cbbd8b2 commit 4389e60

18 files changed

+515
-318
lines changed

src/ResourceManager/DataFactories/AzureRM.DataFactoryV2.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ CmdletsToExport =
105105
'Get-AzureRmDataFactoryV2IntegrationRuntimeMetric',
106106
'Remove-AzureRmDataFactoryV2IntegrationRuntimeNode',
107107
'Update-AzureRmDataFactoryV2IntegrationRuntimeNode',
108-
'Get-AzureRmDataFactoryV2IntegrationRuntimeNodeIp',
108+
'Get-AzureRmDataFactoryV2IntegrationRuntimeNode',
109109
'Invoke-AzureRmDataFactoryV2IntegrationRuntimeUpgrade',
110110
'Sync-AzureRmDataFactoryV2IntegrationRuntimeCredential',
111111
'Update-AzureRmDataFactoryV2IntegrationRuntime',

src/ResourceManager/DataFactories/Commands.DataFactoryV2.Test/packages.config

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
44
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
6-
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
76
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
87
<package id="Microsoft.Azure.Management.DataFactory" version="0.3.0-preview" targetFramework="net452" />
98
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
@@ -16,10 +15,8 @@
1615
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net45" />
1716
<package id="Microsoft.Data.Services.Client" version="5.6.4" targetFramework="net45" />
1817
<package id="Microsoft.DataTransfer.Gateway.Encryption" version="2.12.6415.4" targetFramework="net45" />
19-
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net45" />
2018
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
2119
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net45" />
22-
<package id="Microsoft.Rest.ClientRuntime.Azure.Authentication" version="2.3.1" targetFramework="net45" />
2320
<package id="Microsoft.Rest.ClientRuntime.Azure.TestFramework" version="1.7.2" targetFramework="net452" />
2421
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
2522
<package id="Moq" version="4.2.1510.2205" targetFramework="net45" />

src/ResourceManager/DataFactories/Commands.DataFactoryV2/Commands.DataFactoryV2.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<Compile Include="IntegrationRuntimes\GetAzureDataFactoryIntegrationRuntimeKeyCommand.cs" />
7474
<Compile Include="IntegrationRuntimes\GetAzureDataFactoryIntegrationRuntimeCommand.cs" />
7575
<Compile Include="IntegrationRuntimes\GetAzureDataFactoryIntegrationRuntimeMetricCommand.cs" />
76-
<Compile Include="IntegrationRuntimes\GetAzureDataFactoryIntegrationRuntimeNodeIpCommand.cs" />
76+
<Compile Include="IntegrationRuntimes\GetAzureDataFactoryIntegrationRuntimeNodeCommand.cs" />
7777
<Compile Include="IntegrationRuntimes\IntegrationRuntimeBaseCmdlet.cs" />
7878
<Compile Include="IntegrationRuntimes\IntegrationRuntimeCmdlet.cs" />
7979
<Compile Include="IntegrationRuntimes\IntegrationRuntimeContextBaseCmdlet.cs" />
@@ -89,6 +89,8 @@
8989
<Compile Include="IntegrationRuntimes\SyncAzureDataFactoryIntegrationRuntimeNodeCredential.cs" />
9090
<Compile Include="LinkedServices\NewAzureDataFactoryLinkedServiceEncryptedCredentialCommand.cs" />
9191
<Compile Include="Models\AdfSubResource.cs" />
92+
<Compile Include="Models\PSManagedIntegrationRuntimeNode.cs" />
93+
<Compile Include="Models\PSSelfHostedIntegrationRuntimeNode.cs" />
9294
<Compile Include="Models\TriggerRunFilterOptions.cs" />
9395
<Compile Include="Models\CreatePSAdfEntityParameters.cs" />
9496
<Compile Include="LinkedServices\GetAzureDataFactoryLinkedServiceCommand.cs" />

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ internal static class Constants
2626

2727
public const string IntegrationRuntimeNode = "AzureRmDataFactoryV2IntegrationRuntimeNode";
2828

29-
public const string IntegrationRuntimeNodeIp = "AzureRmDataFactoryV2IntegrationRuntimeNodeIp";
30-
3129
public const string IntegrationRuntimeMetric = "AzureRmDataFactoryV2IntegrationRuntimeMetric";
3230

3331
public const string IntegrationRuntimeKey = "AzureRmDataFactoryV2IntegrationRuntimeKey";
@@ -114,6 +112,8 @@ internal static class Constants
114112

115113
public const string HelpIntegrationRuntimeJobsLimit = "The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs are allowed.";
116114

115+
public const string HelpIntegrationRuntimeNodeIpAddress = "The IP Address of integration runtime node.";
116+
117117
public const string HelpPipelineRunId = "The Run ID of the pipeline.";
118118

119119
public const string HelpActivityName = "The name of the activity.";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Globalization;
17+
using System.Linq;
18+
using System.Management.Automation;
19+
using System.Security.Permissions;
20+
using Microsoft.Azure.Commands.DataFactoryV2.Models;
21+
22+
namespace Microsoft.Azure.Commands.DataFactoryV2
23+
{
24+
[Cmdlet(
25+
VerbsCommon.Get,
26+
Constants.IntegrationRuntimeNode,
27+
DefaultParameterSetName = ParameterSetNames.ByIntegrationRuntimeName),
28+
OutputType(typeof(PSManagedIntegrationRuntimeNode), typeof(PSSelfHostedIntegrationRuntimeNode))]
29+
public class GetAzureDataFactoryIntegrationRuntimeNodeCommand : IntegrationRuntimeContextBaseCmdlet
30+
{
31+
[Parameter(Mandatory = true,
32+
HelpMessage = Constants.HelpIntegrationRuntimeNodeName)]
33+
[ValidateNotNullOrEmpty]
34+
public string Name { get; set; }
35+
36+
[Parameter(
37+
Mandatory = false,
38+
HelpMessage = Constants.HelpIntegrationRuntimeNodeIpAddress)]
39+
public SwitchParameter IpAddress { get; set; }
40+
41+
[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
42+
public override void ExecuteCmdlet()
43+
{
44+
this.ByResourceId();
45+
this.ByIntegrationRuntimeObject();
46+
47+
var status = DataFactoryClient.GetIntegrationRuntimeStatusAsync(ResourceGroupName, DataFactoryName,
48+
IntegrationRuntimeName).ConfigureAwait(false).GetAwaiter().GetResult();
49+
50+
var managedStatus = status as PSManagedIntegrationRuntimeStatus;
51+
if (managedStatus != null)
52+
{
53+
if (IpAddress.IsPresent)
54+
{
55+
ThrowTerminatingError
56+
(new ErrorRecord(
57+
new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
58+
"The SSIS-Azure integration runtime does not support getting IP address of node.")),
59+
string.Empty,
60+
ErrorCategory.ObjectNotFound,
61+
null));
62+
}
63+
64+
var node = managedStatus.Nodes.FirstOrDefault(n => n.NodeId == Name);
65+
if (node == null)
66+
{
67+
ThrowTerminatingError
68+
(new ErrorRecord(
69+
new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
70+
"The node with node ID {0} in integration runtime {1} was not found.", Name, IntegrationRuntimeName)),
71+
string.Empty,
72+
ErrorCategory.ObjectNotFound,
73+
null));
74+
}
75+
76+
WriteObject(new PSManagedIntegrationRuntimeNode(ResourceGroupName, DataFactoryName, IntegrationRuntimeName, Name, node));
77+
}
78+
79+
var selfHostedStatus = status as PSSelfHostedIntegrationRuntimeStatus;
80+
if (selfHostedStatus != null)
81+
{
82+
var node = selfHostedStatus.Nodes.FirstOrDefault(n => n.NodeName == Name);
83+
if (node == null)
84+
{
85+
ThrowTerminatingError
86+
(new ErrorRecord(
87+
new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
88+
"The node with node name {0} in integration runtime {1} was not found.", Name, IntegrationRuntimeName)),
89+
string.Empty,
90+
ErrorCategory.ObjectNotFound,
91+
null));
92+
}
93+
94+
string ipAddress = null;
95+
if (IpAddress.IsPresent)
96+
{
97+
var ip = DataFactoryClient.GetIntegrationRuntimeNodeIpAsync(
98+
ResourceGroupName,
99+
DataFactoryName,
100+
IntegrationRuntimeName,
101+
Name).ConfigureAwait(false).GetAwaiter().GetResult();
102+
ipAddress = ip.IpAddress;
103+
}
104+
105+
WriteObject(new PSSelfHostedIntegrationRuntimeNode(ResourceGroupName, DataFactoryName, IntegrationRuntimeName, Name, node, ipAddress));
106+
}
107+
}
108+
}
109+
}

src/ResourceManager/DataFactories/Commands.DataFactoryV2/IntegrationRuntimes/GetAzureDataFactoryIntegrationRuntimeNodeIpCommand.cs

Lines changed: 0 additions & 46 deletions
This file was deleted.

src/ResourceManager/DataFactories/Commands.DataFactoryV2/IntegrationRuntimes/InvokeAzureDataFactoryIntegrationRuntimeUpgradeCommand.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ namespace Microsoft.Azure.Commands.DataFactoryV2
2727
SupportsShouldProcess = true)]
2828
public class InvokeAzureDataFactoryIntegrationRuntimeUpgradeCommand : IntegrationRuntimeCmdlet
2929
{
30-
[Parameter(
31-
Mandatory = false,
32-
HelpMessage = Constants.HelpDontAskConfirmation)]
33-
public SwitchParameter Force { get; set; }
34-
3530
[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
3631
public override void ExecuteCmdlet()
3732
{
@@ -47,11 +42,6 @@ public override void ExecuteCmdlet()
4742
};
4843

4944
ConfirmAction(
50-
Force.IsPresent,
51-
string.Format(
52-
CultureInfo.InvariantCulture,
53-
Resources.IntegrationRuntimeUpgrade,
54-
Name),
5545
string.Format(
5646
CultureInfo.InvariantCulture,
5747
Resources.IntegrationRuntimeUpgrading,

src/ResourceManager/DataFactories/Commands.DataFactoryV2/IntegrationRuntimes/UpdateAzureDataFactoryIntegrationRuntimeCommand.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ public class UpdateAzureDataFactoryIntegrationRuntimeCommand : IntegrationRuntim
4747
[ValidateNotNull]
4848
public TimeSpan? AutoUpdateDelayOffset { get; set; }
4949

50-
[Parameter(
51-
Mandatory = false, HelpMessage = Constants.HelpDontAskConfirmation)]
52-
public SwitchParameter Force { get; set; }
53-
5450
[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
5551
public override void ExecuteCmdlet()
5652
{
@@ -95,19 +91,13 @@ public override void ExecuteCmdlet()
9591
};
9692

9793
ConfirmAction(
98-
Force.IsPresent,
99-
string.Format(
100-
CultureInfo.InvariantCulture,
101-
Resources.IntegrationRuntimeUpdateMessage,
102-
Name),
10394
string.Format(
10495
CultureInfo.InvariantCulture,
10596
Resources.IntegrationRuntimeUpdating,
10697
Name,
10798
DataFactoryName),
10899
Name,
109-
updateIntegrationRuntime,
110-
() => true);
100+
updateIntegrationRuntime);
111101
}
112102
}
113103
}

src/ResourceManager/DataFactories/Commands.DataFactoryV2/IntegrationRuntimes/UpdateAzureDataFactoryIntegrationRuntimeNodeCommand.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ public class UpdateAzureDataFactoryIntegrationRuntimeNodeCommand : IntegrationRu
4040
HelpMessage = Constants.HelpIntegrationRuntimeJobsLimit)]
4141
public int ConcurrentJobsLimit { get; set; }
4242

43-
[Parameter(
44-
Mandatory = false, HelpMessage = Constants.HelpDontAskConfirmation)]
45-
public SwitchParameter Force { get; set; }
46-
4743
[EnvironmentPermission(SecurityAction.Demand, Unrestricted = true)]
4844
public override void ExecuteCmdlet()
4945
{
@@ -64,12 +60,6 @@ public override void ExecuteCmdlet()
6460
};
6561

6662
ConfirmAction(
67-
Force.IsPresent,
68-
string.Format(
69-
CultureInfo.InvariantCulture,
70-
Resources.IntegrationRuntimeNodeUpdateMessage,
71-
Name,
72-
IntegrationRuntimeName),
7363
string.Format(
7464
CultureInfo.InvariantCulture,
7565
Resources.IntegrationRuntimeNodeUpdating,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.Collections.Generic;
16+
using System.Management.Automation;
17+
using Microsoft.Azure.Management.DataFactory.Models;
18+
19+
20+
namespace Microsoft.Azure.Commands.DataFactoryV2.Models
21+
{
22+
public class PSManagedIntegrationRuntimeNode
23+
{
24+
public PSManagedIntegrationRuntimeNode(
25+
string resourceGroupName,
26+
string factoryName,
27+
string integrationRuntimeName,
28+
string name,
29+
ManagedIntegrationRuntimeNode node)
30+
{
31+
if (node == null)
32+
{
33+
throw new PSArgumentNullException("node");
34+
}
35+
36+
ResourceGroupName = resourceGroupName;
37+
DataFactoryName = factoryName;
38+
IntegrationRuntimeName = integrationRuntimeName;
39+
Name = name;
40+
_node = node;
41+
}
42+
43+
private readonly ManagedIntegrationRuntimeNode _node;
44+
45+
public string ResourceGroupName { get; private set; }
46+
47+
public string DataFactoryName { get; private set; }
48+
49+
public string IntegrationRuntimeName { get; private set; }
50+
51+
public string Name { get; private set; }
52+
53+
public string NodeId => _node.NodeId;
54+
55+
public string Status => _node.Status;
56+
57+
public IList<ManagedIntegrationRuntimeError> Errors => _node.Errors;
58+
}
59+
}

0 commit comments

Comments
 (0)