Exemple #1
0
    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);
            }
        }
    }
Exemple #2
0
 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));
 }