def __init__(self, api_url: str, cert_file: Optional[str],
                 key_file: Optional[str], retry_wait: int,
                 max_retries: int) -> None:
        """Create a new instance of :class:`BarmanRecover`.

        Make sure the ``pg-backup-api`` is reachable and running fine.

        .. note::
            When using any method which send requests to the API, be aware that
            they might raise :exc:`RetriesExceeded` upon HTTP request errors.

            Similarly, when instantiating this class you may face an
            :exc:`ApiNotOk`, if the API is down or returns a bogus status.

        :param api_url: base URL to reach the ``pg-backup-api``.
        :param cert_file: certificate to authenticate against the
            ``pg-backup-api``, if required.
        :param key_file: certificate key to authenticate against the
            ``pg-backup-api``, if required.
        :param retry_wait: how long in seconds to wait before retrying a failed
            request to the ``pg-backup-api``.
        :param max_retries: maximum number of retries when ``pg-backup-api``
            returns malformed responses.
        """
        self.api_url = api_url
        self.cert_file = cert_file
        self.key_file = key_file
        self.retry_wait = retry_wait
        self.max_retries = max_retries
        self._http = PoolManager(cert_file=cert_file, key_file=key_file)
        self._ensure_api_ok()
Create a new instance of :class:`BarmanRecover`.

        Make sure the ``pg-backup-api`` is reachable and running fine.

        .. note::
            When using any method which send requests to the API, be aware that
            they might raise :exc:`RetriesExceeded` upon HTTP request errors.

            Similarly, when instantiating this class you may face an
            :exc:`ApiNotOk`, if the API is down or returns a bogus status.

        :param api_url: base URL to reach the ``pg-backup-api``.
        :param cert_file: certificate to authenticate against the
            ``pg-backup-api``, if required.
        :param key_file: certificate key to authenticate against the
            ``pg-backup-api``, if required.
        :param retry_wait: how long in seconds to wait before retrying a failed
            request to the ``pg-backup-api``.
        :param max_retries: maximum number of retries when ``pg-backup-api``
            returns malformed responses.
        
patroni/scripts/barman/utils.py