public override void ExecuteCmdlet() { if (string.IsNullOrEmpty(Name)) { WriteObject(DataLakeAnalyticsClient.ListFirewallRules(ResourceGroupName, Account) .Select(element => new DataLakeAnalyticsFirewallRule(element)) .ToList(), true); } else { WriteObject(new DataLakeAnalyticsFirewallRule(DataLakeAnalyticsClient.GetFirewallRule(ResourceGroupName, Account, Name))); } }
public override void ExecuteCmdlet() { // get the current firewall rule var rule = DataLakeAnalyticsClient.GetFirewallRule(ResourceGroupName, Account, Name); if (rule == null) { throw new PSInvalidOperationException(string.Format(Resources.FirewallRuleNotFound, Name)); } var endIp = EndIpAddress ?? rule.EndIpAddress; var startIp = StartIpAddress ?? rule.StartIpAddress; ConfirmAction( string.Format(Resources.SetDataLakeFirewallRule, Name), Name, () => WriteObject(new DataLakeAnalyticsFirewallRule(DataLakeAnalyticsClient.AddOrUpdateFirewallRule( ResourceGroupName, Account, Name, startIp, endIp, this))) ); }