Interface GuardrailsConfigProvider
-
- All Known Implementing Classes:
GuardrailsConfigProvider.Default
public interface GuardrailsConfigProvider
Provider ofGuardrailsConfig
s for aClientState
.The
GuardrailsConfigProvider.Default
implementation always retuns theGuardrailsConfig
parsed fromcassandra.yaml
, but different implementations can return different configurations based on the specifiedClientState
.Custom implementations can be specified at runtime with the system property
CUSTOM_IMPLEMENTATION_PROPERTY
. These configurations can be used to read the guardrails configuration from some other source, and provide different configurations depending on theClientState
or some other factors. However, this mechanism for pluggability and the relatedGuardrailsConfig
interface are not officially supported and may change in a minor release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
GuardrailsConfigProvider.Default
Default implementation ofGuardrailsConfigProvider
that always returns theGuardrailsConfig
parsed fromcassandra.yaml
, independently of theClientState
.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CUSTOM_IMPLEMENTATION_PROPERTY
Deprecated.CUSTOM_GUARDRAILS_CONFIG_PROVIDER_CLASS.getKey() must be used instead.static GuardrailsConfigProvider
instance
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static GuardrailsConfigProvider
build(java.lang.String customImpl)
Creates an instance of the custom guardrails config provider of the given class.GuardrailsConfig
getOrCreate(ClientState state)
Returns theGuardrailsConfig
to be used for the specifiedClientState
.
-
-
-
Field Detail
-
CUSTOM_IMPLEMENTATION_PROPERTY
@Deprecated(since="5.0") static final java.lang.String CUSTOM_IMPLEMENTATION_PROPERTY
Deprecated.CUSTOM_GUARDRAILS_CONFIG_PROVIDER_CLASS.getKey() must be used instead. See CASSANDRA-17797
-
instance
static final GuardrailsConfigProvider instance
-
-
Method Detail
-
getOrCreate
GuardrailsConfig getOrCreate(@Nullable ClientState state)
Returns theGuardrailsConfig
to be used for the specifiedClientState
.- Parameters:
state
- a client state, maybenull
if the guardrails check for which we are getting the config is for a background process that is not associated to a user query.- Returns:
- the configuration to be used for
state
-
build
static GuardrailsConfigProvider build(java.lang.String customImpl)
Creates an instance of the custom guardrails config provider of the given class.- Parameters:
customImpl
- the fully qualified classname of the guardrails config provider to be instantiated- Returns:
- a new instance of the specified custom guardrails config provider of the given class.
-
-