public ProgressEvent handleRequest()

in aws-wafv2-webaclassociation/src/main/java/com/amazonaws/wafv2/webaclassociation/DeleteHandler.java [31:67]


    public ProgressEvent<ResourceModel, CallbackContext> handleRequest(
            final AmazonWebServicesClientProxy proxy,
            final ResourceHandlerRequest<ResourceModel> request,
            final CallbackContext callbackContext,
            final Logger logger) {

        final ResourceModel model = request.getDesiredResourceState();
        log(logger, model, "invoked");
        try {
            Optional<WebACL> associatedWebACL = getAssociatedWebACL(proxy, model);
            // https://t.corp.amazon.com/V209544621 make sure webACL arn from model matches associated
            if (!associatedWebACL.isPresent()) {
                log(logger, model, "No WebACL is associated, disassociate will not be called");
            }
            else if (!associatedWebACL.get().arn().equals(model.getWebACLArn())) {
                String msg = String.format("Associated WebACL %s doesn't match the one from request, disassociate will "
                                + "not be called", associatedWebACL.get().arn());
                log(logger, model, msg);
            }
            else {
                // associated webACL is present and matches the one on the model
                disassociateWebACLExceptionWrapper(proxy, model).execute();
                log(logger, model, "deleted successfully");
            }
            return ProgressEvent.<ResourceModel, CallbackContext>builder()
                    .status(OperationStatus.SUCCESS)
                    .build();
        } catch (RuntimeException e) {
            log(logger, model, String.format("[%s]: %s",  e.getClass().getSimpleName(), e.getMessage()));
            // handle error code
            return ProgressEvent.<ResourceModel, CallbackContext>builder()
                    .status(OperationStatus.FAILED)
                    .errorCode(ExceptionTranslationWrapper.translateExceptionIntoErrorCode(e))
                    .message(e.getMessage())
                    .build();
        }
    }