From 5e867819bf3e6f50d1276047c1bedef05f9dc9fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Calder=C3=B3n=5FMeza?= Date: Tue, 23 Feb 2016 23:02:29 -0800 Subject: [PATCH 1/5] FW: Clean the cmdlets code, add a deprecation warning to some of the cmdlets, add some verbose messages --- setup/azurecmdfiles.wxi | 36 ++--------- .../AddAutoscaleSettingCommandTests.cs | 1 - .../GetAutoscaleHistoryCommandTests.cs | 2 +- .../Commands.Insights.Test.csproj | 60 ------------------- .../GetDiagnosticSettingCommandTests.cs | 2 - .../SetDiagnosticSettingCommandTests.cs | 6 -- .../GetMetricDefinitionsCommandTests.cs | 1 - .../Commands.Insights.Test/Utilities.cs | 2 +- .../Commands.Insights.Test/packages.config | 1 - .../Alerts/AddAlertRuleCommand.cs | 6 ++ .../Alerts/AddAlertRuleCommandBase.cs | 4 ++ .../Alerts/GetAlertHistoryCommand.cs | 2 + .../Alerts/GetAlertRuleCommand.cs | 7 +++ .../Alerts/RemoveAlertRuleCommand.cs | 4 +- .../Autoscale/AddAutoscaleSettingCommand.cs | 8 ++- .../Autoscale/GetAutoscaleHistoryCommand.cs | 2 + .../Autoscale/GetAutoscaleSettingCommand.cs | 8 ++- .../Autoscale/NewAutoscaleProfileCommand.cs | 5 ++ .../Autoscale/NewAutoscaleRuleCommand.cs | 9 ++- .../RemoveAutoscaleSettingCommand.cs | 5 +- .../Commands.Insights.csproj | 46 -------------- .../GetAzureRmDiagnosticSettingCommand.cs | 2 - .../SetAzureRmDiagnosticSettingCommand.cs | 1 - .../Commands.Insights/EventCmdletBase.cs | 5 ++ .../InsightsClientCmdletBase.cs | 1 + .../Commands.Insights/InsightsCmdletBase.cs | 1 - .../Commands.Insights/ManagementCmdletBase.cs | 8 +-- .../Metrics/FormatMetricsAsTableCommand.cs | 4 +- .../Metrics/GetMetricDefinitionsCommand.cs | 7 ++- .../Metrics/GetMetricsCommand.cs | 6 ++ .../OutputClasses/CustomPrinter.cs | 16 ++++- .../OutputClasses/PSLogSettings.cs | 2 - .../OutputClasses/PSMetricSettings.cs | 1 - .../OutputClasses/PSMetricValue.cs | 1 - .../OutputClasses/PSToStringExtensions.cs | 4 -- .../UsageMetrics/GetUsageMetricsCommand.cs | 6 ++ src/ResourceManager/Insights/Insights.sln | 8 +-- 37 files changed, 105 insertions(+), 185 deletions(-) diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 395b69c37137..e3c72a864976 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -1288,27 +1288,9 @@ - - - - - - - - - - - - - - - - - - @@ -1321,15 +1303,9 @@ - - - - - - @@ -2539,6 +2515,9 @@ + + + @@ -5428,20 +5407,12 @@ - - - - - - - - @@ -5837,6 +5808,7 @@ + diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/AddAutoscaleSettingCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/AddAutoscaleSettingCommandTests.cs index 0a0e5cb30331..a65125dda754 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/AddAutoscaleSettingCommandTests.cs +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/AddAutoscaleSettingCommandTests.cs @@ -20,7 +20,6 @@ using System.Threading.Tasks; using Hyak.Common; using Microsoft.Azure.Commands.Insights.Autoscale; -using Microsoft.Azure.Commands.Insights.OutputClasses; using Microsoft.Azure.Management.Insights; using Microsoft.Azure.Management.Insights.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/GetAutoscaleHistoryCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/GetAutoscaleHistoryCommandTests.cs index 45a413825b79..0feaff3f227d 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/GetAutoscaleHistoryCommandTests.cs +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Autoscale/GetAutoscaleHistoryCommandTests.cs @@ -68,7 +68,7 @@ public void GetAutoscaleHistoryCommandParametersProcessing() Test.Utilities.ExecuteVerifications( cmdlet: cmdlet, insinsightsEventOperationsMockightsClientMock: this.insightsEventOperationsMock, - requiredFieldName: "eventSource", + requiredFieldName: "category", requiredFieldValue: GetAutoscaleHistoryCommand.AutoscaleEventSourceName, filter: ref this.filter, selected: ref this.selected, diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj index ae5b71fe135a..9d9e5fd92dce 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj @@ -51,37 +51,13 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll - ..\..\..\packages\Microsoft.Azure.Insights.0.10.0-preview\lib\net45\Microsoft.Azure.Insights.dll - - False - ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - False ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll - - False - ..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5886.28964-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll - - - - False - ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll - - - False - ..\..\..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll - - - False - ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll - ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True @@ -90,53 +66,17 @@ ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True - - False - ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll - - - False - ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll - - - False - ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll - - - ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll - - - False - ..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll - - - ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll - True - False ..\..\..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll - - False - ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - - False C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll - - - - ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll - - - ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True - ..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll True diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/GetDiagnosticSettingCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/GetDiagnosticSettingCommandTests.cs index 4ea869d9b200..241be3cbe6ef 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/GetDiagnosticSettingCommandTests.cs +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/GetDiagnosticSettingCommandTests.cs @@ -18,7 +18,6 @@ using System.Net; using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Commands.Insights.Alerts; using Microsoft.Azure.Commands.Insights.Diagnostics; using Microsoft.Azure.Management.Insights; using Microsoft.Azure.Management.Insights.Models; @@ -35,7 +34,6 @@ public class GetDiagnosticSettingCommandTests private readonly Mock insightsDiagnosticsOperationsMock; private Mock commandRuntimeMock; private ServiceDiagnosticSettingsGetResponse response; - private RuleCreateOrUpdateParameters createOrUpdatePrms; private const string resourceId = "/subscriptions/123/resourcegroups/rg/providers/rp/resource/myresource"; private string calledResourceId; diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/SetDiagnosticSettingCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/SetDiagnosticSettingCommandTests.cs index 57de79075cba..58037df0bac9 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/SetDiagnosticSettingCommandTests.cs +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Diagnostics/SetDiagnosticSettingCommandTests.cs @@ -14,18 +14,13 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Management.Automation; using System.Net; -using System.Threading; using System.Threading.Tasks; -using Microsoft.Azure.Commands.Insights.Alerts; using Microsoft.Azure.Commands.Insights.Diagnostics; using Microsoft.Azure.Management.Insights; using Microsoft.Azure.Management.Insights.Models; -using Microsoft.WindowsAzure.Commands.ScenarioTest; using Moq; -using Xunit; namespace Microsoft.Azure.Commands.Insights.Test.Diagnostics { @@ -36,7 +31,6 @@ public class SetDiagnosticSettingCommandTests private readonly Mock insightsDiagnosticsOperationsMock; private Mock commandRuntimeMock; private ServiceDiagnosticSettingsGetResponse response; - private RuleCreateOrUpdateParameters createOrUpdatePrms; private const string resourceId = "/subscriptions/123/resourcegroups/rg/providers/rp/resource/myresource"; private const string storageAccountId = "/subscriptions/123/resourcegroups/rg/providers/microsoft.storage/accounts/myaccount"; private string calledResourceId; diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Metrics/GetMetricDefinitionsCommandTests.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Metrics/GetMetricDefinitionsCommandTests.cs index de0b7abd2eb5..198bd0a8cd29 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Metrics/GetMetricDefinitionsCommandTests.cs +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Metrics/GetMetricDefinitionsCommandTests.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; using System.Management.Automation; using System.Threading; using System.Threading.Tasks; diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Utilities.cs b/src/ResourceManager/Insights/Commands.Insights.Test/Utilities.cs index a2eae5dd9487..5456b2e8564d 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Utilities.cs +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Utilities.cs @@ -218,7 +218,7 @@ public static void VerifyConditionInFilter(string filter, string field, string v if (!string.IsNullOrWhiteSpace(field)) { var condition = string.Format("and {0} eq '{1}'", field, value); - Assert.True(filter.Contains(condition), "Filter does not contain required condition"); + Assert.True(filter.Contains(condition), string.Format("Filter: {0} does not contain required condition: {1}", filter, condition)); } } diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config index dbcbce5274bc..d563e07f4111 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config +++ b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config @@ -24,7 +24,6 @@ - diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommand.cs index 884e81b8849f..49f2f9e7dd4a 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommand.cs @@ -166,6 +166,7 @@ private ManagementEventRuleCondition CreateEventRuleCondition() private void VerifyRuleTypeToParametersConsistency() { + WriteVerboseWithTimestamp(string.Format("VerifyRuleTypeToParametersConsistency: input type:{0}", this.RuleType)); AlertRuleTypes type = AlertRuleTypes.Event; // 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() switch (this.RuleType) { case AlertRuleTypes.Event: + WriteVerboseWithTimestamp(string.Format("CreateRuleCondition: Creating event rule condition (event-based rule)")); condition = this.CreateEventRuleCondition(); break; case AlertRuleTypes.Metric: + WriteVerboseWithTimestamp(string.Format("CreateRuleCondition: Creating threshold rule condition (metric-based rule")); condition = this.CreateThresholdRuleCondition(); break; case AlertRuleTypes.Webtest: + WriteVerboseWithTimestamp(string.Format("CreateRuleCondition: Creating location threshold rule condition (webtest rule)")); condition = new LocationThresholdRuleCondition() { DataSource = new RuleMetricDataSource(), @@ -234,6 +238,8 @@ protected override RuleCreateOrUpdateParameters CreateSdkCallParameters() this.VerifyRuleTypeToParametersConsistency(); RuleCondition condition = this.CreateRuleCondition(); + + WriteVerboseWithTimestamp(string.Format("CreateSdkCallParameters: Creating rule object")); return new RuleCreateOrUpdateParameters() { Location = this.Location, diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs index fbecf719f2b1..c15f2f18ed4c 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs @@ -116,7 +116,11 @@ public abstract class AddAlertRuleCommandBase : ManagementCmdletBase /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + RuleCreateOrUpdateParameters parameters = this.CreateSdkCallParameters(); + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AlertOperations.CreateOrUpdateRuleAsync function with resource group:{0}, and parameters:{1}", this.ResourceGroup, parameters)); var result = this.InsightsManagementClient.AlertOperations.CreateOrUpdateRuleAsync(resourceGroupName: this.ResourceGroup, parameters: parameters).Result; WriteObject(result); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs index 2f4f14d9cd95..e1ce67506d3f 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs @@ -71,6 +71,8 @@ protected override bool KeepTheRecord(EventData record) /// Modified query filter including the condition for eventSource protected override string ProcessParticularParameters(string currentQueryFilter) { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + // Make sure only events for alerts come back return this.AddConditionIfPResent(currentQueryFilter, "eventSource", AlertsEventSourceName); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs index abce4914e73d..414b34880481 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs @@ -71,18 +71,25 @@ public class GetAlertRuleCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + if (string.IsNullOrWhiteSpace(this.Name)) { // Retrieve all the AlertRules for a ResourceGroup + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AlertOperations.ListRulesAsync function with resource group:{0}, target resource Uri:{1}", this.ResourceGroup, this.TargetResourceId)); RuleListResponse result = this.InsightsManagementClient.AlertOperations.ListRulesAsync(resourceGroupName: this.ResourceGroup, targetResourceUri: this.TargetResourceId).Result; + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Converting to the proper type and level of detail before returning")); var records = result.RuleResourceCollection.Value.Select(e => this.DetailedOutput.IsPresent ? (PSManagementItemDescriptor)new PSAlertRule(e) : new PSAlertRuleNoDetails(e)); WriteObject(sendToPipeline: records.ToList()); } else { // Retrieve a single AlertRule determined by the ResourceGroup and the rule name + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AlertOperations.GetRuleAsync function with resource group:{0}, rule name:{1}", this.ResourceGroup, this.Name)); RuleGetResponse result = this.InsightsManagementClient.AlertOperations.GetRuleAsync(resourceGroupName: this.ResourceGroup, ruleName: this.Name).Result; + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Converting to the proper type and level of detail before returning")); var finalResult = new List { this.DetailedOutput.IsPresent ? (PSManagementItemDescriptor)new PSAlertRule(result) : new PSAlertRuleNoDetails(result) }; WriteObject(sendToPipeline: finalResult); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs index 4840c9925e85..dca77ae87104 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; using System.Collections.Generic; using System.Management.Automation; using Microsoft.Azure.Management.Insights; @@ -50,6 +49,9 @@ public class RemoveAlertRuleCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AlertOperations.DeleteRuleAsync function with resource group:{0}, rule name:{1}", this.ResourceGroup, this.Name)); AzureOperationResponse result = this.InsightsManagementClient.AlertOperations.DeleteRuleAsync(resourceGroupName: this.ResourceGroup, ruleName: this.Name).Result; WriteObject(result); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs index 6d1fdaf7cbcb..b9e2f5d5c8a4 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs @@ -17,7 +17,6 @@ using System.Linq; using System.Management.Automation; using Hyak.Common; -using Microsoft.Azure.Commands.Insights.OutputClasses; using Microsoft.Azure.Commands.Insights.Properties; using Microsoft.Azure.Management.Insights; using Microsoft.Azure.Management.Insights.Models; @@ -94,7 +93,11 @@ public class AddAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + AutoscaleSettingCreateOrUpdateParameters parameters = this.CreateSdkCallParameters(); + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AutoscaleOperations.CreateOrUpdateSettingAsync function with resource group:{0}, setting name:{1}, and parameters:{2}", this.ResourceGroup, this.Name, parameters)); var result = this.InsightsManagementClient.AutoscaleOperations.CreateOrUpdateSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name, parameters: parameters).Result; WriteObject(result); @@ -106,6 +109,8 @@ private AutoscaleSettingCreateOrUpdateParameters CreateSdkCallParameters() if (this.SettingSpec != null) { + WriteVerboseWithTimestamp(string.Format("CreateSdkCallParameters: taking the parameters data from the single input SettingSpec parameter")); + // Receiving a single parameter with the whole spec for an autoscale setting var property = this.SettingSpec.Properties; @@ -124,6 +129,7 @@ private AutoscaleSettingCreateOrUpdateParameters CreateSdkCallParameters() enableSetting = !this.DisableSetting.IsPresent && property.Enabled; } + WriteVerboseWithTimestamp(string.Format("CreateSdkCallParameters: creating the parameters")); return new AutoscaleSettingCreateOrUpdateParameters() { Location = this.Location, diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs index ee76d616367f..a3774c9fcd6d 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs @@ -71,6 +71,8 @@ protected override bool KeepTheRecord(EventData record) /// Modified query filter including the condition for eventSource protected override string ProcessParticularParameters(string currentQueryFilter) { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + return this.AddConditionIfPResent(currentQueryFilter, "category", AutoscaleEventSourceName); } } diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs index ba2ed6557f8b..313287594035 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; @@ -59,18 +58,25 @@ public class GetAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + if (string.IsNullOrWhiteSpace(this.Name)) { // Retrieve all the Autoscale settings for a resource group + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AutoscaleOperations.ListSettingsAsync function with resource group:{0} and null target resource uri", this.ResourceGroup)); AutoscaleSettingListResponse result = this.InsightsManagementClient.AutoscaleOperations.ListSettingsAsync(resourceGroupName: this.ResourceGroup, targetResourceUri: null).Result; + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: converting to the proper type and level of detail before returning")); var records = result.AutoscaleSettingResourceCollection.Value.Select(e => this.DetailedOutput.IsPresent ? new PSAutoscaleSetting(e) : e); WriteObject(sendToPipeline: records, enumerateCollection: true); } else { // Retrieve a single Autoscale setting determined by the resource group and the rule name + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AutoscaleOperations.ListSettingsAsync function with resource group:{0} and setting name:{1}", this.ResourceGroup, this.Name)); AutoscaleSettingGetResponse result = this.InsightsManagementClient.AutoscaleOperations.GetSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name).Result; + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: converting to the proper type and level of detail before returning")); WriteObject(sendToPipeline: this.DetailedOutput.IsPresent ? new PSAutoscaleSetting(result) : result.ToAutoscaleSettingGetResponse()); } } diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs index 48d3ccb45bb2..7e88a5aa1571 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs @@ -136,6 +136,8 @@ public class NewAutoscaleProfileCommand : AzureRMCmdlet /// public override void ExecuteCmdlet() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + AutoscaleProfile profile = this.CreateSettingProfile(); WriteObject(profile); } @@ -146,6 +148,7 @@ public override void ExecuteCmdlet() /// An autoscale profile based on the properties of the object public AutoscaleProfile CreateSettingProfile() { + WriteVerboseWithTimestamp("CreateSettingProfile"); return new AutoscaleProfile { Name = this.Name ?? string.Empty, @@ -178,6 +181,7 @@ public AutoscaleProfile CreateSettingProfile() /// A Recurrence created based on the properties of this object public Recurrence CreateAutoscaleRecurrence() { + WriteVerboseWithTimestamp("CreateAutoscaleRecurrence"); return new Recurrence() { Frequency = this.RecurrenceFrequency, @@ -188,6 +192,7 @@ public Recurrence CreateAutoscaleRecurrence() private RecurrentSchedule CreateRecurrentSchedule() { // Assuming validation is done by the server + WriteVerboseWithTimestamp("CreateRecurrentSchedule"); return new RecurrentSchedule() { Days = this.ScheduleDays, diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs index aaf778def49f..560f76964523 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs @@ -13,13 +13,10 @@ // ---------------------------------------------------------------------------------- using System; -using System.Collections.Generic; -using System.Globalization; using System.Management.Automation; using Microsoft.Azure.Commands.Insights.Properties; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Management.Insights.Models; -using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.Insights.Autoscale { @@ -116,6 +113,8 @@ public class NewAutoscaleRuleCommand : AzureRMCmdlet /// public override void ExecuteCmdlet() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + ScaleRule rule = this.CreateSettingRule(); WriteObject(rule); } @@ -126,6 +125,7 @@ public override void ExecuteCmdlet() /// A ScaleRule created based on the properties of the object public ScaleRule CreateSettingRule() { + WriteVerboseWithTimestamp(string.Format("CreateSettingRule: Checking parameters")); if (this.TimeWindow != default(TimeSpan) && this.TimeWindow < MinimumTimeWindow) { throw new ArgumentOutOfRangeException("TimeWindow", this.TimeWindow, ResourcesForAutoscaleCmdlets.MinimumTimeWindow5min); @@ -136,6 +136,7 @@ public ScaleRule CreateSettingRule() throw new ArgumentOutOfRangeException("TimeGrain", this.TimeGrain, ResourcesForAutoscaleCmdlets.MinimumTimeGrain1min); } + WriteVerboseWithTimestamp(string.Format("CreateSettingRule: Creating trigger")); MetricTrigger trigger = new MetricTrigger() { MetricName = this.MetricName, @@ -148,6 +149,7 @@ public ScaleRule CreateSettingRule() TimeWindow = this.TimeWindow == default(TimeSpan) ? MinimumTimeWindow : this.TimeWindow, }; + WriteVerboseWithTimestamp(string.Format("CreateSettingRule: Creating scale action")); ScaleAction action = new ScaleAction() { Cooldown = this.ScaleActionCooldown, @@ -156,6 +158,7 @@ public ScaleRule CreateSettingRule() Value = this.ScaleActionValue, }; + WriteVerboseWithTimestamp(string.Format("CreateSettingRule: Creating scale rule")); return new ScaleRule() { MetricTrigger = trigger, diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs index 4569787b4579..7a53f5d81558 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs @@ -12,8 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; using System.Management.Automation; using Microsoft.Azure.Management.Insights; @@ -50,6 +48,9 @@ public class RemoveAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AutoscaleOperations.DeleteSettingAsync function with resource group:{0}, and setting name:{1}", this.ResourceGroup, this.Name)); AzureOperationResponse result = this.InsightsManagementClient.AutoscaleOperations.DeleteSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name).Result; WriteObject(result); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj index 175035bd8350..9004fb130667 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj +++ b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj @@ -49,37 +49,9 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll - - ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll - ..\..\..\packages\Microsoft.Azure.Insights.0.10.0-preview\lib\net45\Microsoft.Azure.Insights.dll - - False - ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - - - - False - ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll - - - False - ..\..\..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll - - - False - ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll - - - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll - True - - - ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll - True - ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True @@ -88,29 +60,11 @@ ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True - - False - ..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll - - - ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll - True - - - False - ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - - - - - False - ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll - diff --git a/src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs index 5eb4471de2cc..c20951370bdc 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs @@ -12,8 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections.Generic; using System.Management.Automation; using System.Threading; using Microsoft.Azure.Commands.Insights.OutputClasses; diff --git a/src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs index a96292157d86..4743dceddc4e 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs @@ -13,7 +13,6 @@ // ---------------------------------------------------------------------------------- using System; -using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; diff --git a/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs index a606beab1ceb..53e35177704a 100644 --- a/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs @@ -199,6 +199,7 @@ protected virtual bool KeepTheRecord(EventData record) /// protected override void ProcessRecordInternal() { + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Processing Parameters")); string queryFilter = this.ProcessParameters(); // Retrieve the records @@ -209,6 +210,7 @@ protected override void ProcessRecordInternal() // Call the proper API methods to return a list of raw records. In the future this pattern can be extended to include DigestRecords // If fullDetails is present do not select fields, if not present fetch only the SelectedFieldsForQuery + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK ListEventsAsync function with filter:{0}, with list of selected fields:{1}", queryFilter, fullDetails ? null : PSEventDataNoDetails.SelectedFieldsForQuery.Replace(",", ", ").Trim())); EventDataListResponse response = this.InsightsClient.EventOperations.ListEventsAsync(filterString: queryFilter, selectedProperties: fullDetails ? null : PSEventDataNoDetails.SelectedFieldsForQuery, cancellationToken: CancellationToken.None).Result; var records = new List(response.EventDataCollection.Value.Where(this.KeepTheRecord).Select(e => fullDetails ? (IPSEventData)new PSEventData(e) : (IPSEventData)new PSEventDataNoDetails(e))); string nextLink = response.EventDataCollection.NextLink; @@ -216,6 +218,7 @@ protected override void ProcessRecordInternal() // Adding a safety check to stop returning records if too many have been read already. while (!string.IsNullOrWhiteSpace(nextLink) && records.Count < maxNumberOfRecords) { + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Following continuation token, next link: {0}", nextLink)); response = this.InsightsClient.EventOperations.ListEventsNextAsync(nextLink: nextLink, cancellationToken: CancellationToken.None).Result; records.AddRange(response.EventDataCollection.Value.Select(e => fullDetails ? (IPSEventData)new PSEventData(e) : (IPSEventData)new PSEventDataNoDetails(e))); nextLink = response.EventDataCollection.NextLink; @@ -224,10 +227,12 @@ protected override void ProcessRecordInternal() var recordsReturned = new List(); if (records.Count > maxNumberOfRecords) { + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Reducing the response to a maximum of {0} records", maxNumberOfRecords)); recordsReturned.AddRange(records.Take(maxNumberOfRecords)); } else { + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Returning {0} records", records.Count)); recordsReturned = records; } diff --git a/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs index 89e68ec505f0..2b9f339790b7 100644 --- a/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs @@ -39,6 +39,7 @@ public IInsightsClient InsightsClient { if (this.insightsClient == null) { + WriteVerboseWithTimestamp(string.Format("Creating a new InsightsClient with subscription: {0} ({1}) and endpoint: {2}", DefaultProfile.Context.Subscription.Id, DefaultProfile.Context.Subscription.Name, AzureEnvironment.Endpoint.ResourceManager)); // 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 this.insightsClient = AzureSession.ClientFactory.CreateClient(DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager); } diff --git a/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs index 666fb9857517..12d7d3cd0bfb 100644 --- a/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/InsightsCmdletBase.cs @@ -14,7 +14,6 @@ using System; using Microsoft.Azure.Commands.ResourceManager.Common; -using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.Insights { diff --git a/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs index b41097f6058b..e9a9157b1ca9 100644 --- a/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.Insights /// /// Base class for the Azure Insights SDK Cmdlets based on the InsightsManagementClient /// - public abstract class ManagementCmdletBase : InsightsCmdletBase, IDisposable + public abstract class ManagementCmdletBase : InsightsCmdletBase { #region General declarations @@ -35,11 +35,11 @@ public abstract class ManagementCmdletBase : InsightsCmdletBase, IDisposable /// public IInsightsManagementClient InsightsManagementClient { - get - { + // 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 + get { if (this.insightsManagementClient == null) { - // 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 + WriteVerboseWithTimestamp(string.Format("Creating a new InsightsManagementClient with context: {0} ({1}) and endpoint: {2}", DefaultProfile.Context.Subscription.Id, DefaultProfile.Context.Subscription.Name, AzureEnvironment.Endpoint.ResourceManager)); this.insightsManagementClient = AzureSession.ClientFactory.CreateClient(DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs index ee62393a077b..69abef2b9efb 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs @@ -18,7 +18,6 @@ using Microsoft.Azure.Commands.Insights.OutputClasses; using Microsoft.Azure.Commands.ResourceManager.Common; using Microsoft.Azure.Insights.Models; -using Microsoft.WindowsAzure.Commands.Utilities.Common; namespace Microsoft.Azure.Commands.Insights.Metrics { @@ -40,6 +39,7 @@ public class FormatMetricsAsTableCommand : AzureRMCmdlet /// A tabular format of the input parameters public PSMetricTabularResult[] ProcessParameter() { + WriteVerboseWithTimestamp(string.Format("ProcessParameter: converting array of metric, with {0} records, into the proper type before returning", this.Metrics != null ? this.Metrics.Length : 0)); var metricsTable = new List(); foreach (var metric in this.Metrics ?? Enumerable.Empty()) { @@ -77,6 +77,8 @@ public PSMetricTabularResult[] ProcessParameter() /// public override void ExecuteCmdlet() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteObject(this.ProcessParameter()); } } diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs index e93d5eeb94f0..ffd370471fb1 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; using System.Linq; using System.Management.Automation; using System.Text; @@ -71,12 +70,18 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Processing Parameters")); string queryFilter = this.ProcessParameters(); bool fullDetails = this.DetailedOutput.IsPresent; // Call the proper API methods to return a list of raw records. // If fullDetails is present full details of the records are displayed, otherwise only a summary of the records is displayed + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK MetricDefinitionOperations.GetMetricDefinitionsAsync function with resourceId: {0},and filter:{1}", this.ResourceId, queryFilter)); MetricDefinitionListResponse response = this.InsightsClient.MetricDefinitionOperations.GetMetricDefinitionsAsync(resourceUri: this.ResourceId, filterString: queryFilter, cancellationToken: CancellationToken.None).Result; + + WriteVerboseWithTimestamp("ProcessRecordInternal: converting records to the proper type before returning"); var records = response.MetricDefinitionCollection.Value.Select(e => fullDetails ? (MetricDefinition)new PSMetricDefinition(e) : new PSMetricDefinitionNoDetails(e)).ToArray(); WriteObject(sendToPipeline: records); diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs index ffe2df550350..46048052727d 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs @@ -127,12 +127,18 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Processing Parameters")); string queryFilter = this.ProcessParameters(); bool fullDetails = this.DetailedOutput.IsPresent; // Call the proper API methods to return a list of raw records. // If fullDetails is present full details of the records displayed, otherwise only a summary of the values is displayed + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK MetricOperations.GetMetricsAsync function with resourceId: {0},and filter:{1}", this.ResourceId, queryFilter)); MetricListResponse response = this.InsightsClient.MetricOperations.GetMetricsAsync(resourceUri: this.ResourceId, filterString: queryFilter, cancellationToken: CancellationToken.None).Result; + + WriteVerboseWithTimestamp("ProcessRecordInternal: converting records to the proper type before returning"); var records = response.MetricCollection.Value.Select(e => fullDetails ? (Metric)new PSMetric(e) : new PSMetricNoDetails(e)).ToArray(); WriteObject(sendToPipeline: records); diff --git a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/CustomPrinter.cs b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/CustomPrinter.cs index 8c4aad18367e..5a72a024eff4 100644 --- a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/CustomPrinter.cs +++ b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/CustomPrinter.cs @@ -1,4 +1,18 @@ -using System; +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; using System.Collections; using System.Linq; using System.Reflection; diff --git a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSLogSettings.cs b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSLogSettings.cs index d5743144a120..fae5bd4af951 100644 --- a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSLogSettings.cs +++ b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSLogSettings.cs @@ -12,8 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System.Collections.Generic; -using System.Xml; using Microsoft.Azure.Management.Insights.Models; namespace Microsoft.Azure.Commands.Insights.OutputClasses diff --git a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSMetricSettings.cs b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSMetricSettings.cs index c40d15ace0be..8364a38e8a5b 100644 --- a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSMetricSettings.cs +++ b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSMetricSettings.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System.Collections.Generic; using System.Xml; using Microsoft.Azure.Management.Insights.Models; diff --git a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSMetricValue.cs b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSMetricValue.cs index 9e6116f10efa..3077f1939b74 100644 --- a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSMetricValue.cs +++ b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSMetricValue.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System.Text; using Microsoft.Azure.Insights.Models; namespace Microsoft.Azure.Commands.Insights.OutputClasses diff --git a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSToStringExtensions.cs b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSToStringExtensions.cs index 729a5c666966..cc9e6bd263fc 100644 --- a/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSToStringExtensions.cs +++ b/src/ResourceManager/Insights/Commands.Insights/OutputClasses/PSToStringExtensions.cs @@ -12,12 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; -using System.Collections; using System.Collections.Generic; -using System.Reflection; using System.Text; -using System.Xml; using Hyak.Common; using Microsoft.Azure.Insights.Models; using Microsoft.Azure.Management.Insights.Models; diff --git a/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs index 5deb854d53d7..f22268eaef77 100644 --- a/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs @@ -121,14 +121,20 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { + WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Processing Parameters")); string queryFilter = this.ProcessParameters(); string apiVersion = this.ApiVersion ?? DefaultApiVersion; // Call the proper API methods to return a list of raw records. // If fullDetails is present full details of the records displayed, otherwise only a summary of the values is displayed + WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK UsageMetricOperations.ListAsync function with resourceId: {0}, filter:{1}, and API version:{2}", this.ResourceId, queryFilter, apiVersion)); UsageMetricListResponse response = this.InsightsClient.UsageMetricOperations .ListAsync(resourceUri: this.ResourceId, filterString: queryFilter, apiVersion: apiVersion, cancellationToken: CancellationToken.None) .Result; + + WriteVerboseWithTimestamp("ProcessRecordInternal: converting records to the proper type before returning"); var records = response.UsageMetricCollection.Value .Select(e => new PSUsageMetric(e)) .ToArray(); diff --git a/src/ResourceManager/Insights/Insights.sln b/src/ResourceManager/Insights/Insights.sln index 806b57527702..0d873aaa42ab 100644 --- a/src/ResourceManager/Insights/Insights.sln +++ b/src/ResourceManager/Insights/Insights.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +VisualStudioVersion = 12.0.30723.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{95C16AED-FD57-42A0-86C3-2CF4300A4817}" EndProject @@ -12,8 +12,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights.Test", "C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.ResourceManager.Common", "..\Common\Commands.ScenarioTests.ResourceManager.Common\Commands.ScenarioTests.ResourceManager.Common.csproj", "{3436A126-EDC9-4060-8952-9A1BE34CDD95}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" @@ -40,10 +38,6 @@ Global {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Debug|Any CPU.Build.0 = Debug|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.ActiveCfg = Release|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.Build.0 = Release|Any CPU - {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU From aba8d9bd3dc78729db5e32d8fb08e5dfb9819806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Calder=C3=B3n=5FMeza?= Date: Wed, 24 Feb 2016 16:24:38 -0800 Subject: [PATCH 2/5] FW: Changing the deprecation message and removing the verbose messages --- .../Commands.Insights/Alerts/AddAlertRuleCommandBase.cs | 3 +-- .../Commands.Insights/Alerts/GetAlertHistoryCommand.cs | 2 +- .../Commands.Insights/Alerts/GetAlertRuleCommand.cs | 6 +----- .../Commands.Insights/Alerts/RemoveAlertRuleCommand.cs | 3 +-- .../Autoscale/AddAutoscaleSettingCommand.cs | 5 +---- .../Autoscale/GetAutoscaleHistoryCommand.cs | 2 +- .../Autoscale/GetAutoscaleSettingCommand.cs | 6 +----- .../Autoscale/NewAutoscaleProfileCommand.cs | 5 +---- .../Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs | 6 +----- .../Autoscale/RemoveAutoscaleSettingCommand.cs | 3 +-- .../Insights/Commands.Insights/EventCmdletBase.cs | 5 ----- .../Insights/Commands.Insights/InsightsClientCmdletBase.cs | 1 - .../Insights/Commands.Insights/ManagementCmdletBase.cs | 1 - .../Metrics/FormatMetricsAsTableCommand.cs | 3 +-- .../Metrics/GetMetricDefinitionsCommand.cs | 5 +---- .../Insights/Commands.Insights/Metrics/GetMetricsCommand.cs | 5 +---- .../UsageMetrics/GetUsageMetricsCommand.cs | 5 +---- 17 files changed, 14 insertions(+), 52 deletions(-) diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs index c15f2f18ed4c..5f612aaea007 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs @@ -116,11 +116,10 @@ public abstract class AddAlertRuleCommandBase : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); RuleCreateOrUpdateParameters parameters = this.CreateSdkCallParameters(); - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AlertOperations.CreateOrUpdateRuleAsync function with resource group:{0}, and parameters:{1}", this.ResourceGroup, parameters)); var result = this.InsightsManagementClient.AlertOperations.CreateOrUpdateRuleAsync(resourceGroupName: this.ResourceGroup, parameters: parameters).Result; WriteObject(result); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs index e1ce67506d3f..5d2db64750ed 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs @@ -71,7 +71,7 @@ protected override bool KeepTheRecord(EventData record) /// Modified query filter including the condition for eventSource protected override string ProcessParticularParameters(string currentQueryFilter) { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); // Make sure only events for alerts come back return this.AddConditionIfPResent(currentQueryFilter, "eventSource", AlertsEventSourceName); diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs index 414b34880481..20efd38b7acf 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs @@ -71,25 +71,21 @@ public class GetAlertRuleCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); if (string.IsNullOrWhiteSpace(this.Name)) { // Retrieve all the AlertRules for a ResourceGroup - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AlertOperations.ListRulesAsync function with resource group:{0}, target resource Uri:{1}", this.ResourceGroup, this.TargetResourceId)); RuleListResponse result = this.InsightsManagementClient.AlertOperations.ListRulesAsync(resourceGroupName: this.ResourceGroup, targetResourceUri: this.TargetResourceId).Result; - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Converting to the proper type and level of detail before returning")); var records = result.RuleResourceCollection.Value.Select(e => this.DetailedOutput.IsPresent ? (PSManagementItemDescriptor)new PSAlertRule(e) : new PSAlertRuleNoDetails(e)); WriteObject(sendToPipeline: records.ToList()); } else { // Retrieve a single AlertRule determined by the ResourceGroup and the rule name - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AlertOperations.GetRuleAsync function with resource group:{0}, rule name:{1}", this.ResourceGroup, this.Name)); RuleGetResponse result = this.InsightsManagementClient.AlertOperations.GetRuleAsync(resourceGroupName: this.ResourceGroup, ruleName: this.Name).Result; - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Converting to the proper type and level of detail before returning")); var finalResult = new List { this.DetailedOutput.IsPresent ? (PSManagementItemDescriptor)new PSAlertRule(result) : new PSAlertRuleNoDetails(result) }; WriteObject(sendToPipeline: finalResult); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs index dca77ae87104..e40ed264cc32 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs @@ -49,9 +49,8 @@ public class RemoveAlertRuleCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AlertOperations.DeleteRuleAsync function with resource group:{0}, rule name:{1}", this.ResourceGroup, this.Name)); AzureOperationResponse result = this.InsightsManagementClient.AlertOperations.DeleteRuleAsync(resourceGroupName: this.ResourceGroup, ruleName: this.Name).Result; WriteObject(result); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs index b9e2f5d5c8a4..e1578db66b53 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs @@ -93,11 +93,10 @@ public class AddAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); AutoscaleSettingCreateOrUpdateParameters parameters = this.CreateSdkCallParameters(); - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AutoscaleOperations.CreateOrUpdateSettingAsync function with resource group:{0}, setting name:{1}, and parameters:{2}", this.ResourceGroup, this.Name, parameters)); var result = this.InsightsManagementClient.AutoscaleOperations.CreateOrUpdateSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name, parameters: parameters).Result; WriteObject(result); @@ -109,7 +108,6 @@ private AutoscaleSettingCreateOrUpdateParameters CreateSdkCallParameters() if (this.SettingSpec != null) { - WriteVerboseWithTimestamp(string.Format("CreateSdkCallParameters: taking the parameters data from the single input SettingSpec parameter")); // Receiving a single parameter with the whole spec for an autoscale setting var property = this.SettingSpec.Properties; @@ -129,7 +127,6 @@ private AutoscaleSettingCreateOrUpdateParameters CreateSdkCallParameters() enableSetting = !this.DisableSetting.IsPresent && property.Enabled; } - WriteVerboseWithTimestamp(string.Format("CreateSdkCallParameters: creating the parameters")); return new AutoscaleSettingCreateOrUpdateParameters() { Location = this.Location, diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs index a3774c9fcd6d..a7965adc9d55 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs @@ -71,7 +71,7 @@ protected override bool KeepTheRecord(EventData record) /// Modified query filter including the condition for eventSource protected override string ProcessParticularParameters(string currentQueryFilter) { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); return this.AddConditionIfPResent(currentQueryFilter, "category", AutoscaleEventSourceName); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs index 313287594035..14f6fa643d25 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs @@ -58,25 +58,21 @@ public class GetAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); if (string.IsNullOrWhiteSpace(this.Name)) { // Retrieve all the Autoscale settings for a resource group - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AutoscaleOperations.ListSettingsAsync function with resource group:{0} and null target resource uri", this.ResourceGroup)); AutoscaleSettingListResponse result = this.InsightsManagementClient.AutoscaleOperations.ListSettingsAsync(resourceGroupName: this.ResourceGroup, targetResourceUri: null).Result; - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: converting to the proper type and level of detail before returning")); var records = result.AutoscaleSettingResourceCollection.Value.Select(e => this.DetailedOutput.IsPresent ? new PSAutoscaleSetting(e) : e); WriteObject(sendToPipeline: records, enumerateCollection: true); } else { // Retrieve a single Autoscale setting determined by the resource group and the rule name - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AutoscaleOperations.ListSettingsAsync function with resource group:{0} and setting name:{1}", this.ResourceGroup, this.Name)); AutoscaleSettingGetResponse result = this.InsightsManagementClient.AutoscaleOperations.GetSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name).Result; - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: converting to the proper type and level of detail before returning")); WriteObject(sendToPipeline: this.DetailedOutput.IsPresent ? new PSAutoscaleSetting(result) : result.ToAutoscaleSettingGetResponse()); } } diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs index 7e88a5aa1571..d40d82a682b9 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs @@ -136,7 +136,7 @@ public class NewAutoscaleProfileCommand : AzureRMCmdlet /// public override void ExecuteCmdlet() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); AutoscaleProfile profile = this.CreateSettingProfile(); WriteObject(profile); @@ -148,7 +148,6 @@ public override void ExecuteCmdlet() /// An autoscale profile based on the properties of the object public AutoscaleProfile CreateSettingProfile() { - WriteVerboseWithTimestamp("CreateSettingProfile"); return new AutoscaleProfile { Name = this.Name ?? string.Empty, @@ -181,7 +180,6 @@ public AutoscaleProfile CreateSettingProfile() /// A Recurrence created based on the properties of this object public Recurrence CreateAutoscaleRecurrence() { - WriteVerboseWithTimestamp("CreateAutoscaleRecurrence"); return new Recurrence() { Frequency = this.RecurrenceFrequency, @@ -192,7 +190,6 @@ public Recurrence CreateAutoscaleRecurrence() private RecurrentSchedule CreateRecurrentSchedule() { // Assuming validation is done by the server - WriteVerboseWithTimestamp("CreateRecurrentSchedule"); return new RecurrentSchedule() { Days = this.ScheduleDays, diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs index 560f76964523..d8c397be349e 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs @@ -113,7 +113,7 @@ public class NewAutoscaleRuleCommand : AzureRMCmdlet /// public override void ExecuteCmdlet() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); ScaleRule rule = this.CreateSettingRule(); WriteObject(rule); @@ -125,7 +125,6 @@ public override void ExecuteCmdlet() /// A ScaleRule created based on the properties of the object public ScaleRule CreateSettingRule() { - WriteVerboseWithTimestamp(string.Format("CreateSettingRule: Checking parameters")); if (this.TimeWindow != default(TimeSpan) && this.TimeWindow < MinimumTimeWindow) { throw new ArgumentOutOfRangeException("TimeWindow", this.TimeWindow, ResourcesForAutoscaleCmdlets.MinimumTimeWindow5min); @@ -136,7 +135,6 @@ public ScaleRule CreateSettingRule() throw new ArgumentOutOfRangeException("TimeGrain", this.TimeGrain, ResourcesForAutoscaleCmdlets.MinimumTimeGrain1min); } - WriteVerboseWithTimestamp(string.Format("CreateSettingRule: Creating trigger")); MetricTrigger trigger = new MetricTrigger() { MetricName = this.MetricName, @@ -149,7 +147,6 @@ public ScaleRule CreateSettingRule() TimeWindow = this.TimeWindow == default(TimeSpan) ? MinimumTimeWindow : this.TimeWindow, }; - WriteVerboseWithTimestamp(string.Format("CreateSettingRule: Creating scale action")); ScaleAction action = new ScaleAction() { Cooldown = this.ScaleActionCooldown, @@ -158,7 +155,6 @@ public ScaleRule CreateSettingRule() Value = this.ScaleActionValue, }; - WriteVerboseWithTimestamp(string.Format("CreateSettingRule: Creating scale rule")); return new ScaleRule() { MetricTrigger = trigger, diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs index 7a53f5d81558..cc4ffe9c0fae 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs @@ -48,9 +48,8 @@ public class RemoveAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK AutoscaleOperations.DeleteSettingAsync function with resource group:{0}, and setting name:{1}", this.ResourceGroup, this.Name)); AzureOperationResponse result = this.InsightsManagementClient.AutoscaleOperations.DeleteSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name).Result; WriteObject(result); } diff --git a/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs index 53e35177704a..a606beab1ceb 100644 --- a/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/EventCmdletBase.cs @@ -199,7 +199,6 @@ protected virtual bool KeepTheRecord(EventData record) /// protected override void ProcessRecordInternal() { - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Processing Parameters")); string queryFilter = this.ProcessParameters(); // Retrieve the records @@ -210,7 +209,6 @@ protected override void ProcessRecordInternal() // Call the proper API methods to return a list of raw records. In the future this pattern can be extended to include DigestRecords // If fullDetails is present do not select fields, if not present fetch only the SelectedFieldsForQuery - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK ListEventsAsync function with filter:{0}, with list of selected fields:{1}", queryFilter, fullDetails ? null : PSEventDataNoDetails.SelectedFieldsForQuery.Replace(",", ", ").Trim())); EventDataListResponse response = this.InsightsClient.EventOperations.ListEventsAsync(filterString: queryFilter, selectedProperties: fullDetails ? null : PSEventDataNoDetails.SelectedFieldsForQuery, cancellationToken: CancellationToken.None).Result; var records = new List(response.EventDataCollection.Value.Where(this.KeepTheRecord).Select(e => fullDetails ? (IPSEventData)new PSEventData(e) : (IPSEventData)new PSEventDataNoDetails(e))); string nextLink = response.EventDataCollection.NextLink; @@ -218,7 +216,6 @@ protected override void ProcessRecordInternal() // Adding a safety check to stop returning records if too many have been read already. while (!string.IsNullOrWhiteSpace(nextLink) && records.Count < maxNumberOfRecords) { - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Following continuation token, next link: {0}", nextLink)); response = this.InsightsClient.EventOperations.ListEventsNextAsync(nextLink: nextLink, cancellationToken: CancellationToken.None).Result; records.AddRange(response.EventDataCollection.Value.Select(e => fullDetails ? (IPSEventData)new PSEventData(e) : (IPSEventData)new PSEventDataNoDetails(e))); nextLink = response.EventDataCollection.NextLink; @@ -227,12 +224,10 @@ protected override void ProcessRecordInternal() var recordsReturned = new List(); if (records.Count > maxNumberOfRecords) { - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Reducing the response to a maximum of {0} records", maxNumberOfRecords)); recordsReturned.AddRange(records.Take(maxNumberOfRecords)); } else { - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Returning {0} records", records.Count)); recordsReturned = records; } diff --git a/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs index 2b9f339790b7..89e68ec505f0 100644 --- a/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/InsightsClientCmdletBase.cs @@ -39,7 +39,6 @@ public IInsightsClient InsightsClient { if (this.insightsClient == null) { - WriteVerboseWithTimestamp(string.Format("Creating a new InsightsClient with subscription: {0} ({1}) and endpoint: {2}", DefaultProfile.Context.Subscription.Id, DefaultProfile.Context.Subscription.Name, AzureEnvironment.Endpoint.ResourceManager)); // 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 this.insightsClient = AzureSession.ClientFactory.CreateClient(DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager); } diff --git a/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs index e9a9157b1ca9..1460e5b04208 100644 --- a/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs @@ -39,7 +39,6 @@ public IInsightsManagementClient InsightsManagementClient get { if (this.insightsManagementClient == null) { - WriteVerboseWithTimestamp(string.Format("Creating a new InsightsManagementClient with context: {0} ({1}) and endpoint: {2}", DefaultProfile.Context.Subscription.Id, DefaultProfile.Context.Subscription.Name, AzureEnvironment.Endpoint.ResourceManager)); this.insightsManagementClient = AzureSession.ClientFactory.CreateClient(DefaultProfile.Context, AzureEnvironment.Endpoint.ResourceManager); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs index 69abef2b9efb..0b6c6d6c3fec 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs @@ -39,7 +39,6 @@ public class FormatMetricsAsTableCommand : AzureRMCmdlet /// A tabular format of the input parameters public PSMetricTabularResult[] ProcessParameter() { - WriteVerboseWithTimestamp(string.Format("ProcessParameter: converting array of metric, with {0} records, into the proper type before returning", this.Metrics != null ? this.Metrics.Length : 0)); var metricsTable = new List(); foreach (var metric in this.Metrics ?? Enumerable.Empty()) { @@ -77,7 +76,7 @@ public PSMetricTabularResult[] ProcessParameter() /// public override void ExecuteCmdlet() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); WriteObject(this.ProcessParameter()); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs index ffd370471fb1..af62b3a2aeeb 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs @@ -70,18 +70,15 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Processing Parameters")); string queryFilter = this.ProcessParameters(); bool fullDetails = this.DetailedOutput.IsPresent; // Call the proper API methods to return a list of raw records. // If fullDetails is present full details of the records are displayed, otherwise only a summary of the records is displayed - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK MetricDefinitionOperations.GetMetricDefinitionsAsync function with resourceId: {0},and filter:{1}", this.ResourceId, queryFilter)); MetricDefinitionListResponse response = this.InsightsClient.MetricDefinitionOperations.GetMetricDefinitionsAsync(resourceUri: this.ResourceId, filterString: queryFilter, cancellationToken: CancellationToken.None).Result; - WriteVerboseWithTimestamp("ProcessRecordInternal: converting records to the proper type before returning"); var records = response.MetricDefinitionCollection.Value.Select(e => fullDetails ? (MetricDefinition)new PSMetricDefinition(e) : new PSMetricDefinitionNoDetails(e)).ToArray(); WriteObject(sendToPipeline: records); diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs index 46048052727d..7f401d0ce4bf 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs @@ -127,18 +127,15 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Processing Parameters")); string queryFilter = this.ProcessParameters(); bool fullDetails = this.DetailedOutput.IsPresent; // Call the proper API methods to return a list of raw records. // If fullDetails is present full details of the records displayed, otherwise only a summary of the values is displayed - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK MetricOperations.GetMetricsAsync function with resourceId: {0},and filter:{1}", this.ResourceId, queryFilter)); MetricListResponse response = this.InsightsClient.MetricOperations.GetMetricsAsync(resourceUri: this.ResourceId, filterString: queryFilter, cancellationToken: CancellationToken.None).Result; - WriteVerboseWithTimestamp("ProcessRecordInternal: converting records to the proper type before returning"); var records = response.MetricCollection.Value.Select(e => fullDetails ? (Metric)new PSMetric(e) : new PSMetricNoDetails(e)).ToArray(); WriteObject(sendToPipeline: records); diff --git a/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs index f22268eaef77..5654d3d3f940 100644 --- a/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs @@ -121,20 +121,17 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { - WriteWarning("******* DEPRECATION NOTICE: The name of this Insights Cmdlet will either change to include 'Rm' for consistency or disappear to be merged into other Cmdlets\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Processing Parameters")); string queryFilter = this.ProcessParameters(); string apiVersion = this.ApiVersion ?? DefaultApiVersion; // Call the proper API methods to return a list of raw records. // If fullDetails is present full details of the records displayed, otherwise only a summary of the values is displayed - WriteVerboseWithTimestamp(string.Format("ProcessRecordInternal: Calling the Insights SDK UsageMetricOperations.ListAsync function with resourceId: {0}, filter:{1}, and API version:{2}", this.ResourceId, queryFilter, apiVersion)); UsageMetricListResponse response = this.InsightsClient.UsageMetricOperations .ListAsync(resourceUri: this.ResourceId, filterString: queryFilter, apiVersion: apiVersion, cancellationToken: CancellationToken.None) .Result; - WriteVerboseWithTimestamp("ProcessRecordInternal: converting records to the proper type before returning"); var records = response.UsageMetricCollection.Value .Select(e => new PSUsageMetric(e)) .ToArray(); From e180462973c9a9283b224a80df06337d23586b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Calder=C3=B3n=5FMeza?= Date: Thu, 25 Feb 2016 16:16:36 -0800 Subject: [PATCH 3/5] FW: Changed wxi file --- setup/azurecmdfiles.wxi | 4 ---- 1 file changed, 4 deletions(-) diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index e3c72a864976..97dc22de8359 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -2515,9 +2515,6 @@ - - - @@ -5808,7 +5805,6 @@ - From 43827002535844a35b50ca5a664b6a044f5d8503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Calder=C3=B3n=5FMeza?= Date: Thu, 25 Feb 2016 21:02:36 -0800 Subject: [PATCH 4/5] FW: Remove the wxi changes and add again all references --- setup/azurecmdfiles.wxi | 32 +++++++++++++ .../Commands.Insights.Test.csproj | 43 +++++++++++++++++ .../Commands.Insights.csproj | 46 +++++++++++++++++++ 3 files changed, 121 insertions(+) diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi index 97dc22de8359..395b69c37137 100644 --- a/setup/azurecmdfiles.wxi +++ b/setup/azurecmdfiles.wxi @@ -1288,9 +1288,27 @@ + + + + + + + + + + + + + + + + + + @@ -1303,9 +1321,15 @@ + + + + + + @@ -5404,12 +5428,20 @@ + + + + + + + + diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj index 391bb5338765..2f8bb379ac60 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj +++ b/src/ResourceManager/Insights/Commands.Insights.Test/Commands.Insights.Test.csproj @@ -51,9 +51,16 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Insights.0.10.0-preview\lib\net45\Microsoft.Azure.Insights.dll + + False + ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + False ..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5896.19355-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll @@ -83,17 +90,53 @@ ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + + + ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll + + + False + ..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll + + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + False ..\..\..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll + + False + ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + False C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Management.Automation\v4.0_3.0.0.0__31bf3856ad364e35\System.Management.Automation.dll + + + + ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll + + + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True + ..\..\..\packages\xunit.assert.2.1.0\lib\portable-net45+win8+wp8+wpa81\xunit.assert.dll True diff --git a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj index 9004fb130667..75d0e129a51c 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj +++ b/src/ResourceManager/Insights/Commands.Insights/Commands.Insights.csproj @@ -49,9 +49,37 @@ ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll + + ..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll + ..\..\..\packages\Microsoft.Azure.Insights.0.10.0-preview\lib\net45\Microsoft.Azure.Insights.dll + + False + ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.11-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + + + False + ..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll + + + False + ..\..\..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll + + + False + ..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll + + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + True + + + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + True + ..\..\..\packages\Microsoft.Rest.ClientRuntime.2.0.1\lib\net45\Microsoft.Rest.ClientRuntime.dll True @@ -60,11 +88,29 @@ ..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll True + + False + ..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll + + + ..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll + True + + + False + ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + + + + False + ..\..\..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll + From ecd90ccf6bedbe585a108ab67d66ef9fa77a75ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Calder=C3=B3n=5FMeza?= Date: Fri, 26 Feb 2016 16:19:04 -0800 Subject: [PATCH 5/5] FW: Implement PR comments from SDK team --- .../Insights/Commands.Insights.Test/packages.config | 1 + .../Commands.Insights/Alerts/AddAlertRuleCommandBase.cs | 2 +- .../Commands.Insights/Alerts/GetAlertHistoryCommand.cs | 2 +- .../Commands.Insights/Alerts/GetAlertRuleCommand.cs | 2 +- .../Commands.Insights/Alerts/RemoveAlertRuleCommand.cs | 2 +- .../Autoscale/AddAutoscaleSettingCommand.cs | 2 +- .../Autoscale/GetAutoscaleHistoryCommand.cs | 2 +- .../Autoscale/GetAutoscaleSettingCommand.cs | 2 +- .../Autoscale/NewAutoscaleProfileCommand.cs | 2 +- .../Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs | 2 +- .../Autoscale/RemoveAutoscaleSettingCommand.cs | 2 +- .../Insights/Commands.Insights/ManagementCmdletBase.cs | 3 ++- .../Metrics/FormatMetricsAsTableCommand.cs | 2 +- .../Metrics/GetMetricDefinitionsCommand.cs | 2 +- .../Insights/Commands.Insights/Metrics/GetMetricsCommand.cs | 2 +- .../UsageMetrics/GetUsageMetricsCommand.cs | 2 +- src/ResourceManager/Insights/Insights.sln | 6 ++++++ 17 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config index 5f1fc800d4aa..9f6d129ee77e 100644 --- a/src/ResourceManager/Insights/Commands.Insights.Test/packages.config +++ b/src/ResourceManager/Insights/Commands.Insights.Test/packages.config @@ -24,6 +24,7 @@ + diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs index 5f612aaea007..050f2ffa2598 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/AddAlertRuleCommandBase.cs @@ -116,7 +116,7 @@ public abstract class AddAlertRuleCommandBase : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); RuleCreateOrUpdateParameters parameters = this.CreateSdkCallParameters(); diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs index 5d2db64750ed..23fc661fff64 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertHistoryCommand.cs @@ -71,7 +71,7 @@ protected override bool KeepTheRecord(EventData record) /// Modified query filter including the condition for eventSource protected override string ProcessParticularParameters(string currentQueryFilter) { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); // Make sure only events for alerts come back return this.AddConditionIfPResent(currentQueryFilter, "eventSource", AlertsEventSourceName); diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs index 20efd38b7acf..af193130cc6d 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/GetAlertRuleCommand.cs @@ -71,7 +71,7 @@ public class GetAlertRuleCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); if (string.IsNullOrWhiteSpace(this.Name)) { diff --git a/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs index e40ed264cc32..d086c945a75e 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Alerts/RemoveAlertRuleCommand.cs @@ -49,7 +49,7 @@ public class RemoveAlertRuleCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); AzureOperationResponse result = this.InsightsManagementClient.AlertOperations.DeleteRuleAsync(resourceGroupName: this.ResourceGroup, ruleName: this.Name).Result; WriteObject(result); diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs index e1578db66b53..1696912f2bdf 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAutoscaleSettingCommand.cs @@ -93,7 +93,7 @@ public class AddAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); AutoscaleSettingCreateOrUpdateParameters parameters = this.CreateSdkCallParameters(); diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs index a7965adc9d55..bc12a3965bae 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleHistoryCommand.cs @@ -71,7 +71,7 @@ protected override bool KeepTheRecord(EventData record) /// Modified query filter including the condition for eventSource protected override string ProcessParticularParameters(string currentQueryFilter) { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); return this.AddConditionIfPResent(currentQueryFilter, "category", AutoscaleEventSourceName); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs index 14f6fa643d25..01f83145835c 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAutoscaleSettingCommand.cs @@ -58,7 +58,7 @@ public class GetAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); if (string.IsNullOrWhiteSpace(this.Name)) { diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs index d40d82a682b9..b03485987b4c 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleProfileCommand.cs @@ -136,7 +136,7 @@ public class NewAutoscaleProfileCommand : AzureRMCmdlet /// public override void ExecuteCmdlet() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); AutoscaleProfile profile = this.CreateSettingProfile(); WriteObject(profile); diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs index d8c397be349e..cf052256c50d 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAutoscaleRuleCommand.cs @@ -113,7 +113,7 @@ public class NewAutoscaleRuleCommand : AzureRMCmdlet /// public override void ExecuteCmdlet() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); ScaleRule rule = this.CreateSettingRule(); WriteObject(rule); diff --git a/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs index cc4ffe9c0fae..e689f79f7fee 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Autoscale/RemoveAutoscaleSettingCommand.cs @@ -48,7 +48,7 @@ public class RemoveAutoscaleSettingCommand : ManagementCmdletBase /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); AzureOperationResponse result = this.InsightsManagementClient.AutoscaleOperations.DeleteSettingAsync(resourceGroupName: this.ResourceGroup, autoscaleSettingName: this.Name).Result; WriteObject(result); diff --git a/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs b/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs index 1460e5b04208..74f909a30d3b 100644 --- a/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs +++ b/src/ResourceManager/Insights/Commands.Insights/ManagementCmdletBase.cs @@ -35,7 +35,8 @@ public abstract class ManagementCmdletBase : InsightsCmdletBase /// public IInsightsManagementClient InsightsManagementClient { - // 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 + // 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 get { if (this.insightsManagementClient == null) { diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs index 0b6c6d6c3fec..8e24cd4fe95c 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/FormatMetricsAsTableCommand.cs @@ -76,7 +76,7 @@ public PSMetricTabularResult[] ProcessParameter() /// public override void ExecuteCmdlet() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); WriteObject(this.ProcessParameter()); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs index af62b3a2aeeb..69f5509fd03c 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricDefinitionsCommand.cs @@ -70,7 +70,7 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); string queryFilter = this.ProcessParameters(); bool fullDetails = this.DetailedOutput.IsPresent; diff --git a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs index 7f401d0ce4bf..ec43d3cd384e 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Metrics/GetMetricsCommand.cs @@ -127,7 +127,7 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); string queryFilter = this.ProcessParameters(); bool fullDetails = this.DetailedOutput.IsPresent; diff --git a/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs b/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs index 5654d3d3f940..0f63099c3b4c 100644 --- a/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/UsageMetrics/GetUsageMetricsCommand.cs @@ -121,7 +121,7 @@ protected string ProcessParameters() /// protected override void ProcessRecordInternal() { - WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release.\n\r"); + WriteWarning("This cmdlet is being modified to enable better experience and may contain breaking changes in a future release."); string queryFilter = this.ProcessParameters(); string apiVersion = this.ApiVersion ?? DefaultApiVersion; diff --git a/src/ResourceManager/Insights/Insights.sln b/src/ResourceManager/Insights/Insights.sln index 0d873aaa42ab..7df1364abacf 100644 --- a/src/ResourceManager/Insights/Insights.sln +++ b/src/ResourceManager/Insights/Insights.sln @@ -12,6 +12,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights.Test", "C EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTests.ResourceManager.Common", "..\Common\Commands.ScenarioTests.ResourceManager.Common\Commands.ScenarioTests.ResourceManager.Common.csproj", "{3436A126-EDC9-4060-8952-9A1BE34CDD95}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Profile", "..\Profile\Commands.Profile\Commands.Profile.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Authentication", "..\..\Common\Commands.Common.Authentication\Commands.Common.Authentication.csproj", "{D3804B64-C0D3-48F8-82EC-1F632F833C9E}" @@ -38,6 +40,10 @@ Global {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Debug|Any CPU.Build.0 = Debug|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.ActiveCfg = Release|Any CPU {3436A126-EDC9-4060-8952-9A1BE34CDD95}.Release|Any CPU.Build.0 = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EE72C53-1720-4309-B54B-5FB79703195F}.Release|Any CPU.ActiveCfg = Release|Any CPU