private Boolean isStabilized()

in aws-events-connection/src/main/java/software/amazon/events/connection/UpdateHandler.java [73:94]


    private Boolean isStabilized(ProxyClient<EventBridgeClient> proxyClient, ResourceModel model) {
        DescribeConnectionResponse describeConnectionResponse = Utils.readResource(Translator.translateToReadRequest(model), proxyClient);
        final ConnectionState state = describeConnectionResponse.connectionState();

        boolean stabilized;
        switch (state) {
            case AUTHORIZED:
                stabilized =  true;
                break;
            case UPDATING:
            case AUTHORIZING:
            case DEAUTHORIZING:
                stabilized = false;
                break;
            default:
                throw new CfnGeneralServiceException(String.format("Couldn't stabilize %s [%s] due to connection state: %s",
                        ResourceModel.TYPE_NAME, model.getPrimaryIdentifier(), describeConnectionResponse.stateReason()));
        }

        logger.log(String.format("%s [%s] update has stabilized: %s. Connection state: %s", ResourceModel.TYPE_NAME, model.getPrimaryIdentifier(), stabilized, state.toString()));
        return stabilized;
    }