/// <summary> /// Create or update a Traffic Manager endpoint. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.TrafficManager.IProfileOperations. /// </param> /// <param name='parameters'> /// Required. The Traffic Manager name parameters supplied to the /// CheckTrafficManagerNameAvailability operation. /// </param> /// <returns> /// The response to a 'CheckTrafficManagerNameAvailability' operation. /// </returns> public static CheckTrafficManagerRelativeDnsNameAvailabilityResponse CheckTrafficManagerRelativeDnsNameAvailability(this IProfileOperations operations, CheckTrafficManagerRelativeDnsNameAvailabilityParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IProfileOperations)s).CheckTrafficManagerRelativeDnsNameAvailabilityAsync(parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Create or update a Traffic Manager endpoint. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.TrafficManager.IProfileOperations. /// </param> /// <param name='parameters'> /// Required. The Traffic Manager name parameters supplied to the /// CheckTrafficManagerNameAvailability operation. /// </param> /// <returns> /// The response to a 'CheckTrafficManagerNameAvailability' operation. /// </returns> public static Task<CheckTrafficManagerRelativeDnsNameAvailabilityResponse> CheckTrafficManagerRelativeDnsNameAvailabilityAsync(this IProfileOperations operations, CheckTrafficManagerRelativeDnsNameAvailabilityParameters parameters) { return operations.CheckTrafficManagerRelativeDnsNameAvailabilityAsync(parameters, CancellationToken.None); }
public void NameAvailabilityTest_NameNotAvailable() { using (UndoContext context = UndoContext.Current) { context.Start(); TrafficManagerManagementClient trafficManagerClient = TrafficManagerHelper.GetTrafficManagerClient(); string relativeName = TestUtilities.GenerateName("hydratestrelativename"); string profileName = TestUtilities.GenerateName("hydratestwatmv2profile"); ResourceGroupExtended resourceGroup = TrafficManagerHelper.CreateResourceGroup(); // Create the profile trafficManagerClient.Profiles.CreateOrUpdate( resourceGroup.Name, profileName, new ProfileCreateOrUpdateParameters { Profile = TrafficManagerHelper.GenerateDefaultProfile(profileName, relativeName) }); var parameters = new CheckTrafficManagerRelativeDnsNameAvailabilityParameters { Name = relativeName, Type = "microsoft.network/trafficmanagerprofiles" }; CheckTrafficManagerRelativeDnsNameAvailabilityResponse response = trafficManagerClient.Profiles.CheckTrafficManagerRelativeDnsNameAvailability(parameters); Assert.False(response.NameAvailable); } }
public void NameAvailabilityTest_NameAvailable() { using (UndoContext context = UndoContext.Current) { context.Start(); TrafficManagerManagementClient trafficManagerClient = TrafficManagerHelper.GetTrafficManagerClient(); string relativeName = TestUtilities.GenerateName("hydratestrelativename"); var parameters = new CheckTrafficManagerRelativeDnsNameAvailabilityParameters { Name = relativeName, Type = "microsoft.network/trafficmanagerprofiles" }; CheckTrafficManagerRelativeDnsNameAvailabilityResponse response = trafficManagerClient.Profiles.CheckTrafficManagerRelativeDnsNameAvailability(parameters); Assert.True(response.NameAvailable); } }