def _resource_stable()

in source/aws_lambda/shared/notifiers/base.py [0:0]


    def _resource_stable(self, resource: Resource, result: Dict) -> bool:
        """
        Check whether the resource has stabilized and should trigger notification
        :param resource: the Resource
        :param result: the resource as returned from the SDK
        :return: bool
        """
        last_updated = self.get_resource_last_updated(resource, result)
        created = self.get_resource_created(resource, result)
        status = self.get_resource_status(resource, result)
        latest_campaign_update = self.get_resource_latest_campaign_update(
            resource, result
        )

        if not last_updated or not created:
            logger.info(
                f"{resource.name.camel} is not ready for notification (missing lastUpdated or creation DateTime)"
            )
            return False
        elif status != ACTIVE:
            logger.info(f"{resource.name.camel} is not yet {ACTIVE}")
            return False
        elif (
            resource.name.camel == "campaign"
            and latest_campaign_update
            and latest_campaign_update.get("status") != ACTIVE
        ):
            logger.info(f"{resource.name.camel} is updating, and not yet active")
            return False
        elif not self.cutoff:
            logger.debug(
                f"{resource.name.camel} has no cutoff specified for notification"
            )
            return False
        elif last_updated <= self.cutoff:
            logger.info(f"{resource.name.camel} does not require update at this time")
            return False
        else:
            logger.info(f"{resource.name.camel} is ready for notification")
            return True