public override void ExecuteCmdlet() { ExecutionBlock(() => { base.ExecuteCmdlet(); PsBackupProviderManager providerManager = new PsBackupProviderManager(new Dictionary <Enum, object>() { { ItemParams.Container, Container }, { ItemParams.BackupManagementType, BackupManagementType }, { ItemParams.AzureVMName, Name }, { ItemParams.ProtectionStatus, ProtectionStatus }, { ItemParams.ProtectionState, ProtectionState }, { ItemParams.WorkloadType, WorkloadType }, }, ServiceClientAdapter); IPsBackupProvider psBackupProvider = null; if (this.ParameterSetName == GetItemsForVaultParamSet) { psBackupProvider = providerManager.GetProviderInstance(WorkloadType, BackupManagementType); } else { psBackupProvider = providerManager.GetProviderInstance(WorkloadType, (Container as ManagementContext).BackupManagementType); } var itemModels = psBackupProvider.ListProtectedItems(); WriteObject(itemModels, enumerateCollection: true); }); }
public override void ExecuteCmdlet() { ExecutionBlock(() => { base.ExecuteCmdlet(); ResourceIdentifier resourceIdentifier = new ResourceIdentifier(VaultId); string vaultName = resourceIdentifier.ResourceName; string resourceGroupName = resourceIdentifier.ResourceGroupName; PsBackupProviderManager providerManager = new PsBackupProviderManager(new Dictionary <Enum, object>() { { VaultParams.VaultName, vaultName }, { VaultParams.ResourceGroupName, resourceGroupName }, { ItemParams.DeleteState, DeleteState }, { ItemParams.Container, Container }, { ItemParams.BackupManagementType, BackupManagementType }, { ItemParams.ItemName, Name }, { PolicyParams.ProtectionPolicy, Policy }, { ItemParams.ProtectionStatus, ProtectionStatus }, { ItemParams.ProtectionState, ProtectionState }, { ItemParams.WorkloadType, WorkloadType }, { ItemParams.FriendlyName, FriendlyName }, { CRRParams.UseSecondaryRegion, UseSecondaryRegion.IsPresent } }, ServiceClientAdapter); IPsBackupProvider psBackupProvider = null; List <ItemBase> itemModels = null; if (BackupManagementType == BackupManagementType.MAB || (this.ParameterSetName == GetItemsForContainerParamSet && (Container as ContainerContext).ContainerType == ContainerType.Windows)) { AzureWorkloadProviderHelper provider = new AzureWorkloadProviderHelper(ServiceClientAdapter); itemModels = provider.GetMABProtectedItems(vaultName, resourceGroupName, Container); } else { if (this.ParameterSetName == GetItemsForVaultParamSet) { psBackupProvider = providerManager.GetProviderInstance(WorkloadType, BackupManagementType); } else if (this.ParameterSetName == GetItemsForContainerParamSet) { psBackupProvider = providerManager.GetProviderInstance(WorkloadType, (Container as ManagementContext).BackupManagementType); } else { psBackupProvider = providerManager.GetProviderInstance(Policy.WorkloadType); } itemModels = psBackupProvider.ListProtectedItems(); } WriteObject(itemModels, enumerateCollection: true); }); }
public override void ExecuteCmdlet() { ExecutionBlock(() => { base.ExecuteCmdlet(); ResourceIdentifier resourceIdentifier = new ResourceIdentifier(VaultId); string vaultName = resourceIdentifier.ResourceName; string resourceGroupName = resourceIdentifier.ResourceGroupName; PsBackupProviderManager providerManager = new PsBackupProviderManager(new Dictionary <Enum, object>() { { VaultParams.VaultName, vaultName }, { VaultParams.ResourceGroupName, resourceGroupName }, { ItemParams.DeleteState, DeleteState }, { ItemParams.Container, Container }, { ItemParams.BackupManagementType, BackupManagementType }, { ItemParams.ItemName, Name }, { PolicyParams.ProtectionPolicy, Policy }, { ItemParams.ProtectionStatus, ProtectionStatus }, { ItemParams.ProtectionState, ProtectionState }, { ItemParams.WorkloadType, WorkloadType }, { ItemParams.FriendlyName, FriendlyName } }, ServiceClientAdapter); IPsBackupProvider psBackupProvider = null; if (this.ParameterSetName == GetItemsForVaultParamSet) { psBackupProvider = providerManager.GetProviderInstance(WorkloadType, BackupManagementType); } else if (this.ParameterSetName == GetItemsForContainerParamSet) { psBackupProvider = providerManager.GetProviderInstance(WorkloadType, (Container as ManagementContext).BackupManagementType); } else { psBackupProvider = providerManager.GetProviderInstance(Policy.WorkloadType); } var itemModels = psBackupProvider.ListProtectedItems(); WriteObject(itemModels, enumerateCollection: true); }); }