include LogStash::PluginMixins::ECSCompatibilitySupport(:disabled,:v1)
Plugins will prevent instantiation in unsupported ecs_compatibility modes.
Plugin instances will have an ecs_select method that allows in-line definition of
alternates that resolve at runtime to the effective ecs_compatibility mode:
Usage of the ecs_select method safeguards against a developer failing to
specify all alternates, which makes it easy to build large tables like those
required in the CEF codec's 50+ field mappings.
Plugin specs will be able to use a SpecHelper that provides
ecs_compatibility_matrix helper for setting up a matrix of supported modes
for testing. The method yields an Selector::State, which can be used just
like ecs_select:
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
describe YourClass, :ecs_compatibility_support
ecs_compatibility_matrix(:disabled, :v1) do |ecs_select|
subject(:instance) { described_class.new(ecs_compatibility) }
its(:mode) { is_expected.to be ecs_compatibility }
its(:description) { is_expected.to eq ecs_select[disabled: "legacy", v1: "novel"] }
end
end
Which produces the following output in rspec's documentation mode:
YourClass
`ecs_compatibility => disabled`
mode
is expected to equal :disabled
description
is expected to eq "legacy"
`ecs_compatibility => v1`
mode
is expected to equal :v1
description
is expected to eq "novel"
When included with:
ecs_compatibility
modes.Plugin instances will have an
ecs_select
method that allows in-line definition of alternates that resolve at runtime to the effectiveecs_compatibility
mode:Usage of the
ecs_select
method safeguards against a developer failing to specify all alternates, which makes it easy to build large tables like those required in the CEF codec's 50+ field mappings.Plugin specs will be able to use a
SpecHelper
that providesecs_compatibility_matrix
helper for setting up a matrix of supported modes for testing. The method yields anSelector::State
, which can be used just likeecs_select
:Which produces the following output in rspec's documentation mode: