Interface GuardrailsConfigProvider
-
- All Known Implementing Classes:
GuardrailsConfigProvider.Default
public interface GuardrailsConfigProviderProvider ofGuardrailsConfigs for aClientState.The
GuardrailsConfigProvider.Defaultimplementation always retuns theGuardrailsConfigparsed 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 theClientStateor some other factors. However, this mechanism for pluggability and the relatedGuardrailsConfiginterface are not officially supported and may change in a minor release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classGuardrailsConfigProvider.DefaultDefault implementation ofGuardrailsConfigProviderthat always returns theGuardrailsConfigparsed fromcassandra.yaml, independently of theClientState.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCUSTOM_IMPLEMENTATION_PROPERTYDeprecated.CUSTOM_GUARDRAILS_CONFIG_PROVIDER_CLASS.getKey() must be used instead.static GuardrailsConfigProviderinstance
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static GuardrailsConfigProviderbuild(java.lang.String customImpl)Creates an instance of the custom guardrails config provider of the given class.GuardrailsConfiggetOrCreate(ClientState state)Returns theGuardrailsConfigto 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 theGuardrailsConfigto be used for the specifiedClientState.- Parameters:
state- a client state, maybenullif 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.
-
-