20
20
// code is regenerated.
21
21
22
22
using Microsoft . Azure . Commands . Network . Models ;
23
+ using Microsoft . Azure . Management . Internal . Resources . Utilities . Models ;
23
24
using Microsoft . Azure . Management . Network ;
24
25
using Microsoft . Azure . Management . Network . Models ;
25
26
using System ;
33
34
34
35
namespace Microsoft . Azure . Commands . Network . Automation
35
36
{
36
- [ Cmdlet ( VerbsCommon . Get , "AzureRMNetworkWatcherReachabilityReport" , DefaultParameterSetName = "SetByResource " ) , OutputType ( typeof ( PSAzureReachabilityReport ) ) ]
37
+ [ Cmdlet ( VerbsCommon . Get , "AzureRMNetworkWatcherReachabilityReport" , DefaultParameterSetName = "SetByName " ) , OutputType ( typeof ( PSAzureReachabilityReport ) ) ]
37
38
public partial class GetAzureRMNetworkWatcherReachabilityReport : NetworkBaseCmdlet
38
39
{
39
40
[ Parameter (
@@ -47,61 +48,58 @@ public partial class GetAzureRMNetworkWatcherReachabilityReport : NetworkBaseCmd
47
48
[ Parameter (
48
49
Mandatory = true ,
49
50
HelpMessage = "The name of network watcher." ,
50
- ParameterSetName = "SetByName" ,
51
- ValueFromPipeline = true ,
52
- ValueFromPipelineByPropertyName = true ) ]
51
+ ParameterSetName = "SetByName" ) ]
53
52
[ ValidateNotNullOrEmpty ]
54
53
public string NetworkWatcherName { get ; set ; }
55
54
56
55
57
56
[ Parameter (
58
57
Mandatory = true ,
59
58
HelpMessage = "The name of the network watcher resource group." ,
60
- ParameterSetName = "SetByName" ,
61
- ValueFromPipelineByPropertyName = true ) ]
59
+ ParameterSetName = "SetByName" ) ]
62
60
[ ValidateNotNullOrEmpty ]
63
61
public string ResourceGroupName { get ; set ; }
64
62
63
+ [ Parameter (
64
+ Mandatory = true ,
65
+ ValueFromPipelineByPropertyName = true ,
66
+ HelpMessage = "The Id of network watcher resource." ,
67
+ ParameterSetName = "SetByResourceId" ) ]
68
+ public string ResourceId { get ; set ; }
69
+
65
70
[ Parameter (
66
71
Mandatory = false ,
67
- HelpMessage = "List of Internet service providers." ,
68
- ValueFromPipelineByPropertyName = true ) ]
69
- public List < string > Providers { get ; set ; }
72
+ HelpMessage = "List of Internet service providers." ) ]
73
+ public List < string > Provider { get ; set ; }
70
74
71
75
[ Parameter (
72
76
Mandatory = false ,
73
- HelpMessage = "Optional Azure regions to scope the query to." ,
74
- ValueFromPipelineByPropertyName = true ) ]
75
- public List < string > AzureLocations { get ; set ; }
77
+ HelpMessage = "Optional Azure regions to scope the query to." ) ]
78
+ public List < string > Location { get ; set ; }
76
79
77
80
[ Parameter (
78
81
Mandatory = true ,
79
- HelpMessage = "The start time for the Azure reachability report." ,
80
- ValueFromPipelineByPropertyName = true ) ]
82
+ HelpMessage = "The start time for the Azure reachability report." ) ]
81
83
public DateTime StartTime { get ; set ; }
82
84
83
85
[ Parameter (
84
86
Mandatory = true ,
85
- HelpMessage = "The end time for the Azure reachability report." ,
86
- ValueFromPipelineByPropertyName = true ) ]
87
+ HelpMessage = "The end time for the Azure reachability report." ) ]
87
88
public DateTime EndTime { get ; set ; }
88
89
89
90
[ Parameter (
90
91
Mandatory = false ,
91
- HelpMessage = "The name of the country." ,
92
- ValueFromPipelineByPropertyName = true ) ]
92
+ HelpMessage = "The name of the country." ) ]
93
93
public string Country { get ; set ; }
94
94
95
95
[ Parameter (
96
96
Mandatory = false ,
97
- HelpMessage = "The name of the state." ,
98
- ValueFromPipelineByPropertyName = true ) ]
97
+ HelpMessage = "The name of the state." ) ]
99
98
public string State { get ; set ; }
100
99
101
100
[ Parameter (
102
101
Mandatory = false ,
103
- HelpMessage = "The name of the city." ,
104
- ValueFromPipelineByPropertyName = true ) ]
102
+ HelpMessage = "The name of the city." ) ]
105
103
public string City { get ; set ; }
106
104
107
105
public override void Execute ( )
@@ -140,18 +138,26 @@ public override void Execute()
140
138
141
139
var vAzureReachabilityReportParameters = new AzureReachabilityReportParameters
142
140
{
143
- Providers = this . Providers ,
144
- AzureLocations = this . AzureLocations ,
141
+ Providers = this . Provider ,
142
+ AzureLocations = this . Location ,
145
143
StartTime = this . StartTime ,
146
144
EndTime = this . EndTime ,
147
145
ProviderLocation = NetworkResourceManagerProfile . Mapper . Map < MNM . AzureReachabilityReportLocation > ( vProviderLocation ) ,
148
146
} ;
149
147
150
- if ( ParameterSetName . Contains ( "SetByResource" ) )
148
+ if ( string . Equals ( this . ParameterSetName , "SetByResource" , StringComparison . OrdinalIgnoreCase ) )
151
149
{
152
150
ResourceGroupName = this . NetworkWatcher . ResourceGroupName ;
153
151
NetworkWatcherName = this . NetworkWatcher . Name ;
154
152
}
153
+
154
+ if ( string . Equals ( this . ParameterSetName , "SetByResourceId" , StringComparison . OrdinalIgnoreCase ) )
155
+ {
156
+ var resourceInfo = new ResourceIdentifier ( this . ResourceId ) ;
157
+ ResourceGroupName = resourceInfo . ResourceGroupName ;
158
+ NetworkWatcherName = resourceInfo . ResourceName ;
159
+ }
160
+
155
161
var vNetworkWatcherResult = this . NetworkClient . NetworkManagementClient . NetworkWatchers . GetAzureReachabilityReport ( ResourceGroupName , NetworkWatcherName , vAzureReachabilityReportParameters ) ;
156
162
var vNetworkWatcherModel = NetworkResourceManagerProfile . Mapper . Map < PSAzureReachabilityReport > ( vNetworkWatcherResult ) ;
157
163
WriteObject ( vNetworkWatcherModel ) ;
0 commit comments