Recovery services convenience client.
        /// <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);
        }
        /// <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);
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ARSVault" /> class.
 /// </summary>
 /// <param name="vault">vault object</param>
 public ARSVault(VaultCreateResponse vault)
 {
     this.ID                           = vault.Id;
     this.Name                         = vault.Name;
     this.Type                         = vault.Type;
     this.Location                     = vault.Location;
     this.ResouceGroupName             = PSRecoveryServicesClient.GetResourceGroup(vault.Id);
     this.SubscriptionId               = PSRecoveryServicesClient.GetSubscriptionId(vault.Id);
     this.Properties                   = new ASRVaultProperties();
     this.Properties.ProvisioningState = vault.Properties.ProvisioningState;
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ARSVault" /> class.
 /// </summary>
 /// <param name="vault">vault object</param>
 public ARSVault(Vault vault)
 {
     this.ID                                             = vault.Id;
     this.Name                                           = vault.Name;
     this.Type                                           = vault.Type;
     this.Location                                       = vault.Location;
     this.ResourceGroupName                              = PSRecoveryServicesClient.GetResourceGroup(vault.Id);
     this.SubscriptionId                                 = PSRecoveryServicesClient.GetSubscriptionId(vault.Id);
     this.Properties                                     = new ARSVaultProperties();
     this.Properties.ProvisioningState                   = vault.Properties.ProvisioningState;
     this.Properties.PrivateEndpointStateForBackup       = vault.Properties.PrivateEndpointStateForBackup;
     this.Properties.PrivateEndpointStateForSiteRecovery = vault.Properties.PrivateEndpointStateForSiteRecovery;
 }