/// <summary> /// Update a Traffic Manager profile. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.TrafficManager.IProfileOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group containing the Traffic /// Manager profile. /// </param> /// <param name='profileName'> /// Required. The name of the Traffic Manager profile. /// </param> /// <param name='parameters'> /// Required. The Traffic Manager profile parameters supplied to the /// Update operation. /// </param> /// <returns> /// Parameters supplied to update a Traffic Manager profile. /// </returns> public static Task<ProfileUpdateResponse> UpdateAsync(this IProfileOperations operations, string resourceGroupName, string profileName, ProfileUpdateParameters parameters) { return operations.UpdateAsync(resourceGroupName, profileName, parameters, CancellationToken.None); }
public bool EnableDisableTrafficManagerProfile(TrafficManagerProfile profile, bool shouldEnableProfileStatus) { profile.ProfileStatus = shouldEnableProfileStatus ? Constants.StatusEnabled : Constants.StatusDisabled; Profile sdkProfile = profile.ToSDKProfile(); sdkProfile.Properties.DnsConfig = null; sdkProfile.Properties.Endpoints = null; sdkProfile.Properties.TrafficRoutingMethod = null; sdkProfile.Properties.MonitorConfig = null; var parameters = new ProfileUpdateParameters { Profile = sdkProfile }; AzureOperationResponse response = this.TrafficManagerManagementClient.Profiles.Update(profile.ResourceGroupName, profile.Name, parameters); return response.StatusCode.Equals(HttpStatusCode.OK); }
/// <summary> /// Update a Traffic Manager profile. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.TrafficManager.IProfileOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group containing the Traffic /// Manager profile. /// </param> /// <param name='profileName'> /// Required. The name of the Traffic Manager profile. /// </param> /// <param name='parameters'> /// Required. The Traffic Manager profile parameters supplied to the /// Update operation. /// </param> /// <returns> /// Parameters supplied to update a Traffic Manager profile. /// </returns> public static ProfileUpdateResponse Update(this IProfileOperations operations, string resourceGroupName, string profileName, ProfileUpdateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IProfileOperations)s).UpdateAsync(resourceGroupName, profileName, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }