[][src]Struct allow_me::PolicyBuilder

pub struct PolicyBuilder<V, M, S> { /* fields omitted */ }

A policy builder, responsible for parsing policy definition and constructing Policy struct.

It handles policy definition versioning and allows fine-grained configuration of Policy components.

Implementations

impl PolicyBuilder<DefaultValidator, Default, DefaultSubstituter>[src]

pub fn from_json(
    json: impl Into<String>
) -> PolicyBuilder<DefaultValidator, Default, DefaultSubstituter>
[src]

Constructs a PolicyBuilder from provided json policy definition, with default configuration.

Call to this method does not parse or validate the json, all heavy work is done in build method.

pub fn from_definition(
    definition: PolicyDefinition
) -> PolicyBuilder<DefaultValidator, Default, DefaultSubstituter>
[src]

Constructs a PolicyBuilder from provided policy definition struct, with default configuration.

Call to this method does not validate the definition, all heavy work is done in build method.

impl<V, M, S, E> PolicyBuilder<V, M, S> where
    V: PolicyValidator<Error = E>,
    M: ResourceMatcher,
    S: Substituter,
    E: StdError + Sync + Into<Box<dyn StdError>> + 'static, 
[src]

pub fn with_validator<V1>(self, validator: V1) -> PolicyBuilder<V1, M, S>[src]

Specifies the PolicyValidator to validate the policy definition.

pub fn with_matcher<M1>(self, matcher: M1) -> PolicyBuilder<V, M1, S>[src]

Specifies the ResourceMatcher to use with Policy.

pub fn with_substituter<S1>(self, substituter: S1) -> PolicyBuilder<V, M, S1>[src]

Specifies the Substituter to use with Policy.

pub fn with_default_decision(self, decision: Decision) -> Self[src]

Specifies the default decision that Policy will return if no rules match the request.

pub fn build(self) -> Result<Policy<M, S>>[src]

Builds a Policy consuming the builder.

This method does all the heavy lifting of deserializing json, validating and constructing the policy rules tree.

Errors

Returns PolicyValidator::Error if any.

Auto Trait Implementations

impl<V, M, S> RefUnwindSafe for PolicyBuilder<V, M, S> where
    M: RefUnwindSafe,
    S: RefUnwindSafe,
    V: RefUnwindSafe
[src]

impl<V, M, S> Send for PolicyBuilder<V, M, S> where
    M: Send,
    S: Send,
    V: Send
[src]

impl<V, M, S> Sync for PolicyBuilder<V, M, S> where
    M: Sync,
    S: Sync,
    V: Sync
[src]

impl<V, M, S> Unpin for PolicyBuilder<V, M, S> where
    M: Unpin,
    S: Unpin,
    V: Unpin
[src]

impl<V, M, S> UnwindSafe for PolicyBuilder<V, M, S> where
    M: UnwindSafe,
    S: UnwindSafe,
    V: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.