private List <AzureRMBackupContainer> GetMachineContainers(string resourceGroupName, string resourceName) { List <MarsContainerResponse> marsContainerResponses = new List <MarsContainerResponse>(); // Machine containers are always registered. // So if requested Status is not Registered, return an empty list. // Machine containers don't have a resource group. // So, if a resource group is passed, return an empty list. if (Status == AzureBackupContainerRegistrationStatus.NotRegistered || Status == AzureBackupContainerRegistrationStatus.Registering || !string.IsNullOrEmpty(ManagedResourceGroupName)) { return(new List <AzureRMBackupContainer>()); } if (string.IsNullOrEmpty(Name)) { marsContainerResponses.AddRange(AzureBackupClient.ListMachineContainers(resourceGroupName, resourceName)); } else { marsContainerResponses.AddRange(AzureBackupClient.ListMachineContainers(resourceGroupName, resourceName, Name)); } return(marsContainerResponses.ConvertAll <AzureRMBackupContainer>(marsContainerResponse => { return new AzureRMBackupContainer(Vault, marsContainerResponse); }).Where(container => container.ContainerType == Type.ToString()).ToList()); }
private List <AzureBackupContainer> GetMachineContainers() { List <MarsContainerResponse> marsContainerResponses = new List <MarsContainerResponse>(); if (string.IsNullOrEmpty(Name)) { marsContainerResponses.AddRange(AzureBackupClient.ListMachineContainers()); } else { marsContainerResponses.AddRange(AzureBackupClient.ListMachineContainers(Name)); } return(marsContainerResponses.ConvertAll <AzureBackupContainer>(marsContainerResponse => { return new AzureBackupContainer(Vault, marsContainerResponse); }).Where(container => container.ContainerType == Type.ToString()).ToList()); }