private boolean isStabilized()

in aws-route53recoverycontrol-safetyrule/src/main/java/software/amazon/route53recoverycontrol/safetyrule/DeleteHandler.java [81:112]


    private boolean isStabilized(
            DeleteSafetyRuleRequest deleteRequest,
            DeleteSafetyRuleResponse deleteResponse,
            ProxyClient<Route53RecoveryControlConfigClient> proxyClient,
            ResourceModel model,
            CallbackContext context
    ) {
        boolean isAssertion = model.getAssertionRule() != null;

        String safetyRuleArn = model.getSafetyRuleArn();

        DescribeSafetyRuleResponse response;

        try{
            response = getSafetyRule(DescribeSafetyRuleRequest.builder()
                    .safetyRuleArn(safetyRuleArn).build(), proxyClient);
        } catch (CfnNotFoundException e) {
            logger.log(String.format("%s has stabilized.", ResourceModel.TYPE_NAME));
            return true;
        }

        if (response != null) {
            String status = isAssertion ? response.assertionRule().statusAsString() :
                    response.gatingRule().statusAsString();
            if (status.equals("PENDING_DELETION")) {
                logger.log(String.format("%s has not yet stabilized.", ResourceModel.TYPE_NAME));
            } else {
                logger.log(String.format("%s was not successfully marked for deletion.", ResourceModel.TYPE_NAME));
            }
        }
        return false;
    }