def get_all_members_leader_first(cluster: Cluster) -> Iterator[Member]:
    """Get all cluster members, with the cluster leader being yielded first.

    .. note::
        Only yield members that have a ``restapi.connect_address`` configured.

    :yields: all cluster members, with the leader first.
    """
    leader_name = cluster.leader.member.name if cluster.leader and cluster.leader.member.api_url else None
    if leader_name and cluster.leader:
        yield cluster.leader.member
    for member in cluster.members:
        if member.api_url and member.name != leader_name:
            yield member
Get all cluster members, with the cluster leader being yielded first.

    .. note::
        Only yield members that have a ``restapi.connect_address`` configured.

    :yields: all cluster members, with the leader first.
    
patroni/ctl.py