private ProgressEvent handleCanaryInStateRunning()

in aws-synthetics-canary/src/main/java/com/amazon/synthetics/canary/DeleteHandler.java [47:60]


    private ProgressEvent<ResourceModel, CallbackContext> handleCanaryInStateRunning(Canary canary) {
        String message = "Canary is in state RUNNING. It must be stopped before it can be deleted.";
        try {
            // Handle race condition where an external process calls StopCanary before we do.
            proxy.injectCredentialsAndInvokeV2(
                StopCanaryRequest.builder()
                    .name(canary.name())
                    .build(),
                syntheticsClient::stopCanary);
        } catch (ConflictException e) {
            log("Caught ConflictException when trying to stop canary.");
        }
        return waitingForCanaryStateTransition(message, MAX_RETRY_TIMES, "RUNNING");
    }