private ProgressEvent checkForPreDeleteResourceExistence()

in aws-devopsguru-notificationchannel/src/main/java/software/amazon/devopsguru/notificationchannel/DeleteHandler.java [85:100]


    private ProgressEvent<ResourceModel, CallbackContext> checkForPreDeleteResourceExistence(
            final ResourceHandlerRequest<ResourceModel> request,
            final ProgressEvent<ResourceModel, CallbackContext> progressEvent,
            final ProxyClient<DevOpsGuruClient> proxyClient) {
        final ResourceModel model = progressEvent.getResourceModel();
        final CallbackContext callbackContext = progressEvent.getCallbackContext();

        ListNotificationChannelsResponse listNotificationChannelsResponse = listNotificationChannel(Translator.translateToListNotificationChannelRequest(model), proxyClient);
        for (NotificationChannel channel : listNotificationChannelsResponse.channels()) {
            if (channel.id().equals(model.getId())) {
                return ProgressEvent.progress(model, callbackContext);
            }
        }

        throw new CfnNotFoundException(ResourceModel.TYPE_NAME, model.getId());
    }