Example #1
0
 /// <summary>
 /// Converts the response from the service to a powershell Server Disaster Recovery Configuration object
 /// </summary>
 /// <param name="resourceGroup">The resource group the server is in</param>
 /// <param name="serverName">The name of the Azure Sql Server</param>
 /// <param name="serverDisasterRecoveryConfiguration">The service response</param>
 /// <returns>The converted model</returns>
 public static AzureSqlServerDisasterRecoveryConfigurationModel CreateServerDisasterRecoveryConfigurationModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.ServerDisasterRecoveryConfiguration serverDisasterRecoveryConfiguration)
 {
     return(new AzureSqlServerDisasterRecoveryConfigurationModel(resourceGroup, serverName, serverDisasterRecoveryConfiguration));
 }
        /// <summary>
        /// Construct AzureSqlServerDisasterRecoveryConfigurationModel from Management.Sql.Models.ServerDisasterRecoveryConfiguration object
        /// </summary>
        /// <param name="resourceGroup">Resource group</param>
        /// <param name="serverName">Server name</param>
        /// <param name="serverDisasterRecoveryConfiguration">ServerDisasterRecoveryConfiguration object</param>
        public AzureSqlServerDisasterRecoveryConfigurationModel(string resourceGroup, string serverName, Management.Sql.Models.ServerDisasterRecoveryConfiguration serverDisasterRecoveryConfiguration)
        {
            ResourceGroupName = resourceGroup;
            ServerName        = serverName;

            // Short-term workaround for missing sdrc. Will remove once upstream issues are resolved.
            if (serverDisasterRecoveryConfiguration != null)
            {
                ServerDisasterRecoveryConfigurationName = serverDisasterRecoveryConfiguration.Name;
                VirtualEndpointName = serverDisasterRecoveryConfiguration.Name;
                Location            = serverDisasterRecoveryConfiguration.Location;
                PartnerServerName   = serverDisasterRecoveryConfiguration.Properties.PartnerLogicalServerName;
                AutoFailover        = serverDisasterRecoveryConfiguration.Properties.AutoFailover;
                FailoverPolicy      = serverDisasterRecoveryConfiguration.Properties.FailoverPolicy;
                Role = serverDisasterRecoveryConfiguration.Properties.Role;
            }
        }