def delete_all_rules()

in src/core/fraud_detector_undeploy.py [0:0]


    def delete_all_rules(self, detector_name):
        next_token = ""
        paginate = True
        while paginate:

            response = self.client.get_rules(
                detectorId=detector_name,
                nextToken=next_token
            )

            # no rule with the given id found.
            if not response["ruleDetails"]:
                break

            # Loop through the versions within the current page
            for rule in response["ruleDetails"]:
                rule_id = rule["ruleId"]
                rule_version = rule["ruleVersion"]
                # delete detector version rules
                response = self.client.delete_rule(
                    rule={"detectorId": detector_name,
                          "ruleId": rule_id,
                          "ruleVersion": str(rule_version)
                          }
                )

            next_token = response.get("nextToken", "")
            paginate = next_token != ""