private static async Task <StorageAccountItem> FindStorageAccountAsync( ManagedStorageRestClient storageClient, string storageAccountName) { for (StorageListResult result = await storageClient.GetStorageAccountsAsync(cancellationToken: s_cancellationTokenSource.Token); ; result = await storageClient.GetStorageAccountsNextPageAsync(result.NextLink, cancellationToken: s_cancellationTokenSource.Token)) { foreach (StorageAccountItem storageAccount in result.Value) { // The storage account name is the segment of the ResourceId. int pos = storageAccount.ResourceId.AsSpan().TrimEnd('/').LastIndexOf('/'); string name = storageAccount.ResourceId.Substring(pos + 1); if (string.Equals(storageAccountName, name, StringComparison.InvariantCultureIgnoreCase)) { return(storageAccount); } } if (result.NextLink is null) { // No more results. return(null); } } }
public static IStorageListResult ToAbstract(this StorageListResult @this) { return(new StorageListResultWrapper(@this)); }
public StorageListResultWrapper(StorageListResult storageListResult) { _wrapped = storageListResult; }
public ListResultWrapper(StorageListResult storageListResult) { _storageListResult = storageListResult ?? throw new ArgumentNullException(nameof(storageListResult)); }