pub struct HttpAclBuilder { /* private fields */ }
Expand description

A builder for HttpAcl.

Implementations§

source§

impl HttpAclBuilder

source

pub fn new() -> Self

Create a new HttpAclBuilder.

source

pub fn http(self, allow: bool) -> Self

Sets whether HTTP is allowed.

source

pub fn https(self, allow: bool) -> Self

Sets whether HTTPS is allowed.

source

pub fn private_ip_ranges(self, allow: bool) -> Self

Sets whether private IP ranges are allowed.

source

pub fn method_acl_default(self, allow: bool) -> Self

Set default action for HTTP methods if no ACL match is found.

source

pub fn host_acl_default(self, allow: bool) -> Self

Set default action for hosts if no ACL match is found.

source

pub fn port_acl_default(self, allow: bool) -> Self

Set default action for ports if no ACL match is found.

source

pub fn ip_acl_default(self, allow: bool) -> Self

Set default action for IPs if no ACL match is found.

source

pub fn add_allowed_method( self, method: impl Into<HttpRequestMethod> ) -> Result<Self, AddError>

Adds a method to the allowed methods.

source

pub fn remove_allowed_method(self, method: impl Into<HttpRequestMethod>) -> Self

Removes a method from the allowed methods.

source

pub fn allowed_methods( self, methods: Vec<impl Into<HttpRequestMethod>> ) -> Result<Self, AddError>

Sets the allowed methods.

source

pub fn clear_allowed_methods(self) -> Self

Clears the allowed methods.

source

pub fn add_denied_method( self, method: impl Into<HttpRequestMethod> ) -> Result<Self, AddError>

Adds a method to the denied methods.

source

pub fn remove_denied_method(self, method: impl Into<HttpRequestMethod>) -> Self

Removes a method from the denied methods.

source

pub fn denied_methods( self, methods: Vec<impl Into<HttpRequestMethod>> ) -> Result<Self, AddError>

Sets the denied methods.

source

pub fn clear_denied_methods(self) -> Self

Clears the denied methods.

source

pub fn add_allowed_host(self, host: String) -> Result<Self, AddError>

Sets whether public IP ranges are allowed.

source

pub fn remove_allowed_host(self, host: String) -> Self

Removes a host from the allowed hosts.

source

pub fn allowed_hosts(self, hosts: Vec<String>) -> Result<Self, AddError>

Sets the allowed hosts.

source

pub fn clear_allowed_hosts(self) -> Self

Clears the allowed hosts.

source

pub fn add_denied_host(self, host: String) -> Result<Self, AddError>

Adds a host to the denied hosts.

source

pub fn remove_denied_host(self, host: String) -> Self

Removes a host from the denied hosts.

source

pub fn denied_hosts(self, hosts: Vec<String>) -> Result<Self, AddError>

Sets the denied hosts.

source

pub fn clear_denied_hosts(self) -> Self

Clears the denied hosts.

source

pub fn add_allowed_port_range( self, port_range: RangeInclusive<u16> ) -> Result<Self, AddError>

Adds a port range to the allowed port ranges.

source

pub fn remove_allowed_port_range(self, port_range: RangeInclusive<u16>) -> Self

Removes a port range from the allowed port ranges.

source

pub fn allowed_port_ranges( self, port_ranges: Vec<RangeInclusive<u16>> ) -> Result<Self, AddError>

Sets the allowed port ranges.

source

pub fn clear_allowed_port_ranges(self) -> Self

Clears the allowed port ranges.

source

pub fn add_denied_port_range( self, port_range: RangeInclusive<u16> ) -> Result<Self, AddError>

Adds a port range to the denied port ranges.

source

pub fn remove_denied_port_range(self, port_range: RangeInclusive<u16>) -> Self

Removes a port range from the denied port ranges.

source

pub fn denied_port_ranges( self, port_ranges: Vec<RangeInclusive<u16>> ) -> Result<Self, AddError>

Sets the denied port ranges.

source

pub fn clear_denied_port_ranges(self) -> Self

Clears the denied port ranges.

source

pub fn add_allowed_ip_range(self, ip_range: IpNet) -> Result<Self, AddError>

Adds an IP range to the allowed IP ranges.

source

pub fn remove_allowed_ip_range(self, ip_range: IpNet) -> Self

Removes an IP range from the allowed IP ranges.

source

pub fn allowed_ip_ranges(self, ip_ranges: Vec<IpNet>) -> Result<Self, AddError>

Sets the allowed IP ranges.

source

pub fn clear_allowed_ip_ranges(self) -> Self

Clears the allowed IP ranges.

source

pub fn add_denied_ip_range(self, ip_range: IpNet) -> Result<Self, AddError>

Adds an IP range to the denied IP ranges.

source

pub fn remove_denied_ip_range(self, ip_range: IpNet) -> Self

Removes an IP range from the denied IP ranges.

source

pub fn denied_ip_ranges(self, ip_ranges: Vec<IpNet>) -> Result<Self, AddError>

Sets the denied IP ranges.

source

pub fn clear_denied_ip_ranges(self) -> Self

Clears the denied IP ranges.

source

pub fn add_static_dns_mapping( self, host: String, ip: IpAddr ) -> Result<Self, AddError>

Add a static DNS mapping.

source

pub fn remove_static_dns_mapping(self, host: &str) -> Self

Removes a static DNS mapping.

source

pub fn static_dns_mappings( self, mappings: HashMap<String, IpAddr> ) -> Result<Self, AddError>

Sets the static DNS mappings.

source

pub fn build(self) -> HttpAcl

Builds the HttpAcl.

source

pub fn try_build(self) -> Result<HttpAcl, AddError>

Builds the HttpAcl and returns an error if the configuration is invalid. This can be used as a validity check for deserialized ACLs that were genrated externally.

Trait Implementations§

source§

impl Clone for HttpAclBuilder

source§

fn clone(&self) -> HttpAclBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for HttpAclBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for HttpAclBuilder

source§

fn default() -> HttpAclBuilder

Returns the “default value” for a type. Read more
source§

impl PartialEq<HttpAclBuilder> for HttpAclBuilder

source§

fn eq(&self, other: &HttpAclBuilder) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for HttpAclBuilder

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.