def confirm_members_action(members: List[Member], force: bool, action: str,
                           scheduled_at: Optional[datetime.datetime] = None, pending: Optional[bool] = None) -> None:
    """Ask for confirmation if *action* should be taken by *members*.

    :param members: list of member which will take the *action*.
    :param force: if ``True`` skip the confirmation prompt and allow the *action* to proceed.
    :param action: the action that is being processed, one among:

        * ``reload``: reload PostgreSQL configuration; or
        * ``restart``: restart PostgreSQL; or
        * ``reinitialize``: reinitialize PostgreSQL data directory; or
        * ``flush``: discard scheduled actions.
    :param scheduled_at: timestamp at which the *action* should be scheduled to. If ``None``  *action* is taken
        immediately.

    :raises:
        :class:`PatroniCtlException`: if the user aborted the *action*.
    """
    if scheduled_at:
        if not force:
            if pending:
                confirm = click.confirm('The nodes needing a restart will be identified at the scheduled time, and '
                                        'might be different from the ones showing pending restart right now. '
                                        'Is this fine?')
            else:
                confirm = click.confirm('Are you sure you want to schedule {0} of members {1} at {2}?'
                                        .format(action, ', '.join([m.name for m in members]), scheduled_at))
            if not confirm:
                raise PatroniCtlException('Aborted scheduled {0}'.format(action))
    else:
        if not force:
            confirm = click.confirm('Are you sure you want to {0} members {1}?'
                                    .format(action, ', '.join([m.name for m in members])))
            if not confirm:
                raise PatroniCtlException('Aborted {0}'.format(action))
Ask for confirmation if *action* should be taken by *members*.

    :param members: list of member which will take the *action*.
    :param force: if ``True`` skip the confirmation prompt and allow the *action* to proceed.
    :param action: the action that is being processed, one among:

        * ``reload``: reload PostgreSQL configuration; or
        * ``restart``: restart PostgreSQL; or
        * ``reinitialize``: reinitialize PostgreSQL data directory; or
        * ``flush``: discard scheduled actions.
    :param scheduled_at: timestamp at which the *action* should be scheduled to. If ``None``  *action* is taken
        immediately.

    :raises:
        :class:`PatroniCtlException`: if the user aborted the *action*.
    
patroni/ctl.py