ValidateReplicationStartTime() 공개 정적인 메소드

Validates if the time span object has a valid value.
public static ValidateReplicationStartTime ( System.TimeSpan timeSpan ) : void
timeSpan System.TimeSpan Time span object to be validated
리턴 void
예제 #1
0
        /// <summary>
        /// Creates an E2E Protection Profile object
        /// </summary>
        private void EnterpriseToEnterpriseProtectionProfileObject()
        {
            if (string.Compare(this.ReplicationProvider, Constants.HyperVReplica, StringComparison.OrdinalIgnoreCase) != 0)
            {
                throw new InvalidOperationException(
                          string.Format(
                              Properties.Resources.IncorrectReplicationProvider,
                              this.ReplicationProvider));
            }

            PSRecoveryServicesClient.ValidateReplicationStartTime(this.ReplicationStartTime);

            ushort replicationFrequencyInSeconds = PSRecoveryServicesClient.ConvertReplicationFrequencyToUshort(this.ReplicationFrequencyInSeconds);

            ASRProtectionProfile protectionProfile = new ASRProtectionProfile()
            {
                Name = this.Name,
                ReplicationProvider = this.ReplicationProvider,
                HyperVReplicaAzureProviderSettingsObject = null,
                HyperVReplicaProviderSettingsObject      = new HyperVReplicaProviderSettings()
                {
                    ReplicationMethod             = this.ReplicationMethod,
                    ReplicationFrequencyInSeconds = replicationFrequencyInSeconds,
                    RecoveryPoints = this.RecoveryPoints,
                    ApplicationConsistentSnapshotFrequencyInHours = this.ApplicationConsistentSnapshotFrequencyInHours,
                    CompressionEnabled   = this.CompressionEnabled,
                    ReplicationPort      = this.ReplicationPort,
                    Authentication       = this.Authentication,
                    ReplicationStartTime = this.ReplicationStartTime,
                    AllowReplicaDeletion = this.AllowReplicaDeletion
                }
            };

            this.WriteObject(protectionProfile);
        }
예제 #2
0
        /// <summary>
        /// Proceeds to Create an E2A Protection Profile Object after all the validations are done.
        /// </summary>
        private void ProceedToCreateProtectionProfileObject()
        {
            PSRecoveryServicesClient.ValidateReplicationStartTime(this.ReplicationStartTime);

            ushort replicationFrequencyInSeconds =
                PSRecoveryServicesClient.ConvertReplicationFrequencyToUshort(
                    this.ReplicationFrequencyInSeconds);

            ASRProtectionProfile protectionProfile = new ASRProtectionProfile()
            {
                Name = this.Name,
                ReplicationProvider = this.ReplicationProvider,
                HyperVReplicaAzureProviderSettingsObject = new HyperVReplicaAzureProviderSettings()
                {
                    RecoveryAzureSubscription       = this.RecoveryAzureSubscription,
                    RecoveryAzureStorageAccountName = this.RecoveryAzureStorageAccount,
                    //// Currently Data Encryption is not supported.
                    EncryptStoredData             = false,
                    ReplicationFrequencyInSeconds = replicationFrequencyInSeconds,
                    RecoveryPoints = this.RecoveryPoints,
                    ApplicationConsistentSnapshotFrequencyInHours = this.ApplicationConsistentSnapshotFrequencyInHours,
                    ReplicationStartTime = this.ReplicationStartTime,
                },
                HyperVReplicaProviderSettingsObject = null
            };

            this.WriteObject(protectionProfile);
        }