Пример #1
0
        public async Task <string> CreateValidAccountNameAsync(string prefix)
        {
            string accountName = prefix;

            for (int i = 0; i < 10; i++)
            {
                accountName = Recording.GenerateAssetName(prefix);
                StorageAccountCheckNameAvailabilityContent parameter = new StorageAccountCheckNameAvailabilityContent(accountName);
                CheckNameAvailabilityResult result = await DefaultSubscription.CheckStorageAccountNameAvailabilityAsync(parameter);

                if (result.NameAvailable == true)
                {
                    return(accountName);
                }
            }
            return(accountName);
        }
 public virtual Response <CheckNameAvailabilityResult> CheckStorageAccountNameAvailability(StorageAccountCheckNameAvailabilityContent content, CancellationToken cancellationToken = default)
 {
     using var scope = StorageAccountClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckStorageAccountNameAvailability");
     scope.Start();
     try
     {
         var response = StorageAccountRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken);
         return(response);
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Пример #3
0
        public static Response <CheckNameAvailabilityResult> CheckStorageAccountNameAvailability(this SubscriptionResource subscriptionResource, StorageAccountCheckNameAvailabilityContent content, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(content, nameof(content));

            return(GetExtensionClient(subscriptionResource).CheckStorageAccountNameAvailability(content, cancellationToken));
        }
Пример #4
0
        public static async Task <Response <CheckNameAvailabilityResult> > CheckStorageAccountNameAvailabilityAsync(this SubscriptionResource subscriptionResource, StorageAccountCheckNameAvailabilityContent content, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNull(content, nameof(content));

            return(await GetExtensionClient(subscriptionResource).CheckStorageAccountNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false));
        }