pub struct NetworkPolicyBuilder { /* private fields */ }Expand description
Fluent builder for NetworkPolicy.
Construct via NetworkPolicy::builder.
Implementations§
Source§impl NetworkPolicyBuilder
impl NetworkPolicyBuilder
Sourcepub fn default_allow(self) -> Self
pub fn default_allow(self) -> Self
Set both default_egress and default_ingress to Allow.
Sourcepub fn default_deny(self) -> Self
pub fn default_deny(self) -> Self
Set both default_egress and default_ingress to Deny.
Sourcepub fn default_egress(self, action: Action) -> Self
pub fn default_egress(self, action: Action) -> Self
Per-direction override for the egress default action.
Sourcepub fn default_ingress(self, action: Action) -> Self
pub fn default_ingress(self, action: Action) -> Self
Per-direction override for the ingress default action.
Sourcepub fn rule<F>(self, f: F) -> Self
pub fn rule<F>(self, f: F) -> Self
Open a multi-rule batch closure. Direction must be set inside
via .egress(), .ingress(), or .any() before any rule-adder.
Sourcepub fn egress<F>(self, f: F) -> Self
pub fn egress<F>(self, f: F) -> Self
Sugar for Self::rule with direction pre-set to Egress.
Sourcepub fn ingress<F>(self, f: F) -> Self
pub fn ingress<F>(self, f: F) -> Self
Sugar for Self::rule with direction pre-set to Ingress.
Sourcepub fn any<F>(self, f: F) -> Self
pub fn any<F>(self, f: F) -> Self
Sugar for Self::rule with direction pre-set to Any. Rules
committed inside apply in both directions.
Sourcepub fn build(self) -> Result<NetworkPolicy, BuildError>
pub fn build(self) -> Result<NetworkPolicy, BuildError>
Consume the builder and produce a NetworkPolicy.
Lazy-parses every .ip() / .cidr() / .domain() /
.domain_suffix() input, validates direction-set and
ICMP-egress-only invariants, and emits a tracing::warn! for
each shadowed rule pair detected.
Returns the first BuildError encountered.
Trait Implementations§
Source§impl Debug for NetworkPolicyBuilder
impl Debug for NetworkPolicyBuilder
Source§impl Default for NetworkPolicyBuilder
impl Default for NetworkPolicyBuilder
Source§fn default() -> NetworkPolicyBuilder
fn default() -> NetworkPolicyBuilder
Auto Trait Implementations§
impl Freeze for NetworkPolicyBuilder
impl RefUnwindSafe for NetworkPolicyBuilder
impl Send for NetworkPolicyBuilder
impl Sync for NetworkPolicyBuilder
impl Unpin for NetworkPolicyBuilder
impl UnsafeUnpin for NetworkPolicyBuilder
impl UnwindSafe for NetworkPolicyBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more