Skip to content

Commit 067b696

Browse files
author
Hovsep
committed
Merge pull request #1884 from AuxMon/dev
[Release-1.2.2] Clean the cmdlets code, add a deprecation warning to some of the cmdlets, add some verbose messages
2 parents 5c68570 + 05fa6cb commit 067b696

33 files changed

+66
-42
lines changed

src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/AddAutoscaleSettingCommandTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using System.Threading.Tasks;
2121
using Hyak.Common;
2222
using Microsoft.Azure.Commands.Insights.Autoscale;
23-
using Microsoft.Azure.Commands.Insights.OutputClasses;
2423
using Microsoft.Azure.Management.Insights;
2524
using Microsoft.Azure.Management.Insights.Models;
2625
using Microsoft.WindowsAzure.Commands.ScenarioTest;

src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/GetAutoscaleHistoryCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void GetAutoscaleHistoryCommandParametersProcessing()
6868
Test.Utilities.ExecuteVerifications(
6969
cmdlet: cmdlet,
7070
insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock,
71-
requiredFieldName: "eventSource",
71+
requiredFieldName: "category",
7272
requiredFieldValue: GetAutoscaleHistoryCommand.AutoscaleEventSourceName,
7373
filter: ref this.filter,
7474
selected: ref this.selected,

src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/GetDiagnosticSettingCommandTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using System.Net;
1919
using System.Threading;
2020
using System.Threading.Tasks;
21-
using Microsoft.Azure.Commands.Insights.Alerts;
2221
using Microsoft.Azure.Commands.Insights.Diagnostics;
2322
using Microsoft.Azure.Management.Insights;
2423
using Microsoft.Azure.Management.Insights.Models;
@@ -35,7 +34,6 @@ public class GetDiagnosticSettingCommandTests
3534
private readonly Mock<IServiceDiagnosticSettingsOperations> insightsDiagnosticsOperationsMock;
3635
private Mock<ICommandRuntime> commandRuntimeMock;
3736
private ServiceDiagnosticSettingsGetResponse response;
38-
private RuleCreateOrUpdateParameters createOrUpdatePrms;
3937
private const string resourceId = "/subscriptions/123/resourcegroups/rg/providers/rp/resource/myresource";
4038
private string calledResourceId;
4139

src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/SetDiagnosticSettingCommandTests.cs

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

1515
using System;
1616
using System.Collections.Generic;
17-
using System.Linq;
1817
using System.Management.Automation;
1918
using System.Net;
20-
using System.Threading;
2119
using System.Threading.Tasks;
22-
using Microsoft.Azure.Commands.Insights.Alerts;
2320
using Microsoft.Azure.Commands.Insights.Diagnostics;
2421
using Microsoft.Azure.Management.Insights;
2522
using Microsoft.Azure.Management.Insights.Models;
26-
using Microsoft.WindowsAzure.Commands.ScenarioTest;
2723
using Moq;
28-
using Xunit;
2924

3025
namespace Microsoft.Azure.Commands.Insights.Test.Diagnostics
3126
{
@@ -36,7 +31,6 @@ public class SetDiagnosticSettingCommandTests
3631
private readonly Mock<IServiceDiagnosticSettingsOperations> insightsDiagnosticsOperationsMock;
3732
private Mock<ICommandRuntime> commandRuntimeMock;
3833
private ServiceDiagnosticSettingsGetResponse response;
39-
private RuleCreateOrUpdateParameters createOrUpdatePrms;
4034
private const string resourceId = "/subscriptions/123/resourcegroups/rg/providers/rp/resource/myresource";
4135
private const string storageAccountId = "/subscriptions/123/resourcegroups/rg/providers/microsoft.storage/accounts/myaccount";
4236
private string calledResourceId;

src/ResourceManager/Insights/Commands.Insights.Test/Metrics/GetMetricDefinitionsCommandTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System;
1615
using System.Management.Automation;
1716
using System.Threading;
1817
using System.Threading.Tasks;

src/ResourceManager/Insights/Commands.Insights.Test/Utilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public static void VerifyConditionInFilter(string filter, string field, string v
218218
if (!string.IsNullOrWhiteSpace(field))
219219
{
220220
var condition = string.Format("and {0} eq '{1}'", field, value);
221-
Assert.True(filter.Contains(condition), "Filter does not contain required condition");
221+
Assert.True(filter.Contains(condition), string.Format("Filter: {0} does not contain required condition: {1}", filter, condition));
222222
}
223223
}
224224

src/ResourceManager/Insights/Commands.Insights.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
2525
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
2626
<package id="xunit" version="2.1.0" targetFramework="net45" />
27-
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
27+
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
2828
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
2929
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
3030
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />

src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommand.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ private ManagementEventRuleCondition CreateEventRuleCondition()
166166

167167
private void VerifyRuleTypeToParametersConsistency()
168168
{
169+
WriteVerboseWithTimestamp(string.Format("VerifyRuleTypeToParametersConsistency: input type:{0}", this.RuleType));
169170
AlertRuleTypes type = AlertRuleTypes.Event;
170171

171172
// NOTE: the parameters EventName and MetricName cannot appear both at same time (see the parameters declaration), but they can be both absent simultaneously (i.e. Webtest data source type)
@@ -209,12 +210,15 @@ private RuleCondition CreateRuleCondition()
209210
switch (this.RuleType)
210211
{
211212
case AlertRuleTypes.Event:
213+
WriteVerboseWithTimestamp(string.Format("CreateRuleCondition: Creating event rule condition (event-based rule)"));
212214
condition = this.CreateEventRuleCondition();
213215
break;
214216
case AlertRuleTypes.Metric:
217+
WriteVerboseWithTimestamp(string.Format("CreateRuleCondition: Creating threshold rule condition (metric-based rule"));
215218
condition = this.CreateThresholdRuleCondition();
216219
break;
217220
case AlertRuleTypes.Webtest:
221+
WriteVerboseWithTimestamp(string.Format("CreateRuleCondition: Creating location threshold rule condition (webtest rule)"));
218222
condition = new LocationThresholdRuleCondition()
219223
{
220224
DataSource = new RuleMetricDataSource(),
@@ -234,6 +238,8 @@ protected override RuleCreateOrUpdateParameters CreateSdkCallParameters()
234238
this.VerifyRuleTypeToParametersConsistency();
235239

236240
RuleCondition condition = this.CreateRuleCondition();
241+
242+
WriteVerboseWithTimestamp(string.Format("CreateSdkCallParameters: Creating rule object"));
237243
return new RuleCreateOrUpdateParameters()
238244
{
239245
Location = this.Location,

src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ public abstract class AddAlertRuleCommandBase : ManagementCmdletBase
116116
/// </summary>
117117
protected override void ProcessRecordInternal()
118118
{
119+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
120+
119121
RuleCreateOrUpdateParameters parameters = this.CreateSdkCallParameters();
122+
120123
var result = this.InsightsManagementClient.AlertOperations.CreateOrUpdateRuleAsync(resourceGroupName: this.ResourceGroup, parameters: parameters).Result;
121124
WriteObject(result);
122125
}

src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ protected override bool KeepTheRecord(EventData record)
7171
/// <returns>Modified query filter including the condition for eventSource</returns>
7272
protected override string ProcessParticularParameters(string currentQueryFilter)
7373
{
74+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
75+
7476
// Make sure only events for alerts come back
7577
return this.AddConditionIfPResent(currentQueryFilter, "eventSource", AlertsEventSourceName);
7678
}

src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public class GetAlertRuleCommand : ManagementCmdletBase
7171
/// </summary>
7272
protected override void ProcessRecordInternal()
7373
{
74+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
75+
7476
if (string.IsNullOrWhiteSpace(this.Name))
7577
{
7678
// Retrieve all the AlertRules for a ResourceGroup
@@ -83,6 +85,7 @@ protected override void ProcessRecordInternal()
8385
{
8486
// Retrieve a single AlertRule determined by the ResourceGroup and the rule name
8587
RuleGetResponse result = this.InsightsManagementClient.AlertOperations.GetRuleAsync(resourceGroupName: this.ResourceGroup, ruleName: this.Name).Result;
88+
8689
var finalResult = new List<PSManagementItemDescriptor> { this.DetailedOutput.IsPresent ? (PSManagementItemDescriptor)new PSAlertRule(result) : new PSAlertRuleNoDetails(result) };
8790
WriteObject(sendToPipeline: finalResult);
8891
}

src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System;
1615
using System.Collections.Generic;
1716
using System.Management.Automation;
1817
using Microsoft.Azure.Management.Insights;
@@ -50,6 +49,8 @@ public class RemoveAlertRuleCommand : ManagementCmdletBase
5049
/// </summary>
5150
protected override void ProcessRecordInternal()
5251
{
52+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
53+
5354
AzureOperationResponse result = this.InsightsManagementClient.AlertOperations.DeleteRuleAsync(resourceGroupName: this.ResourceGroup, ruleName: this.Name).Result;
5455
WriteObject(result);
5556
}

src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
using System.Linq;
1818
using System.Management.Automation;
1919
using Hyak.Common;
20-
using Microsoft.Azure.Commands.Insights.OutputClasses;
2120
using Microsoft.Azure.Commands.Insights.Properties;
2221
using Microsoft.Azure.Management.Insights;
2322
using Microsoft.Azure.Management.Insights.Models;
@@ -94,7 +93,10 @@ public class AddAutoscaleSettingCommand : ManagementCmdletBase
9493
/// </summary>
9594
protected override void ProcessRecordInternal()
9695
{
96+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
97+
9798
AutoscaleSettingCreateOrUpdateParameters parameters = this.CreateSdkCallParameters();
99+
98100
var result = this.InsightsManagementClient.AutoscaleOperations.CreateOrUpdateSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name, parameters: parameters).Result;
99101

100102
WriteObject(result);
@@ -106,6 +108,7 @@ private AutoscaleSettingCreateOrUpdateParameters CreateSdkCallParameters()
106108

107109
if (this.SettingSpec != null)
108110
{
111+
109112
// Receiving a single parameter with the whole spec for an autoscale setting
110113
var property = this.SettingSpec.Properties;
111114

src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ protected override bool KeepTheRecord(EventData record)
7171
/// <returns>Modified query filter including the condition for eventSource</returns>
7272
protected override string ProcessParticularParameters(string currentQueryFilter)
7373
{
74+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
75+
7476
return this.AddConditionIfPResent(currentQueryFilter, "category", AutoscaleEventSourceName);
7577
}
7678
}

src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System;
1615
using System.Collections.Generic;
1716
using System.Linq;
1817
using System.Management.Automation;
@@ -59,6 +58,8 @@ public class GetAutoscaleSettingCommand : ManagementCmdletBase
5958
/// </summary>
6059
protected override void ProcessRecordInternal()
6160
{
61+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
62+
6263
if (string.IsNullOrWhiteSpace(this.Name))
6364
{
6465
// Retrieve all the Autoscale settings for a resource group
@@ -71,6 +72,7 @@ protected override void ProcessRecordInternal()
7172
{
7273
// Retrieve a single Autoscale setting determined by the resource group and the rule name
7374
AutoscaleSettingGetResponse result = this.InsightsManagementClient.AutoscaleOperations.GetSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name).Result;
75+
7476
WriteObject(sendToPipeline: this.DetailedOutput.IsPresent ? new PSAutoscaleSetting(result) : result.ToAutoscaleSettingGetResponse());
7577
}
7678
}

src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ public class NewAutoscaleProfileCommand : AzureRMCmdlet
136136
/// </summary>
137137
public override void ExecuteCmdlet()
138138
{
139+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
140+
139141
AutoscaleProfile profile = this.CreateSettingProfile();
140142
WriteObject(profile);
141143
}

src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using System;
16-
using System.Collections.Generic;
17-
using System.Globalization;
1816
using System.Management.Automation;
1917
using Microsoft.Azure.Commands.Insights.Properties;
2018
using Microsoft.Azure.Commands.ResourceManager.Common;
2119
using Microsoft.Azure.Management.Insights.Models;
22-
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2320

2421
namespace Microsoft.Azure.Commands.Insights.Autoscale
2522
{
@@ -116,6 +113,8 @@ public class NewAutoscaleRuleCommand : AzureRMCmdlet
116113
/// </summary>
117114
public override void ExecuteCmdlet()
118115
{
116+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
117+
119118
ScaleRule rule = this.CreateSettingRule();
120119
WriteObject(rule);
121120
}

src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs

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

15-
using System;
16-
using System.Collections.Generic;
1715
using System.Management.Automation;
1816
using Microsoft.Azure.Management.Insights;
1917

@@ -50,6 +48,8 @@ public class RemoveAutoscaleSettingCommand : ManagementCmdletBase
5048
/// </summary>
5149
protected override void ProcessRecordInternal()
5250
{
51+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
52+
5353
AzureOperationResponse result = this.InsightsManagementClient.AutoscaleOperations.DeleteSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name).Result;
5454
WriteObject(result);
5555
}

src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.18.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8080
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
8181
<Private>True</Private>
82-
</Reference>
82+
</Reference>
8383
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8484
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
8585
<Private>True</Private>

src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs

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

15-
using System;
16-
using System.Collections.Generic;
1715
using System.Management.Automation;
1816
using System.Threading;
1917
using Microsoft.Azure.Commands.Insights.OutputClasses;

src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using System;
16-
using System.Collections;
1716
using System.Collections.Generic;
1817
using System.Globalization;
1918
using System.Linq;

src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
using System;
1616
using Microsoft.Azure.Commands.ResourceManager.Common;
17-
using Microsoft.WindowsAzure.Commands.Utilities.Common;
1817

1918
namespace Microsoft.Azure.Commands.Insights
2019
{

src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.Insights
2222
/// <summary>
2323
/// Base class for the Azure Insights SDK Cmdlets based on the InsightsManagementClient
2424
/// </summary>
25-
public abstract class ManagementCmdletBase : InsightsCmdletBase, IDisposable
25+
public abstract class ManagementCmdletBase : InsightsCmdletBase
2626
{
2727
#region General declarations
2828

@@ -35,11 +35,11 @@ public abstract class ManagementCmdletBase : InsightsCmdletBase, IDisposable
3535
/// </summary>
3636
public IInsightsManagementClient InsightsManagementClient
3737
{
38-
get
39-
{
38+
// The premise is that a command to establish a context (like Add-AzureRmAccount) has
39+
// been called before this command in order to have a correct CurrentContext
40+
get {
4041
if (this.insightsManagementClient == null)
4142
{
42-
// The premise is that a command to establish a context (like Add-AzureRmAccount) has been called before this command in order to have a correct CurrentContext
4343
this.insightsManagementClient = AzureSession.ClientFactory.CreateClient<InsightsManagementClient>(DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager);
4444
}
4545

src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using Microsoft.Azure.Commands.Insights.OutputClasses;
1919
using Microsoft.Azure.Commands.ResourceManager.Common;
2020
using Microsoft.Azure.Insights.Models;
21-
using Microsoft.WindowsAzure.Commands.Utilities.Common;
2221

2322
namespace Microsoft.Azure.Commands.Insights.Metrics
2423
{
@@ -77,6 +76,8 @@ public PSMetricTabularResult[] ProcessParameter()
7776
/// </summary>
7877
public override void ExecuteCmdlet()
7978
{
79+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
80+
8081
WriteObject(this.ProcessParameter());
8182
}
8283
}

src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System;
1615
using System.Linq;
1716
using System.Management.Automation;
1817
using System.Text;
@@ -71,12 +70,15 @@ protected string ProcessParameters()
7170
/// </summary>
7271
protected override void ProcessRecordInternal()
7372
{
73+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
74+
7475
string queryFilter = this.ProcessParameters();
7576
bool fullDetails = this.DetailedOutput.IsPresent;
7677

7778
// Call the proper API methods to return a list of raw records.
7879
// If fullDetails is present full details of the records are displayed, otherwise only a summary of the records is displayed
7980
MetricDefinitionListResponse response = this.InsightsClient.MetricDefinitionOperations.GetMetricDefinitionsAsync(resourceUri: this.ResourceId, filterString: queryFilter, cancellationToken: CancellationToken.None).Result;
81+
8082
var records = response.MetricDefinitionCollection.Value.Select(e => fullDetails ? (MetricDefinition)new PSMetricDefinition(e) : new PSMetricDefinitionNoDetails(e)).ToArray();
8183

8284
WriteObject(sendToPipeline: records);

src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,15 @@ protected string ProcessParameters()
127127
/// </summary>
128128
protected override void ProcessRecordInternal()
129129
{
130+
WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.");
131+
130132
string queryFilter = this.ProcessParameters();
131133
bool fullDetails = this.DetailedOutput.IsPresent;
132134

133135
// Call the proper API methods to return a list of raw records.
134136
// If fullDetails is present full details of the records displayed, otherwise only a summary of the values is displayed
135137
MetricListResponse response = this.InsightsClient.MetricOperations.GetMetricsAsync(resourceUri: this.ResourceId, filterString: queryFilter, cancellationToken: CancellationToken.None).Result;
138+
136139
var records = response.MetricCollection.Value.Select(e => fullDetails ? (Metric)new PSMetric(e) : new PSMetricNoDetails(e)).ToArray();
137140

138141
WriteObject(sendToPipeline: records);

0 commit comments

Comments
 (0)