class Aws::EC2Metadata

def resolve_endpoint(endpoint, endpoint_mode)

def resolve_endpoint(endpoint, endpoint_mode)
  return endpoint if endpoint
  case endpoint_mode.downcase
  when 'ipv4' then 'http://169.254.169.254'
  when 'ipv6' then 'http://[fd00:ec2::254]'
  else
    raise ArgumentError,
          ':endpoint_mode is not valid, expected IPv4 or IPv6, '\
          "got: #{endpoint_mode}"
  end
end