Example #1
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="link">The service response</param>
        /// <returns>The converted model</returns>
        private AzureSqlServerCommunicationLinkModel CreateServerCommunicationLinkModelFromResponse(string resourceGroup, string serverName, Management.Sql.LegacySdk.Models.ServerCommunicationLink link)
        {
            AzureSqlServerCommunicationLinkModel model = new AzureSqlServerCommunicationLinkModel();

            model.ResourceGroupName = resourceGroup;
            model.ServerName        = serverName;
            model.Name          = link.Name;
            model.PartnerServer = link.Properties.PartnerServer;
            model.State         = link.Properties.State;
            model.Location      = link.Location;

            return(model);
        }
Example #2
0
        /// <summary>
        /// Creates or updates a Azure Sql Server communication link.
        /// </summary>
        /// <param name="resourceGroup">The name of the resource group</param>
        /// <param name="serverName">The name of the Azure Sql Database Server</param>
        /// <param name="model">The input parameters for the create/update operation</param>
        /// <returns>The upserted Azure Sql server communication link</returns>
        internal AzureSqlServerCommunicationLinkModel UpsertServerCommunicationLink(AzureSqlServerCommunicationLinkModel model)
        {
            var resp = Communicator.CreateOrUpdate(model.ResourceGroupName, model.ServerName, model.Name, Util.GenerateTracingId(), new ServerCommunicationLinkCreateOrUpdateParameters()
            {
                Location   = model.Location,
                Properties = new ServerCommunicationLinkCreateOrUpdateProperties()
                {
                    PartnerServer = model.PartnerServer,
                }
            });

            return(CreateServerCommunicationLinkModelFromResponse(model.ResourceGroupName, model.ServerName, resp));
        }