public AzureRMBackupContainer(AzureRMBackupVault vault, CSMContainerResponse containerInfo) : base(vault, containerInfo) { //ManagedResourceGroupName = ContainerHelpers.GetRGNameFromId(containerInfo.Properties.ParentContainerId); Name = containerInfo.Properties.FriendlyName; //HealthStatus = containerInfo.Properties.HealthStatus; Status = containerInfo.Properties.Status; }
public AzureRMBackupContainerContextObject(AzureRMBackupVault vault, CSMContainerResponse containerInfo) : base(vault.ResourceGroupName, vault.Name, vault.Region) { ContainerType = ContainerHelpers.GetTypeForManagedContainer(containerInfo.Properties.ContainerType).ToString(); ContainerUniqueName = containerInfo.Name; }
private bool IsDiscoveryNeeded(string vmName, string rgName, out CSMContainerResponse container) { bool isDiscoveryNeed = false; ContainerQueryParameters parameters = new ContainerQueryParameters() { ContainerType = ManagedContainerType.IaasVM.ToString(), FriendlyName = vmName, Status = AzureBackupContainerRegistrationStatus.NotRegistered.ToString(), }; //First check if container is discovered or not var containers = AzureBackupClient.ListContainers(Vault.ResourceGroupName, Vault.Name, parameters); WriteDebug(String.Format(Resources.ContainerCountFromService, containers.Count())); if (containers.Count() == 0) { //Container is not discover WriteDebug(Resources.ContainerNotDiscovered); container = null; isDiscoveryNeed = true; } else { //We can have multiple container with same friendly name. container = containers.Where(c => ContainerHelpers.GetRGNameFromId(c.Properties.ParentContainerId).Equals(rgName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (container == null) { //Container is not in list of registered container WriteDebug(String.Format(Resources.DesiredContainerNotFound)); isDiscoveryNeed = true; } } return isDiscoveryNeed; }