def create_config_switch_operation(self, barman_server: str,
                                       barman_model: Optional[str],
                                       reset: Optional[bool]) -> str:
        """Create a config switch operation on the ``pg-backup-api``.

        :param barman_server: name of the Barman server which config is to be
            switched.
        :param barman_model: name of the Barman model to be applied to the
            server, if any.
        :param reset: ``True`` if you would like to unapply the currently active
            model for the server, if any.

        :returns: the ID of the config switch operation that has been created.
        """
        body: Dict[str, Any] = {"type": "config_switch"}

        if barman_model:
            body["model_name"] = barman_model
        elif reset:
            body["reset"] = reset

        response = self._post_request(
            f"servers/{barman_server}/operations",
            body,
        )

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

        :param barman_server: name of the Barman server which config is to be
            switched.
        :param barman_model: name of the Barman model to be applied to the
            server, if any.
        :param reset: ``True`` if you would like to unapply the currently active
            model for the server, if any.

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