Microsoft.Azure.Commands.Insights.Alerts.AddAzureRmLogAlertRuleCommand.CreateSdkCallParameters C# (CSharp) Method

CreateSdkCallParameters() protected method

protected CreateSdkCallParameters ( ) : AlertRuleResource
return AlertRuleResource
        protected override AlertRuleResource CreateSdkCallParameters()
        {
            RuleCondition condition = this.CreateRuleCondition();

            WriteVerboseWithTimestamp(string.Format("CreateSdkCallParameters: Creating rule object"));
            var rule = new AlertRuleResource(
                location: this.Location,
                isEnabled: !this.DisableRule,
                alertRuleResourceName: this.Name)
            {
                Description = this.Description ?? Utilities.GetDefaultDescription("log alert rule"),
                Condition = condition,
                Actions = this.Actions,

                // DO NOT REMOVE OR CHANGE the following. The two elements in the Tags are required by other services.
                Tags = new Dictionary<string, string>(),
            };

            if (!string.IsNullOrEmpty(this.TargetResourceId))
            {
                rule.Tags.Add("$type", "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary,Microsoft.WindowsAzure.Management.Common.Storage");
                rule.Tags.Add("hidden-link:" + this.TargetResourceId, "Resource");
            }

            return rule;
        }
    }