コード例 #1
0
 /// <summary>
 /// Construct AzureSqlServerfailoverGroupModel from Management.Sql.Models.FailoverGroup object
 /// </summary>
 /// <param name="resourceGroupName">Resource group</param>
 /// <param name="serverName">Server name</param>
 /// <param name="advisorName">Advisor name</param>
 /// <param name="failoverGroup">Recommended Action object</param>
 public AzureSqlFailoverGroupModel(string resourceGroupName, string serverName, string failoverGroupName, Management.Sql.Models.FailoverGroup failoverGroup)
 {
     ResourceGroupName = resourceGroupName;
     ServerName        = serverName;
     FailoverGroupName = failoverGroup.Name;
     Id       = failoverGroup.Id;
     Location = failoverGroup.Location;
     FailoverGroupReadOnlyEndpoint  = failoverGroup.Properties.ReadOnlyEndpoint;
     FailoverGroupReadWriteEndpoint = failoverGroup.Properties.ReadWriteEndpoint;
     PartnerServers   = failoverGroup.Properties.PartnerServers;
     Databases        = failoverGroup.Properties.Databases;
     ReplicationRole  = failoverGroup.Properties.ReplicationRole;
     ReplicationState = failoverGroup.Properties.ReplicationState;
     Tags             = TagsConversionHelper.CreateTagDictionary(TagsConversionHelper.CreateTagHashtable(failoverGroup.Tags), false);
 }
コード例 #2
0
        /// <summary>
        /// Converts the response from the service to a powershell database object
        /// </summary>
        /// <param name="resourceGroupName">The resource group the server is in</param>
        /// <param name="serverName">The name of the Azure Sql Database Server</param>
        /// <param name="pool">The service response</param>
        /// <returns>The converted model</returns>
        private AzureSqlFailoverGroupModel CreateFailoverGroupModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.FailoverGroup failoverGroup)
        {
            AzureSqlFailoverGroupModel model = new AzureSqlFailoverGroupModel();

            model.ResourceGroupName       = resourceGroup;
            model.ServerName              = serverName;
            model.FailoverGroupName       = failoverGroup.Name;
            model.Databases               = failoverGroup.Properties.Databases;
            model.ReadOnlyFailoverPolicy  = failoverGroup.Properties.ReadOnlyEndpoint.FailoverPolicy;
            model.ReadWriteFailoverPolicy = failoverGroup.Properties.ReadWriteEndpoint.FailoverPolicy;
            model.ReplicationRole         = failoverGroup.Properties.ReplicationRole;
            model.ReplicationState        = failoverGroup.Properties.ReplicationState;
            model.PartnerServers          = failoverGroup.Properties.PartnerServers;
            model.FailoverWithDataLossGracePeriodHours = failoverGroup.Properties.ReadWriteEndpoint.FailoverWithDataLossGracePeriodMinutes == null ?
                                                         null : failoverGroup.Properties.ReadWriteEndpoint.FailoverWithDataLossGracePeriodMinutes / 60;

            model.Tags     = TagsConversionHelper.CreateTagDictionary(TagsConversionHelper.CreateTagHashtable(failoverGroup.Tags), false);
            model.Location = failoverGroup.Location;;

            return(model);
        }