sdk/dotnet/src/Microsoft.Datasync.Client/Utils/Arguments.cs
/// <summary>
/// Returns if the parameter is a valid endpoint for a Datasync service.
/// </summary>
/// <remarks>
/// A valid endpoint is a HTTP endpoint (when using a loopback address) or
/// an absolute HTTP URI.
/// </remarks>
/// <param name="endpoint">The endpoint to validate.</param>
/// <param name="paramName">The parameter name.</param>
/// <exception cref="ArgumentNullException">if the endpoint is null.</exception>
/// <exception cref="UriFormatException">if the endpoint is not valid.</exception>
Returns if the parameter is a valid endpoint for a Datasync service.
Returns if the parameter is a valid endpoint for a Datasync service .
public static void IsValidEndpoint(Uri endpoint, string paramName)
        {
            IsNotNull(endpoint, paramName);
            if (!endpoint.IsAbsoluteUri)
            {
                throw new UriFormatException($"'{paramName}' must use an absolute URI");
            }
            if (endpoint.Scheme.Equals("http", StringComparison.InvariantCultureIgnoreCase))
            {
                if (!endpoint.IsLoopback)
                {
                    throw new UriFormatException($"'{paramName}' must use secure (https) endpoint when not loopback");
                }
            }
            else if (!endpoint.Scheme.Equals("https", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new UriFormatException($"'{paramName}' must use HTTP protocol");
            }
        }
public static void IsValidEndpoint ( Uri endpoint , string paramName ) { IsNotNull ( endpoint , paramName ) ; if ( ! endpoint . IsAbsoluteUri ) { throw new UriFormatException ( $" ' { paramName } ' must use an absolute URI " ) ; } if ( endpoint . Scheme . Equals ( " " , StringComparison . InvariantCultureIgnoreCase ) ) { if ( ! endpoint . IsLoopback ) { throw new UriFormatException ( $" ' { paramName } ' must use secure (https) endpoint when not loopback " ) ; } } else if ( ! endpoint . Scheme . Equals ( " " , StringComparison . InvariantCultureIgnoreCase ) ) { throw new UriFormatException ( $" ' { paramName } ' must use HTTP protocol " ) ; } }
Returns if the parameter is a valid endpoint for a Datasync service.
Returns if the parameter is a valid endpoint for a Datasync service .
if the endpoint is null.
if the endpoint is null .
if the endpoint is not valid.
if the endpoint is not valid .
endpoint
Uri
The endpoint to validate.
The endpoint to validate .
paramName
string
The parameter name.
The parameter name .
remarks
A valid endpoint is a HTTP endpoint (when using a loopback address) or
an absolute HTTP URI.
A valid endpoint is a HTTP endpoint ( when using a loopback address ) or an absolute HTTP URI .