示例#1
0
 public override void ExecuteCmdlet()
 {
     ConfirmAction(
         string.Format(Resources.AddDataLakeFirewallRule, Name),
         Name,
         () =>
         WriteObject(new DataLakeAnalyticsFirewallRule(DataLakeAnalyticsClient.AddOrUpdateFirewallRule(
                                                           ResourceGroupName, Account, Name, StartIpAddress, EndIpAddress, this)))
         );
 }
        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)))
                );
        }