def create_recovery_operation(self, barman_server: str, backup_id: str,
                                  ssh_command: str, data_directory: str) -> str:
        """Create a recovery operation on the ``pg-backup-api``.

        :param barman_server: name of the Barman server which backup is to be
            restored.
        :param backup_id: ID of the backup from the Barman server.
        :param ssh_command: SSH command to connect from the Barman host to the
            target host.
        :param data_directory: path to the Postgres data directory where to
            restore the backup at.

        :returns: the ID of the recovery operation that has been created.
        """
        response = self._post_request(
            f"servers/{barman_server}/operations",
            {
                "type": "recovery",
                "backup_id": backup_id,
                "remote_ssh_command": ssh_command,
                "destination_directory": data_directory,
            },
        )

        return response["operation_id"]
Create a recovery operation on the ``pg-backup-api``.

        :param barman_server: name of the Barman server which backup is to be
            restored.
        :param backup_id: ID of the backup from the Barman server.
        :param ssh_command: SSH command to connect from the Barman host to the
            target host.
        :param data_directory: path to the Postgres data directory where to
            restore the backup at.

        :returns: the ID of the recovery operation that has been created.
        
patroni/scripts/barman/utils.py