public async Task CheckNameAvailability() { await foreach (var tenant in Client.GetTenants().GetAllAsync()) { SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); string cdnEndpointName = Recording.GenerateAssetName("endpoint-"); CdnNameAvailabilityContent checkNameAvailabilityInput = new CdnNameAvailabilityContent(cdnEndpointName, CdnResourceType.Endpoints); CdnNameAvailabilityResult checkNameAvailabilityOutput = await tenant.CheckCdnNameAvailabilityAsync(checkNameAvailabilityInput); Assert.True(checkNameAvailabilityOutput.NameAvailable); ResourceGroupResource rg = await CreateResourceGroup(subscription, "testRg-"); string cdnProfileName = Recording.GenerateAssetName("profile-"); ProfileResource cdnProfile = await CreateCdnProfile(rg, cdnProfileName, CdnSkuName.StandardMicrosoft); cdnEndpointName = Recording.GenerateAssetName("endpoint-"); CdnEndpointResource cdnEndpoint = await CreateCdnEndpoint(cdnProfile, cdnEndpointName); CdnNameAvailabilityContent checkNameAvailabilityInput2 = new CdnNameAvailabilityContent(cdnEndpoint.Data.Name, CdnResourceType.Endpoints); checkNameAvailabilityOutput = await tenant.CheckCdnNameAvailabilityAsync(checkNameAvailabilityInput2); Assert.False(checkNameAvailabilityOutput.NameAvailable); } }
public virtual Response <CdnNameAvailabilityResult> CheckCdnNameAvailability(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) { using var scope = DefaultClientDiagnostics.CreateScope("TenantResourceExtensionClient.CheckCdnNameAvailability"); scope.Start(); try { var response = DefaultRestClient.CheckNameAvailability(content, cancellationToken); return(response); } catch (Exception e) { scope.Failed(e); throw; } }
public static Response <CdnNameAvailabilityResult> CheckCdnNameAvailability(this TenantResource tenantResource, CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); return(GetExtensionClient(tenantResource).CheckCdnNameAvailability(content, cancellationToken)); }
public static async Task <Response <CdnNameAvailabilityResult> > CheckCdnNameAvailabilityAsync(this TenantResource tenantResource, CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); return(await GetExtensionClient(tenantResource).CheckCdnNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false)); }
public virtual async Task <Response <CdnNameAvailabilityResult> > CheckCdnNameAvailabilityWithSubscriptionAsync(CdnNameAvailabilityContent content, CancellationToken cancellationToken = default) { using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckCdnNameAvailabilityWithSubscription"); scope.Start(); try { var response = await DefaultRestClient.CheckNameAvailabilityWithSubscriptionAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); return(response); } catch (Exception e) { scope.Failed(e); throw; } }