/// <summary>
 /// Create or update a Traffic Manager endpoint.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.TrafficManager.IEndpointOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group containing the Traffic
 /// Manager endpoint to be created or updated.
 /// </param>
 /// <param name='profileName'>
 /// Required. The name of the Traffic Manager endpoint to be created or
 /// updated.
 /// </param>
 /// <param name='endpointType'>
 /// Required. The type of the Traffic Manager endpoint to be created or
 /// updated.
 /// </param>
 /// <param name='endpointName'>
 /// Required. The name of the Traffic Manager endpoint to be created or
 /// updated.
 /// </param>
 /// <param name='parameters'>
 /// Required. The Traffic Manager endpoint parameters supplied to the
 /// CreateOrUpdate operation.
 /// </param>
 /// <returns>
 /// The response to a Traffic Manager endpoint 'CreateOrUpdate'
 /// operation.
 /// </returns>
 public static EndpointCreateOrUpdateResponse CreateOrUpdate(this IEndpointOperations operations, string resourceGroupName, string profileName, string endpointType, string endpointName, EndpointCreateOrUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IEndpointOperations)s).CreateOrUpdateAsync(resourceGroupName, profileName, endpointType, endpointName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
        public TrafficManagerEndpoint SetTrafficManagerEndpoint(TrafficManagerEndpoint endpoint)
        {
            var parameters = new EndpointCreateOrUpdateParameters
            {
                Endpoint = endpoint.ToSDKEndpoint()
            };

            EndpointCreateOrUpdateResponse response = this.TrafficManagerManagementClient.Endpoints.CreateOrUpdate(
                endpoint.ResourceGroupName,
                endpoint.ProfileName,
                endpoint.Type,
                endpoint.Name,
                parameters);

            return TrafficManagerClient.GetPowershellTrafficManagerEndpoint(
                endpoint.Id,
                endpoint.ResourceGroupName, 
                endpoint.ProfileName,
                endpoint.Type, 
                endpoint.Name, 
                response.Endpoint.Properties);
        }
 /// <summary>
 /// Create or update a Traffic Manager endpoint.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.TrafficManager.IEndpointOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The name of the resource group containing the Traffic
 /// Manager endpoint to be created or updated.
 /// </param>
 /// <param name='profileName'>
 /// Required. The name of the Traffic Manager endpoint to be created or
 /// updated.
 /// </param>
 /// <param name='endpointType'>
 /// Required. The type of the Traffic Manager endpoint to be created or
 /// updated.
 /// </param>
 /// <param name='endpointName'>
 /// Required. The name of the Traffic Manager endpoint to be created or
 /// updated.
 /// </param>
 /// <param name='parameters'>
 /// Required. The Traffic Manager endpoint parameters supplied to the
 /// CreateOrUpdate operation.
 /// </param>
 /// <returns>
 /// The response to a Traffic Manager endpoint 'CreateOrUpdate'
 /// operation.
 /// </returns>
 public static Task<EndpointCreateOrUpdateResponse> CreateOrUpdateAsync(this IEndpointOperations operations, string resourceGroupName, string profileName, string endpointType, string endpointName, EndpointCreateOrUpdateParameters parameters)
 {
     return operations.CreateOrUpdateAsync(resourceGroupName, profileName, endpointType, endpointName, parameters, CancellationToken.None);
 }