def _check_agent_config_ready()

in connectors/agent/connector_record_manager.py [0:0]


    def _check_agent_config_ready(self, agent_config):
        """
        Validates the agent configuration to check if all info is present to create a connector record.

        Returns:
            tuple: (bool, str or None) - True and None if valid, otherwise False and an error message.
        """

        connectors = agent_config.get("connectors")
        if connectors is None:
            return False, "No 'connectors' key found in the service configuration."

        if len(connectors) == 0:
            return False, "Empty 'connectors' array found in the service configuration."

        for connector in connectors:
            if "connector_id" not in connector:
                return (
                    False,
                    "No 'connector_id' key found in the connector object.",
                )

            if "service_type" not in connector:
                return (
                    False,
                    "No 'service_type' key found in the connector object.",
                )

        elasticsearch_config = agent_config.get("elasticsearch")
        if not elasticsearch_config:
            return False, "No 'elasticsearch' key found in the service configuration."

        if "host" not in elasticsearch_config:
            return False, "No 'host' key found in the elasticsearch configuration."

        if "api_key" not in elasticsearch_config:
            return False, "No 'api_key' key found in the elasticsearch configuration."

        return True, None