Represents an Azure SQL Database Replication Link
Inheritance: AzureSqlDatabaseReplicationModelBase
        /// <summary>
        /// Converts the response from the service to a powershell Secondary Link object
        /// </summary>
        /// <param name="resourceGroupName">The name of the Resource Group containing the primary database</param>
        /// <param name="serverName">The name of the Azure SQL Server containing the primary database</param>
        /// <param name="databaseName">The name of primary database</param>
        /// <param name="partnerResourceGroupName">The name of the Resource Group containing the secondary database</param>
        /// <param name="linkId">The linkId of the replication link to the secondary</param>
        /// <param name="response">The replication link response</param>
        /// <returns>The Azure SQL Database ReplicationLink object</returns>
        private AzureReplicationLinkModel CreateReplicationLinkModelFromReplicationLinkResponse(string resourceGroupName,
            string serverName, string databaseName, string partnerResourceGroupName, Management.Sql.Models.ReplicationLink resp)
        {
            // partnerResourceGroupName is required because it is not exposed in any reponse from the service.
            // AllowConnections.ReadOnly is not yet supported
            AllowConnections allowConnections = (resp.Properties.Role.Equals(Management.Sql.Models.DatabaseCreateMode.Secondary)
                || resp.Properties.PartnerRole.Equals(Management.Sql.Models.DatabaseCreateMode.Secondary)) ? AllowConnections.All : AllowConnections.No;

            AzureReplicationLinkModel model = new AzureReplicationLinkModel();

            model.LinkId = new Guid(resp.Name);
            model.PartnerResourceGroupName = partnerResourceGroupName;
            model.PartnerServerName = resp.Properties.PartnerServer;
            model.ResourceGroupName = resourceGroupName;
            model.ServerName = serverName;
            model.DatabaseName = databaseName;
            model.AllowConnections = allowConnections;
            model.Location = resp.Location;
            model.PartnerLocation = resp.Properties.PartnerLocation;
            model.PercentComplete = resp.Properties.PercentComplete;
            model.ReplicationState = resp.Properties.ReplicationState;
            model.PartnerRole = resp.Properties.PartnerRole;
            model.Role = resp.Properties.Role;
            model.StartTime = resp.Properties.StartTime.ToString();

            return model;
        }
        /// <summary>
        /// Creates an Azure SQL Database Secondary
        /// </summary>
        /// <param name="resourceGroupName">The name of the Resource Group containing the primary database</param>
        /// <param name="serverName">The name of the Azure SQL Server containing the primary database</param>
        /// <param name="model">The input parameters for the create operation</param>
        /// <returns>The Azure SQL Database ReplicationLink object</returns>
        internal AzureReplicationLinkModel CreateLink(string resourceGroupName, string serverName, AzureReplicationLinkModel model)
        {
            var resp = ReplicationCommunicator.CreateCopy(resourceGroupName, serverName, model.DatabaseName, Util.GenerateTracingId(), new DatabaseCreateOrUpdateParameters()
            {
                Location = model.PartnerLocation,
                Properties = new DatabaseCreateOrUpdateProperties()
                {
                    SourceDatabaseId = string.Format(AzureReplicationLinkModel.SourceIdTemplate, _subscription.Id.ToString(),
                        model.ResourceGroupName, model.ServerName, model.DatabaseName),
                    CreateMode = model.AllowConnections.HasFlag(AllowConnections.All) ? Management.Sql.Models.DatabaseCreateMode.Secondary : Management.Sql.Models.DatabaseCreateMode.NonReadableSecondary,
                    ElasticPoolName = model.SecondaryElasticPoolName,
                    RequestedServiceObjectiveName = model.SecondaryServiceObjectiveName,
                }
            });

            return GetLink(model.ResourceGroupName, model.ServerName, model.DatabaseName, model.PartnerResourceGroupName, model.PartnerServerName);
        }