private Boolean isStabilized()

in aws-events-connection/src/main/java/software/amazon/events/connection/CreateHandler.java [87:108]


    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 CREATING:
            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] create has stabilized: %s. Connection state: %s", ResourceModel.TYPE_NAME, model.getPrimaryIdentifier(), stabilized, state.toString()));
        return stabilized;
    }