in src/core/fraud_detector_utils.py [0:0]
def _get_max_rule_version(self, detector_name, rule_id):
max_version = 0
next_token = ""
paginate = True
while paginate:
response = self.fraud_detector_client.get_rules(
ruleId=rule_id,
detectorId=detector_name,
nextToken=next_token
)
# no rule with the given id found.
if not response["ruleDetails"]:
return None
# Loop through the versions within the current page
for rule in response["ruleDetails"]:
version_no = float(rule["ruleVersion"])
if version_no > max_version:
max_version = version_no
next_token = response.get("nextToken", "")
paginate = next_token != ""
return max_version