Exemplo n.º 1
0
        public void ValidateSimpleSchedulePolicy(CmdletModel.SchedulePolicyBase policy, string backupManagementType = "")
        {
            if (policy == null || (policy.GetType() != typeof(CmdletModel.SimpleSchedulePolicy) && policy.GetType() != typeof(CmdletModel.SimpleSchedulePolicyV2)))
            {
                throw new ArgumentException(string.Format(Resources.InvalidSchedulePolicyException,
                                                          typeof(CmdletModel.SimpleSchedulePolicy).ToString() + ", " + typeof(CmdletModel.SimpleSchedulePolicyV2).ToString()));
            }

            if (backupManagementType == ServiceClientModel.BackupManagementType.AzureStorage &&
                ((CmdletModel.SimpleSchedulePolicy)policy).ScheduleRunFrequency == ScheduleRunType.Weekly)
            {
                throw new ArgumentException(Resources.AFSWeeklyScheduleNotAllowed);
            }

            // call base schedule policy validation
            policy.Validate();

            if (backupManagementType == ServiceClientModel.BackupManagementType.AzureIaasVM)
            {
                ValidateAzureIaasVMSchedulePolicy(policy);
            }
            else if (backupManagementType == ServiceClientModel.BackupManagementType.AzureStorage)
            {
                // AFS specific validation
                ValidateAFSSchedulePolicy((CmdletModel.SimpleSchedulePolicy)policy);
            }
        }
        public void ValidateSimpleSchedulePolicy(CmdletModel.SchedulePolicyBase policy)
        {
            if (policy == null || policy.GetType() != typeof(CmdletModel.SimpleSchedulePolicy))
            {
                throw new ArgumentException(string.Format(Resources.InvalidSchedulePolicyException,
                                                          typeof(CmdletModel.SimpleSchedulePolicy).ToString()));
            }

            // call validation
            policy.Validate();
        }
        public void ValidateSimpleSchedulePolicy(CmdletModel.SchedulePolicyBase policy, string backupManagementType = "")
        {
            if (policy == null || policy.GetType() != typeof(CmdletModel.SimpleSchedulePolicy))
            {
                throw new ArgumentException(string.Format(Resources.InvalidSchedulePolicyException,
                                                          typeof(CmdletModel.SimpleSchedulePolicy).ToString()));
            }

            if (backupManagementType == BackupManagementType.AzureStorage &&
                ((CmdletModel.SimpleSchedulePolicy)policy).ScheduleRunFrequency == ScheduleRunType.Weekly)
            {
                throw new ArgumentException(Resources.AFSWeeklyScheduleNotAllowed);
            }

            // call validation
            policy.Validate();
        }