Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ASRProtectionProfile" /> class with 
        /// required parameters.
        /// </summary>
        /// <param name="profile">Protection container object</param>
        public ASRProtectionProfile(ProtectionProfile profile)
        {
            this.ID = profile.Id;
            this.Name = profile.Name;
            this.FriendlyName = profile.CustomData.FriendlyName;
            this.Type = profile.Type;
            this.ReplicationProvider = profile.CustomData.ReplicationProvider;

            if (profile.CustomData.ReplicationProvider == Constants.HyperVReplica)
            {
                HyperVReplicaProtectionProfileDetails details =
                    (HyperVReplicaProtectionProfileDetails)profile.CustomData.ReplicationProviderSettings;

                ASRHyperVReplicaProtectionProfileDetails replicationProviderSettings =
                    new ASRHyperVReplicaProtectionProfileDetails();

                replicationProviderSettings.ReplicaDeletionOption =
                    details.ReplicaDeletionOption;
                replicationProviderSettings.ApplicationConsistentSnapshotFrequencyInHours =
                    details.ApplicationConsistentSnapshotFrequencyInHours;
                replicationProviderSettings.Compression =
                    details.Compression;
                replicationProviderSettings.ReplicationFrequencyInSeconds =
                    details.ReplicationFrequencyInSeconds;
                replicationProviderSettings.AllowedAuthenticationType =
                    (details.AllowedAuthenticationType == 1) ?
                    Constants.AuthenticationTypeKerberos :
                    Constants.AuthenticationTypeCertificate;
                replicationProviderSettings.RecoveryPoints = details.RecoveryPoints;
                replicationProviderSettings.InitialReplicationMethod =
                    (string.Compare(details.InitialReplicationMethod, "OverNetwork", StringComparison.OrdinalIgnoreCase) == 0) ?
                    Constants.OnlineReplicationMethod :
                    Constants.OfflineReplicationMethod;
                replicationProviderSettings.ReplicationPort = details.ReplicationPort;
                replicationProviderSettings.OnlineReplicationStartTime = details.OnlineReplicationStartTime;

                this.ReplicationProviderSettings = replicationProviderSettings;
            }
            else if (profile.CustomData.ReplicationProvider == Constants.HyperVReplicaAzure)
            {
                HyperVReplicaAzureProtectionProfileDetails details =
                    (HyperVReplicaAzureProtectionProfileDetails)profile.CustomData.ReplicationProviderSettings;

                ASRHyperVReplicaAzureProtectionProfileDetails replicationProviderSettings =
                    new ASRHyperVReplicaAzureProtectionProfileDetails();

                replicationProviderSettings.ApplicationConsistentSnapshotFrequencyInHours =
                    details.ApplicationConsistentSnapshotFrequencyInHours;
                replicationProviderSettings.ReplicationFrequencyInSeconds = details.ReplicationInterval;
                replicationProviderSettings.RecoveryPoints = details.RecoveryPointHistoryDuration;
                replicationProviderSettings.OnlineReplicationStartTime = details.OnlineReplicationStartTime;
                replicationProviderSettings.Encryption = details.Encryption;
                replicationProviderSettings.ActiveStorageAccount = new CustomerStorageAccount();
                replicationProviderSettings.ActiveStorageAccount.StorageAccountName =
                    details.ActiveStorageAccount.StorageAccountName;
                replicationProviderSettings.ActiveStorageAccount.SubscriptionId =
                    details.ActiveStorageAccount.SubscriptionId;

                this.ReplicationProviderSettings = replicationProviderSettings;
            }
        }
 /// <summary>
 /// Write Profile.
 /// </summary>
 /// <param name="profile">Profile object</param>
 private void WriteProfile(ProtectionProfile profile)
 {
     this.WriteObject(new ASRProtectionProfile(profile));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ASRProtectionProfile" /> class with 
        /// required parameters.
        /// </summary>
        /// <param name="profile">Protection container object</param>
        public ASRProtectionProfile(ProtectionProfile profile)
        {
            this.ID = profile.Id;
            this.Name = profile.Name;
            this.FriendlyName = profile.CustomData.FriendlyName;
            this.Type = profile.Type;
            this.ReplicationProvider = profile.CustomData.ReplicationProvider;

            if (profile.CustomData.ReplicationProvider == Constants.HyperVReplica)
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                HyperVReplicaProtectionProfileDetails details = (HyperVReplicaProtectionProfileDetails)profile.CustomData.ReplicationProviderSettings;

                this.ReplicationProviderSettings = new ASRHyperVReplicaProtectionProfileDetails();
                this.ReplicationProviderSettings.ReplicaDeletionOption =
                    details.ReplicaDeletionOption;
                this.ReplicationProviderSettings.ApplicationConsistentSnapshotFrequencyInHours =
                    details.ApplicationConsistentSnapshotFrequencyInHours;

                this.ReplicationProviderSettings.Compression=
                    details.Compression;
                this.ReplicationProviderSettings.ReplicationFrequencyInSeconds =
                    details.ReplicationFrequencyInSeconds;
                this.ReplicationProviderSettings.AllowedAuthenticationType =
                    (details.AllowedAuthenticationType == 1) ? Constants.AuthenticationTypeKerberos : Constants.AuthenticationTypeCertificate; 
                this.ReplicationProviderSettings.RecoveryPoints = details.RecoveryPoints;
                this.ReplicationProviderSettings.InitialReplicationMethod =
                    (string.Compare(details.InitialReplicationMethod, "OverNetwork", StringComparison.OrdinalIgnoreCase) == 0) ? Constants.OnlineReplicationMethod : Constants.OfflineReplicationMethod;
                this.ReplicationProviderSettings.ReplicationPort = details.ReplicationPort;
                this.ReplicationProviderSettings.OnlineReplicationStartTime = details.OnlineReplicationStartTime;
            }
        }