fun waitForSynchronizedStep()

in aws-globalaccelerator-accelerator/src/main/kotlin/software/amazon/globalaccelerator/accelerator/HandlerCommons.kt [25:43]


    fun waitForSynchronizedStep(context: CallbackContext, model: ResourceModel, proxy: AmazonWebServicesClientProxy, agaClient: AWSGlobalAccelerator, logger: Logger):
            ProgressEvent<ResourceModel, CallbackContext?> {

        logger.debug("Waiting for accelerator to be deployed with arn: [${model.acceleratorArn}]. " +
                "Stabilization retries remaining ${context.stabilizationRetriesRemaining}")

        val newCallbackContext = context.copy(stabilizationRetriesRemaining = context.stabilizationRetriesRemaining - 1)
        if (newCallbackContext.stabilizationRetriesRemaining < 0) {
            throw RuntimeException(TIMED_OUT_MESSAGE)
        }

        val accelerator = getAccelerator(model.acceleratorArn, proxy, agaClient, logger)
        return if (accelerator!!.status == AcceleratorStatus.DEPLOYED.toString()) {
            logger.debug("Accelerator with arn: [${accelerator.acceleratorArn}] is deployed.")
            ProgressEvent.defaultSuccessHandler(model)
        } else {
            ProgressEvent.defaultInProgressHandler(newCallbackContext, CALLBACK_DELAY_IN_SECONDS, model)
        }
    }