protected ProgressEvent handleRequest()

in aws-mwaa-environment/src/main/java/software/amazon/mwaa/environment/DeleteHandler.java [25:55]


    protected ProgressEvent<ResourceModel, CallbackContext> handleRequest(
            final Proxies proxies,
            final ResourceHandlerRequest<ResourceModel> request,
            final CallbackContext callbackContext) {

        final ResourceModel model = request.getDesiredResourceState();

        if (model == null) {
            return ProgressEvent.defaultSuccessHandler(null);
        }

        if (callbackContext.isStabilizing()) {
            log("callback context indicates Stabilizing mode");
            if (isEnvironmentDeleted(proxies, model)) {
                log("environment is Deleted, returning success");
                return ProgressEvent.defaultSuccessHandler(null);
            } else {
                log("environment is not Deleted, requesting a callback in {}", CALLBACK_DELAY);
                return ProgressEvent.<ResourceModel, CallbackContext>builder()
                        .resourceModel(model)
                        .callbackContext(callbackContext)
                        .callbackDelaySeconds((int) CALLBACK_DELAY.getSeconds())
                        .status(OperationStatus.IN_PROGRESS)
                        .build();
            }
        }

        return ProgressEvent.progress(model, callbackContext)
                .then(progress -> ensureEnvironmentExists(proxies, progress))
                .then(progress -> startDeleteTask(proxies, progress, callbackContext));
    }