def run_barman_recover(api: "PgBackupApi", args: Namespace) -> int:
    """Run a remote ``barman recover`` through the ``pg-backup-api``.

    :param api: a :class:`PgBackupApi` instance to handle communication with
        the API.
    :param args: arguments received from the command-line of
        ``patroni_barman recover`` command.

    :returns: the return code to be used when exiting the ``patroni_barman``
        application. Refer to :class:`ExitCode`.
    """
    return _restore_backup(api, args.barman_server, args.backup_id,
                           args.ssh_command, args.data_directory,
                           args.loop_wait)
Run a remote ``barman recover`` through the ``pg-backup-api``.

    :param api: a :class:`PgBackupApi` instance to handle communication with
        the API.
    :param args: arguments received from the command-line of
        ``patroni_barman recover`` command.

    :returns: the return code to be used when exiting the ``patroni_barman``
        application. Refer to :class:`ExitCode`.
    
patroni/scripts/barman/recover.py