コード例 #1
0
        /// <summary>
        /// Helper function to convert ps backup container model from service response.
        /// </summary>
        public static ContainerBase GetContainerModel(ServiceClientModel.ProtectionContainerResource protectionContainer)
        {
            ContainerBase containerModel = null;

            if (protectionContainer != null &&
                protectionContainer.Properties != null)
            {
                if (protectionContainer.Properties.GetType().IsSubclassOf(typeof(ServiceClientModel.IaaSVMContainer)))
                {
                    containerModel = new AzureVmContainer(protectionContainer);
                }
                else if (protectionContainer.Properties.GetType() == typeof(ServiceClientModel.MabContainer))
                {
                    containerModel = new MabContainer(protectionContainer);
                }
                else if (protectionContainer.Properties.GetType() ==
                         typeof(ServiceClientModel.AzureSqlContainer))
                {
                    containerModel = new AzureSqlContainer(protectionContainer);
                }
                else if (protectionContainer.Properties.GetType() ==
                         typeof(ServiceClientModel.AzureStorageContainer))
                {
                    containerModel = new AzureFileShareContainer(protectionContainer);
                }
                else if (protectionContainer.Properties.GetType() ==
                         typeof(ServiceClientModel.AzureVMAppContainerProtectionContainer))
                {
                    containerModel = new AzureVmWorkloadContainer(protectionContainer);
                }
            }

            return(containerModel);
        }
        public override void ExecuteCmdlet()
        {
            ExecutionBlock(() =>
            {
                base.ExecuteCmdlet();

                if (Container.ContainerType != ContainerType.Windows || Container.BackupManagementType
                    != BackupManagementType.MARS)
                {
                    throw new ArgumentException(String.Format(Resources.UnsupportedContainerException,
                                                              Container.ContainerType, Container.BackupManagementType));
                }
                MabContainer mabContainer =
                    Container as MabContainer;
                string containerName = mabContainer.Name;
                ServiceClientAdapter.UnregisterContainers(containerName);
            });
        }
コード例 #3
0
        /// <summary>
        /// Helper function to convert ps backup container model from service response.
        /// </summary>
        public static ContainerBase GetContainerModel(ServiceClientModel.ProtectionContainerResource protectionContainer)
        {
            ContainerBase containerModel = null;

            if (protectionContainer != null &&
                protectionContainer.Properties != null)
            {
                if (protectionContainer.Properties.GetType().IsSubclassOf(typeof(ServiceClientModel.AzureIaaSVMProtectionContainer)))
                {
                    containerModel = new AzureVmContainer(protectionContainer);
                }
                if (protectionContainer.Properties.GetType() == typeof(ServiceClientModel.MabProtectionContainer))
                {
                    containerModel = new MabContainer(protectionContainer);
                }
            }

            return(containerModel);
        }