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.