pub struct HttpAclBuilder { /* private fields */ }
Expand description
A builder for HttpAcl
.
Implementations§
Source§impl HttpAclBuilder
impl HttpAclBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new HttpAclBuilder
.
Sourcepub fn private_ip_ranges(self, allow: bool) -> Self
pub fn private_ip_ranges(self, allow: bool) -> Self
Sets whether private IP ranges are allowed.
Sourcepub fn method_acl_default(self, allow: bool) -> Self
pub fn method_acl_default(self, allow: bool) -> Self
Set default action for HTTP methods if no ACL match is found.
Sourcepub fn host_acl_default(self, allow: bool) -> Self
pub fn host_acl_default(self, allow: bool) -> Self
Set default action for hosts if no ACL match is found.
Sourcepub fn port_acl_default(self, allow: bool) -> Self
pub fn port_acl_default(self, allow: bool) -> Self
Set default action for ports if no ACL match is found.
Sourcepub fn ip_acl_default(self, allow: bool) -> Self
pub fn ip_acl_default(self, allow: bool) -> Self
Set default action for IPs if no ACL match is found.
Sourcepub fn header_acl_default(self, allow: bool) -> Self
pub fn header_acl_default(self, allow: bool) -> Self
Set default action for headers if no ACL match is found.
Sourcepub fn url_path_acl_default(self, allow: bool) -> Self
pub fn url_path_acl_default(self, allow: bool) -> Self
Set default action for URL paths if no ACL match is found.
Sourcepub fn add_allowed_method(
self,
method: impl Into<HttpRequestMethod>,
) -> Result<Self, AddError>
pub fn add_allowed_method( self, method: impl Into<HttpRequestMethod>, ) -> Result<Self, AddError>
Adds a method to the allowed methods.
Sourcepub fn remove_allowed_method(self, method: impl Into<HttpRequestMethod>) -> Self
pub fn remove_allowed_method(self, method: impl Into<HttpRequestMethod>) -> Self
Removes a method from the allowed methods.
Sourcepub fn allowed_methods(
self,
methods: Vec<impl Into<HttpRequestMethod>>,
) -> Result<Self, AddError>
pub fn allowed_methods( self, methods: Vec<impl Into<HttpRequestMethod>>, ) -> Result<Self, AddError>
Sets the allowed methods.
Sourcepub fn clear_allowed_methods(self) -> Self
pub fn clear_allowed_methods(self) -> Self
Clears the allowed methods.
Sourcepub fn add_denied_method(
self,
method: impl Into<HttpRequestMethod>,
) -> Result<Self, AddError>
pub fn add_denied_method( self, method: impl Into<HttpRequestMethod>, ) -> Result<Self, AddError>
Adds a method to the denied methods.
Sourcepub fn remove_denied_method(self, method: impl Into<HttpRequestMethod>) -> Self
pub fn remove_denied_method(self, method: impl Into<HttpRequestMethod>) -> Self
Removes a method from the denied methods.
Sourcepub fn denied_methods(
self,
methods: Vec<impl Into<HttpRequestMethod>>,
) -> Result<Self, AddError>
pub fn denied_methods( self, methods: Vec<impl Into<HttpRequestMethod>>, ) -> Result<Self, AddError>
Sets the denied methods.
Sourcepub fn clear_denied_methods(self) -> Self
pub fn clear_denied_methods(self) -> Self
Clears the denied methods.
Sourcepub fn add_allowed_host(self, host: String) -> Result<Self, AddError>
pub fn add_allowed_host(self, host: String) -> Result<Self, AddError>
Sets whether public IP ranges are allowed.
Sourcepub fn remove_allowed_host(self, host: String) -> Self
pub fn remove_allowed_host(self, host: String) -> Self
Removes a host from the allowed hosts.
Sourcepub fn allowed_hosts(self, hosts: Vec<String>) -> Result<Self, AddError>
pub fn allowed_hosts(self, hosts: Vec<String>) -> Result<Self, AddError>
Sets the allowed hosts.
Sourcepub fn clear_allowed_hosts(self) -> Self
pub fn clear_allowed_hosts(self) -> Self
Clears the allowed hosts.
Sourcepub fn add_denied_host(self, host: String) -> Result<Self, AddError>
pub fn add_denied_host(self, host: String) -> Result<Self, AddError>
Adds a host to the denied hosts.
Sourcepub fn remove_denied_host(self, host: String) -> Self
pub fn remove_denied_host(self, host: String) -> Self
Removes a host from the denied hosts.
Sourcepub fn clear_denied_hosts(self) -> Self
pub fn clear_denied_hosts(self) -> Self
Clears the denied hosts.
Sourcepub fn add_allowed_port_range(
self,
port_range: RangeInclusive<u16>,
) -> Result<Self, AddError>
pub fn add_allowed_port_range( self, port_range: RangeInclusive<u16>, ) -> Result<Self, AddError>
Adds a port range to the allowed port ranges.
Sourcepub fn remove_allowed_port_range(self, port_range: RangeInclusive<u16>) -> Self
pub fn remove_allowed_port_range(self, port_range: RangeInclusive<u16>) -> Self
Removes a port range from the allowed port ranges.
Sourcepub fn allowed_port_ranges(
self,
port_ranges: Vec<RangeInclusive<u16>>,
) -> Result<Self, AddError>
pub fn allowed_port_ranges( self, port_ranges: Vec<RangeInclusive<u16>>, ) -> Result<Self, AddError>
Sets the allowed port ranges.
Sourcepub fn clear_allowed_port_ranges(self) -> Self
pub fn clear_allowed_port_ranges(self) -> Self
Clears the allowed port ranges.
Sourcepub fn add_denied_port_range(
self,
port_range: RangeInclusive<u16>,
) -> Result<Self, AddError>
pub fn add_denied_port_range( self, port_range: RangeInclusive<u16>, ) -> Result<Self, AddError>
Adds a port range to the denied port ranges.
Sourcepub fn remove_denied_port_range(self, port_range: RangeInclusive<u16>) -> Self
pub fn remove_denied_port_range(self, port_range: RangeInclusive<u16>) -> Self
Removes a port range from the denied port ranges.
Sourcepub fn denied_port_ranges(
self,
port_ranges: Vec<RangeInclusive<u16>>,
) -> Result<Self, AddError>
pub fn denied_port_ranges( self, port_ranges: Vec<RangeInclusive<u16>>, ) -> Result<Self, AddError>
Sets the denied port ranges.
Sourcepub fn clear_denied_port_ranges(self) -> Self
pub fn clear_denied_port_ranges(self) -> Self
Clears the denied port ranges.
Sourcepub fn add_allowed_ip_range<Ip: IntoIpRange>(
self,
ip_range: Ip,
) -> Result<Self, AddError>
pub fn add_allowed_ip_range<Ip: IntoIpRange>( self, ip_range: Ip, ) -> Result<Self, AddError>
Adds an IP range to the allowed IP ranges.
Sourcepub fn remove_allowed_ip_range<Ip: IntoIpRange>(
self,
ip_range: Ip,
) -> Result<Self, AddError>
pub fn remove_allowed_ip_range<Ip: IntoIpRange>( self, ip_range: Ip, ) -> Result<Self, AddError>
Removes an IP range from the allowed IP ranges.
Sourcepub fn allowed_ip_ranges<Ip: IntoIpRange>(
self,
ip_ranges: Vec<Ip>,
) -> Result<Self, AddError>
pub fn allowed_ip_ranges<Ip: IntoIpRange>( self, ip_ranges: Vec<Ip>, ) -> Result<Self, AddError>
Sets the allowed IP ranges.
Sourcepub fn clear_allowed_ip_ranges(self) -> Self
pub fn clear_allowed_ip_ranges(self) -> Self
Clears the allowed IP ranges.
Sourcepub fn add_denied_ip_range<Ip: IntoIpRange>(
self,
ip_range: Ip,
) -> Result<Self, AddError>
pub fn add_denied_ip_range<Ip: IntoIpRange>( self, ip_range: Ip, ) -> Result<Self, AddError>
Adds an IP range to the denied IP ranges.
Sourcepub fn remove_denied_ip_range<Ip: IntoIpRange>(
self,
ip_range: Ip,
) -> Result<Self, AddError>
pub fn remove_denied_ip_range<Ip: IntoIpRange>( self, ip_range: Ip, ) -> Result<Self, AddError>
Removes an IP range from the denied IP ranges.
Sourcepub fn denied_ip_ranges<Ip: IntoIpRange>(
self,
ip_ranges: Vec<Ip>,
) -> Result<Self, AddError>
pub fn denied_ip_ranges<Ip: IntoIpRange>( self, ip_ranges: Vec<Ip>, ) -> Result<Self, AddError>
Sets the denied IP ranges.
Sourcepub fn clear_denied_ip_ranges(self) -> Self
pub fn clear_denied_ip_ranges(self) -> Self
Clears the denied IP ranges.
Sourcepub fn add_static_dns_mapping(
self,
host: String,
sock_addr: SocketAddr,
) -> Result<Self, AddError>
pub fn add_static_dns_mapping( self, host: String, sock_addr: SocketAddr, ) -> Result<Self, AddError>
Add a static DNS mapping.
Sourcepub fn remove_static_dns_mapping(self, host: &str) -> Self
pub fn remove_static_dns_mapping(self, host: &str) -> Self
Removes a static DNS mapping.
Sourcepub fn static_dns_mappings(
self,
mappings: HashMap<String, SocketAddr>,
) -> Result<Self, AddError>
pub fn static_dns_mappings( self, mappings: HashMap<String, SocketAddr>, ) -> Result<Self, AddError>
Sets the static DNS mappings.
Sourcepub fn clear_static_dns_mappings(self) -> Self
pub fn clear_static_dns_mappings(self) -> Self
Clears the static DNS mappings.
Sourcepub fn add_allowed_header(
self,
header: String,
value: Option<String>,
) -> Result<Self, AddError>
pub fn add_allowed_header( self, header: String, value: Option<String>, ) -> Result<Self, AddError>
Adds a header to the allowed headers.
Sourcepub fn remove_allowed_header(self, header: &str) -> Self
pub fn remove_allowed_header(self, header: &str) -> Self
Removes a header from the allowed headers.
Sourcepub fn allowed_headers(
self,
headers: HashMap<String, Option<String>>,
) -> Result<Self, AddError>
pub fn allowed_headers( self, headers: HashMap<String, Option<String>>, ) -> Result<Self, AddError>
Sets the allowed headers.
Sourcepub fn clear_allowed_headers(self) -> Self
pub fn clear_allowed_headers(self) -> Self
Clears the allowed headers.
Sourcepub fn add_denied_header(
self,
header: String,
value: Option<String>,
) -> Result<Self, AddError>
pub fn add_denied_header( self, header: String, value: Option<String>, ) -> Result<Self, AddError>
Adds a header to the denied headers.
Sourcepub fn remove_denied_header(self, header: &str) -> Self
pub fn remove_denied_header(self, header: &str) -> Self
Removes a header from the denied headers.
Sourcepub fn denied_headers(
self,
headers: HashMap<String, Option<String>>,
) -> Result<Self, AddError>
pub fn denied_headers( self, headers: HashMap<String, Option<String>>, ) -> Result<Self, AddError>
Sets the denied headers.
Sourcepub fn clear_denied_headers(self) -> Self
pub fn clear_denied_headers(self) -> Self
Clears the denied headers.
Sourcepub fn add_allowed_url_path(self, url_path: String) -> Result<Self, AddError>
pub fn add_allowed_url_path(self, url_path: String) -> Result<Self, AddError>
Adds a URL path to the allowed URL paths.
Sourcepub fn remove_allowed_url_path(self, url_path: &str) -> Self
pub fn remove_allowed_url_path(self, url_path: &str) -> Self
Removes a URL path from the allowed URL paths.
Sourcepub fn allowed_url_paths(self, url_paths: Vec<String>) -> Result<Self, AddError>
pub fn allowed_url_paths(self, url_paths: Vec<String>) -> Result<Self, AddError>
Sets the allowed URL paths.
Sourcepub fn clear_allowed_url_paths(self) -> Self
pub fn clear_allowed_url_paths(self) -> Self
Clears the allowed URL paths.
Sourcepub fn add_denied_url_path(self, url_path: String) -> Result<Self, AddError>
pub fn add_denied_url_path(self, url_path: String) -> Result<Self, AddError>
Adds a URL path to the denied URL paths.
Sourcepub fn remove_denied_url_path(self, url_path: &str) -> Self
pub fn remove_denied_url_path(self, url_path: &str) -> Self
Removes a URL path from the denied URL paths.
Sourcepub fn denied_url_paths(self, url_paths: Vec<String>) -> Result<Self, AddError>
pub fn denied_url_paths(self, url_paths: Vec<String>) -> Result<Self, AddError>
Sets the denied URL paths.
Sourcepub fn clear_denied_url_paths(self) -> Self
pub fn clear_denied_url_paths(self) -> Self
Clears the denied URL paths.
Sourcepub fn build_full(self, validate_fn: Option<ValidateFn>) -> HttpAcl
pub fn build_full(self, validate_fn: Option<ValidateFn>) -> HttpAcl
Builds the HttpAcl
.
Sourcepub fn try_build_full(
self,
validate_fn: Option<ValidateFn>,
) -> Result<HttpAcl, AddError>
pub fn try_build_full( self, validate_fn: Option<ValidateFn>, ) -> Result<HttpAcl, AddError>
Builds the HttpAcl
and returns an error if the configuration is invalid.
This is used for deserialized ACLs as the URL Path Routers need to be built.
Trait Implementations§
Source§impl Clone for HttpAclBuilder
impl Clone for HttpAclBuilder
Source§fn clone(&self) -> HttpAclBuilder
fn clone(&self) -> HttpAclBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more