def check()

in tools/stix-to-ecs/stix_to_ecs.py [0:0]


    def check(self) -> str | None:
        if not self.index:
            return "`index` is missing"

        if self.cloud_id and self.url:
            return "`cloud_id` and `url` can't be both provided"

        if not self.cloud_id and not self.url:
            return "Neither `cloud_id` nor `url` are provided"

        if self.api_key and (self.username or self.password):
            return "`api_key` and `username` or `password` can't be both provided"

        if not self.api_key and not self.password:
            return "Neither `api_key` nor `password` are provided"

        if not self.api_key:
            for k in ("username", "password"):
                if not self.__getattribute__(k):
                    return f"`{k}` is missing"

        return None