예제 #1
0
        /// <summary>
        /// Create the model from user input
        /// </summary>
        /// <param name="model">Model retrieved from service</param>
        /// <returns>The model that was passed in</returns>
        protected override IEnumerable <AzureSqlFailoverGroupModel> ApplyUserInputToModel(IEnumerable <AzureSqlFailoverGroupModel> model)
        {
            string location = ModelAdapter.GetServerLocation(ResourceGroupName, ServerName);
            List <AzureSqlFailoverGroupModel> newEntity = new List <AzureSqlFailoverGroupModel>();

            newEntity.Add(new AzureSqlFailoverGroupModel()
            {
                ResourceGroupName = ResourceGroupName,
                ServerName        = ServerName,
                Tags                                 = TagsConversionHelper.CreateTagDictionary(Tag, validate: true),
                Location                             = location,
                FailoverGroupName                    = FailoverGroupName,
                PartnerResourceGroupName             = MyInvocation.BoundParameters.ContainsKey("PartnerResourceGroupName") ? PartnerResourceGroupName : ResourceGroupName,
                PartnerServerName                    = PartnerServerName,
                ReadWriteFailoverPolicy              = FailoverPolicy.ToString(),
                FailoverWithDataLossGracePeriodHours = GracePeriodWithDataLossHour,
                ReadOnlyFailoverPolicy               = AllowReadOnlyFailoverToPrimary.ToString()
            });
            return(newEntity);
        }
예제 #2
0
        /// <summary>
        /// Create the model from user input
        /// </summary>
        /// <param name="model">Model retrieved from service</param>
        /// <returns>The model that was passed in</returns>
        protected override IEnumerable <AzureSqlFailoverGroupModel> ApplyUserInputToModel(IEnumerable <AzureSqlFailoverGroupModel> model)
        {
#pragma warning disable 0618
            string location = ModelAdapter.GetServerLocation(ResourceGroupName, ServerName);
            List <AzureSqlFailoverGroupModel> newEntity = new List <AzureSqlFailoverGroupModel>();
            AzureSqlFailoverGroupModel        newModel  = model.First();

            newModel.ReadWriteFailoverPolicy = MyInvocation.BoundParameters.ContainsKey("FailoverPolicy") ? FailoverPolicy.ToString() : newModel.ReadWriteFailoverPolicy;
            newModel.FailoverWithDataLossGracePeriodHours = MyInvocation.BoundParameters.ContainsKey("GracePeriodWithDataLossHour") ? GracePeriodWithDataLossHour : newModel.FailoverWithDataLossGracePeriodHours;
            newModel.ReadOnlyFailoverPolicy = MyInvocation.BoundParameters.ContainsKey("AllowReadOnlyFailoverToPrimary") ? AllowReadOnlyFailoverToPrimary.ToString() : newModel.ReadOnlyFailoverPolicy;
            newEntity.Add(newModel);

            return(newEntity);

#pragma warning restore 0618
        }