/// <summary> /// Check the availability of a resource name without creating the resource. /// This is needed for resources where name is globally unique, such as a CDN /// endpoint. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='name'> /// The resource name to validate. /// </param> /// <param name='type'> /// The type of the resource whose name is to be validated. Possible values /// include: 'Microsoft.Cdn/Profiles/Endpoints' /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <CheckNameAvailabilityOutput> CheckNameAvailabilityAsync(this INameAvailabilityOperations operations, string name, ResourceType type, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(name, type, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Check the availability of a resource name without creating the resource. /// This is needed for resources where name is globally unique, such as a CDN /// endpoint. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='name'> /// The resource name to validate. /// </param> /// <param name='type'> /// The type of the resource whose name is to be validated. Possible values /// include: 'Microsoft.Cdn/Profiles/Endpoints' /// </param> public static CheckNameAvailabilityOutput CheckNameAvailability(this INameAvailabilityOperations operations, string name, ResourceType type) { return(Task.Factory.StartNew(s => ((INameAvailabilityOperations)s).CheckNameAvailabilityAsync(name, type), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }