class ExternalDatabaseCreationActions {

    @Bean(name = "EXTERNAL_DATABASE_CREATION_FINISHED_STATE")
    public Action<?, ?> externalDatabaseCreationFinishedAction() {
        return new AbstractExternalDatabaseCreationAction<>(CreateExternalDatabaseResult.class) {
            @Override
            protected void doExecute(ExternalDatabaseContext context, CreateExternalDatabaseResult payload, Map<Object, Object> variables) {
                getMetricService().incrementMetricCounter(MetricType.EXTERNAL_DATABASE_CREATION_SUCCESSFUL, context.getStack());
                sendEvent(context);
            }

            @Override
            protected Selectable createRequest(ExternalDatabaseContext context) {
                return new StackEvent(ExternalDatabaseCreationEvent.EXTERNAL_DATABASE_CREATION_FINISHED_EVENT.event(), context.getStack().getId());
            }
        };
    }

}