import textwrap


def AddressArgHelp(include_l7_internal_load_balancing):
  """Build the help text for the address argument."""

  lb_schemes = '(EXTERNAL, INTERNAL, INTERNAL_MANAGED'
  if include_l7_internal_load_balancing:
    lb_schemes += ', INTERNAL_MANAGED'
  lb_schemes += ')'

  detailed_help = """\
    IP address that the forwarding rule will serve. All
    traffic sent to this IP address is directed to the target
    pointed to by the forwarding rule. Assigned IP addresses can be
    reserved or unreserved.

    IP addresses are restricted based on the forwarding rule's load balancing
    scheme (%s) and scope (global or regional).

    When the --load-balancing-scheme is EXTERNAL, if the address is reserved,
    it must either (1) reside in the global scope if the forwarding rule is
    being configured to point to a global target (target HTTP proxy, target
    HTTPS proxy, target SSL proxy and target TCP proxy) or (2) reside in the
    same region as the forwarding rule if the forwarding rule is being
    configured to point to a regional target (target pool) or zonal target
    (target instance). If this flag is omitted, an ephemeral external IP
    address is automatically assigned.

    When the --load-balancing-scheme is INTERNAL or INTERNAL_MANAGED, this can
    only be an RFC 1918 IP address belonging to the network/subnet configured
    for the forwarding rule. If this flag is omitted, an ephemeral internal IP
    address will be automatically allocated from the IP range of the subnet or
    network configured for this forwarding rule.

    When the --load-balancing-scheme is INTERNAL_SELF_MANAGED, this must
    be a URL reference to an existing Address resource.

    Note: An IP address must be specified if the traffic is being forwarded to
    a VPN.

    This flag can be specified either by a literal IP address or a reference
    to an existing Address resource. The following examples are all valid:
    - 100.1.2.3
    - https://www.googleapis.com/compute/v1/projects/project-1/regions/us-central1/addresses/address-1
    - projects/project-1/regions/us-central1/addresses/address-1
    - regions/us-central1/addresses/address-1
    - global/addresses/address-1
    - address-1
  """ % (
      lb_schemes)

  return textwrap.dedent(detailed_help)