/// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            try
            {
                string primaryServerId  = this.PrimaryServer.ID;
                string recoveryServerId = string.Empty;

                switch (this.ParameterSetName)
                {
                case ASRParameterSets.EnterpriseToEnterprise:
                    recoveryServerId = this.RecoveryServer.ID;
                    break;

                case ASRParameterSets.EnterpriseToAzure:
                    recoveryServerId = Constants.AzureFabricId;
                    break;
                }

                NetworkMappingListResponse networkMappingListResponse =
                    RecoveryServicesClient
                    .GetAzureSiteRecoveryNetworkMappings(primaryServerId, recoveryServerId);

                this.WriteNetworkMappings(networkMappingListResponse.NetworkMappings);
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get Azure to Azure Network mapping.
 /// </summary>
 private void GetNetworkMappingByFabric()
 {
     if (string.Equals(
             this.PrimaryFabric.FabricType,
             Constants.Azure,
             StringComparison.InvariantCultureIgnoreCase))
     {
         if (string.IsNullOrEmpty(this.Name))
         {
             var networkMappingList = RecoveryServicesClient.GetAzureSiteRecoveryNetworkMappings(
                 this.PrimaryFabric.Name,
                 ARMResourceTypeConstants.AzureNetwork);
             this.WriteNetworkMappings(networkMappingList);
         }
         else
         {
             var networkMapping =
                 RecoveryServicesClient.GetAzureSiteRecoveryNetworkMappings(
                     this.PrimaryFabric.Name,
                     ARMResourceTypeConstants.AzureNetwork,
                     this.Name);
             this.WriteNetworkMapping(networkMapping);
         }
     }
     else
     {
         var networks = this.RecoveryServicesClient.GetAzureSiteRecoveryNetworks(this.PrimaryFabric.Name);
         foreach (var network in networks)
         {
             this.Network = new ASRNetwork(network);
             this.ByObject();
         }
     }
 }
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteSiteRecoveryCmdlet()
        {
            base.ExecuteSiteRecoveryCmdlet();

            networkMappingsListResponse =
                RecoveryServicesClient
                .GetAzureSiteRecoveryNetworkMappings();

            switch (this.ParameterSetName)
            {
            case ASRParameterSets.EnterpriseToEnterpriseLegacy:
                this.WriteWarningWithTimestamp(Properties.Resources.ParameterSetWillBeDeprecatedSoon);
                this.FilterE2EMappingsLegacy();
                break;

            case ASRParameterSets.EnterpriseToAzureLegacy:
                this.WriteWarningWithTimestamp(Properties.Resources.ParameterSetWillBeDeprecatedSoon);
                this.FilterE2AMappingsLegacy();
                break;

            case ASRParameterSets.EnterpriseToEnterprise:
                this.FilterE2EMappings();
                break;

            case ASRParameterSets.EnterpriseToAzure:
                this.FilterE2AMappings();
                break;

            case ASRParameterSets.Default:
                WriteNetworkMappings(networkMappingsListResponse.NetworkMappingsList);
                break;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        protected override void ProcessRecord()
        {
            try
            {
                networkMappingsListResponse =
                    RecoveryServicesClient
                    .GetAzureSiteRecoveryNetworkMappings();

                switch (this.ParameterSetName)
                {
                case ASRParameterSets.EnterpriseToEnterprise:
                    this.FilterE2EMappings();
                    break;

                case ASRParameterSets.EnterpriseToAzure:
                    this.FilterE2AMappings();
                    break;

                case ASRParameterSets.Default:
                    WriteNetworkMappings(networkMappingsListResponse.NetworkMappingsList);
                    break;
                }
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            try
            {
                this.WriteWarningWithTimestamp(
                    string.Format(
                        Properties.Resources.CmdletWillBeDeprecatedSoon,
                        this.MyInvocation.MyCommand.Name));

                string primaryServerId  = this.PrimaryServer.ID;
                string recoveryServerId = string.Empty;

                switch (this.ParameterSetName)
                {
                case ASRParameterSets.EnterpriseToEnterprise:
                    recoveryServerId = this.RecoveryServer.ID;
                    break;

                case ASRParameterSets.EnterpriseToAzure:
                    recoveryServerId = Constants.AzureFabricId;
                    break;
                }

                NetworkMappingListResponse networkMappingListResponse =
                    RecoveryServicesClient
                    .GetAzureSiteRecoveryNetworkMappings(primaryServerId, recoveryServerId);

                this.WriteNetworkMappings(networkMappingListResponse.NetworkMappings);
            }
            catch (Exception exception)
            {
                this.HandleException(exception);
            }
        }
        /// <summary>
        /// ProcessRecord of the command.
        /// </summary>
        public override void ExecuteSiteRecoveryCmdlet()
        {
            base.ExecuteSiteRecoveryCmdlet();

            networkMappingsListResponse =
                RecoveryServicesClient
                .GetAzureSiteRecoveryNetworkMappings();

            switch (this.ParameterSetName)
            {
            case ASRParameterSets.EnterpriseToEnterprise:
                this.FilterE2EMappings();
                break;

            case ASRParameterSets.EnterpriseToAzure:
                this.FilterE2AMappings();
                break;

            case ASRParameterSets.Default:
                WriteNetworkMappings(networkMappingsListResponse.NetworkMappingsList);
                break;
            }
        }