Class InMemoryGuardrailSource
- Namespace
- IntentSharp.Guardrails
- Assembly
- IntentSharp.dll
A guardrail source over rule sets written in code: one snapshot, which never changes, so a client or a target runtime
can be ruled with no rule file and no document store, for example
builder.WithGuardrails(new InMemoryGuardrailSource(ordersSet), "orders-data"). The checks apply its sets as they
apply sets read from files and fail closed the same way: a check whose sets leave a required subject uncovered, or that
meets a detect-only rule on a security subject, is refused. The source is its own snapshot.
public sealed class InMemoryGuardrailSource : IGuardrailSource, IGuardrailSnapshot
- Inheritance
-
objectInMemoryGuardrailSource
- Implements
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.ReferenceEquals(object, object)object.ToString()
- Extension Methods
Remarks
The source keeps the list of sets as given when it is created, so adding to or removing from the caller's array afterwards changes nothing; the sets and rules themselves are kept, not copied, so do not change what they hold. To change the rules, build a new client with a new source. A source that must change while the client runs, or that keeps rules in a technology of your own, implements IGuardrailSource itself.
Constructors
- InMemoryGuardrailSource(params GuardrailSet[])
Creates a source that serves
sets, in the order given.
Properties
- Current
The source's one snapshot, which is the source itself.
- Revision
The snapshot's revision,
in-memory, which never changes because the sets never do.
- Sets
The rule sets, in the order given to the constructor.
Methods
- GetChangeToken()
A token that never fires, since the snapshot never changes.