/// <summary>
        /// Creates a new firewall rule on the specified server.
        /// </summary>
        /// <param name="parameterSetName">The parameter set for the command.</param>
        /// <param name="serverName">The name of the server in which to create the firewall rule.</param>
        /// <param name="ruleName">The name of the new firewall rule.</param>
        /// <param name="startIpAddress">The starting IP address for the firewall rule.</param>
        /// <param name="endIpAddress">The ending IP address for the firewall rule.</param>
        /// <returns>The context to the newly created firewall rule.</returns>
        internal SqlDatabaseServerFirewallRuleContext NewAzureSqlDatabaseServerFirewallRuleProcess(
            string parameterSetName,
            string serverName,
            string ruleName,
            string startIpAddress,
            string endIpAddress)
        {
            // Get the SQL management client for the current subscription
            SqlManagementClient sqlManagementClient = SqlDatabaseCmdletBase.GetCurrentSqlClient();

            // Create the firewall rule
            FirewallRuleCreateResponse response = sqlManagementClient.FirewallRules.Create(
                serverName,
                new FirewallRuleCreateParameters()
                {
                    Name = ruleName,
                    StartIPAddress = startIpAddress,
                    EndIPAddress = endIpAddress,
                });

            SqlDatabaseServerFirewallRuleContext operationContext = new SqlDatabaseServerFirewallRuleContext()
            {
                OperationDescription = CommandRuntime.ToString(),
                OperationStatus = Services.Constants.OperationSuccess,
                OperationId = response.RequestId,
                ServerName = serverName,
                RuleName = ruleName,
                StartIpAddress = response.FirewallRule.StartIPAddress,
                EndIpAddress = response.FirewallRule.EndIPAddress,
            };

            return operationContext;
        }
        /// <summary>
        /// Updates a firewall rule on the specified server.
        /// </summary>
        /// <param name="serverName">The name of the server containing the firewall rule.</param>
        /// <param name="ruleName">The name of the firewall rule to update.</param>
        /// <param name="startIpAddress">The starting IP address for the firewall rule.</param>
        /// <param name="endIpAddress">The ending IP address for the firewall rule.</param>
        /// <returns>The updated firewall rule.</returns>
        internal SqlDatabaseServerFirewallRuleContext SetAzureSqlDatabaseServerFirewallRuleProcess(
            string serverName,
            string ruleName,
            string startIpAddress,
            string endIpAddress)
        {
            // Do nothing if force is not specified and user cancelled the operation
            if (!Force.IsPresent &&
                !ShouldProcess(
                    string.Format(CultureInfo.InvariantCulture, Resources.SetAzureSqlDatabaseServerFirewallRuleDescription, ruleName, serverName),
                    string.Format(CultureInfo.InvariantCulture, Resources.SetAzureSqlDatabaseServerFirewallRuleWarning, ruleName, serverName),
                    Resources.ShouldProcessCaption))
            {
                return null;
            }

            // Get the SQL management client for the current subscription
            SqlManagementClient sqlManagementClient = GetCurrentSqlClient();

            // Update the specified firewall rule
            FirewallRuleUpdateResponse response = sqlManagementClient.FirewallRules.Update(
                serverName,
                ruleName,
                new FirewallRuleUpdateParameters()
                {
                    Name = ruleName,
                    StartIPAddress = startIpAddress,
                    EndIPAddress = endIpAddress,
                });

            SqlDatabaseServerFirewallRuleContext operationContext = new SqlDatabaseServerFirewallRuleContext()
            {
                OperationDescription = CommandRuntime.ToString(),
                OperationStatus = Services.Constants.OperationSuccess,
                OperationId = response.RequestId,
                ServerName = serverName,
                RuleName = ruleName,
                StartIpAddress = response.FirewallRule.StartIPAddress,
                EndIpAddress = response.FirewallRule.EndIPAddress
            };

            return operationContext;
        }