def validate_configuration()

in Solutions/Fortinet FortiNDR Cloud/Data Connectors/fortinetFortiNdrCloudDataConn/OrchestratorWatchdog/__init__.py [0:0]


def validate_configuration():
    if EVENT_TYPES and not SUPPORTED_EVENT_TYPES.issuperset(EVENT_TYPES):
        raise InputError(
            f"FncEvents must be one or more of {SUPPORTED_EVENT_TYPES}")

    sentinel_shared_key = (os.environ.get("WorkspaceKey") or "").strip()
    if not sentinel_shared_key:
        raise InputError("WorkspaceKey is required.")

    if INTERVAL is None or INTERVAL < 1 or INTERVAL > 60:
        raise InputError("FncIntervalMinutes must be a number 1-60")

    if DAYS_TO_COLLECT_EVENTS and (
        DAYS_TO_COLLECT_EVENTS < 0 or DAYS_TO_COLLECT_EVENTS > 7
    ):
        raise InputError("FncDaysToCollectEvents must be a number 0-7")

    if "detections" in EVENT_TYPES and API_TOKEN is None:
        raise InputError("FncApiToken must be provided to fetch detections")

    if "suricata" in EVENT_TYPES or "observation" in EVENT_TYPES:
        if not AWS_ACCESS_KEY or not AWS_SECRET_KEY or not ACCOUNT_CODE:
            raise InputError(
                "AwsAccessKeyId, AwsSecretAccessKey, and FncAccountCode are required to pull Suricata and Observation."
            )