@@ -31,29 +31,63 @@ public class GetAzureNetworkInterfaceCommand : NetworkInterfaceBaseCmdlet
31
31
ValueFromPipelineByPropertyName = true ,
32
32
HelpMessage = "The resource name." ) ]
33
33
[ ValidateNotNullOrEmpty ]
34
- public virtual string Name { get ; set ; }
34
+ public string Name { get ; set ; }
35
35
36
36
[ Parameter (
37
37
Mandatory = false ,
38
38
ValueFromPipelineByPropertyName = true ,
39
39
HelpMessage = "The resource group name." ) ]
40
40
[ ValidateNotNullOrEmpty ]
41
- public virtual string ResourceGroupName { get ; set ; }
41
+ public string ResourceGroupName { get ; set ; }
42
+
43
+ [ Parameter (
44
+ Mandatory = false ,
45
+ ValueFromPipelineByPropertyName = true ,
46
+ HelpMessage = "Virtual Machine Scale Set Name." ,
47
+ ParameterSetName = "ScaleSetNic" ) ]
48
+ [ ValidateNotNullOrEmpty ]
49
+ public string VirtualMachineScaleSetName { get ; set ; }
50
+
51
+ [ Parameter (
52
+ Mandatory = false ,
53
+ ValueFromPipelineByPropertyName = true ,
54
+ HelpMessage = "Virtual Machine Index." ,
55
+ ParameterSetName = "ScaleSetNic" ) ]
56
+ [ ValidateNotNullOrEmpty ]
57
+ public string VirtualMachineIndex { get ; set ; }
42
58
43
59
protected override void ProcessRecord ( )
44
60
{
45
61
base . ProcessRecord ( ) ;
46
62
47
63
if ( ! string . IsNullOrEmpty ( this . Name ) )
48
64
{
49
- var networkInterface = this . GetNetworkInterface ( this . ResourceGroupName , this . Name ) ;
65
+ PSNetworkInterface networkInterface ;
66
+
67
+ if ( ParameterSetName . Equals ( "ScaleSetNic" ) )
68
+ {
69
+ networkInterface = this . GetScaleSetNetworkInterface ( this . ResourceGroupName , this . VirtualMachineScaleSetName , this . VirtualMachineIndex , this . Name ) ;
70
+ }
71
+ else
72
+ {
73
+ networkInterface = this . GetNetworkInterface ( this . ResourceGroupName , this . Name ) ;
74
+ }
50
75
51
76
WriteObject ( networkInterface ) ;
52
77
}
53
78
else if ( ! string . IsNullOrEmpty ( this . ResourceGroupName ) )
54
79
{
55
- var getNetworkInterfaceResponse = this . NetworkInterfaceClient . List ( this . ResourceGroupName ) ;
80
+ var getNetworkInterfaceResponse = new MNM . NetworkInterfaceListResponse ( ) ;
56
81
82
+ if ( ParameterSetName . Equals ( "ScaleSetNic" ) )
83
+ {
84
+ getNetworkInterfaceResponse = this . NetworkInterfaceClient . ListVirtualMachineScaleSetNetworkInterfaces ( this . ResourceGroupName , this . VirtualMachineScaleSetName ) ;
85
+ }
86
+ else
87
+ {
88
+ getNetworkInterfaceResponse = this . NetworkInterfaceClient . List ( this . ResourceGroupName ) ;
89
+ }
90
+
57
91
var psNetworkInterfaces = new List < PSNetworkInterface > ( ) ;
58
92
59
93
foreach ( var nic in getNetworkInterfaceResponse . NetworkInterfaces )
0 commit comments