pub struct NifiClientBuilder { /* private fields */ }Expand description
Builder for NifiClient.
Use this when you need to configure timeouts, proxies, or TLS options beyond the defaults provided by the convenience constructors.
§Example
use std::time::Duration;
use nifi_rust_client::NifiClientBuilder;
use url::Url;
let client = NifiClientBuilder::new("https://nifi.example.com:8443")?
.timeout(Duration::from_secs(60))
.connect_timeout(Duration::from_secs(10))
.proxy(Url::parse("http://proxy.internal:3128").unwrap())
.build()?;Implementations§
Source§impl NifiClientBuilder
impl NifiClientBuilder
Sourcepub fn new(base_url: &str) -> Result<Self, NifiError>
pub fn new(base_url: &str) -> Result<Self, NifiError>
Create a new builder targeting the given NiFi base URL.
Returns an error if base_url cannot be parsed.
Sourcepub fn timeout(self, duration: Duration) -> Self
pub fn timeout(self, duration: Duration) -> Self
Set the total request timeout.
The timeout applies from when the request starts connecting until the response body is fully received.
Sourcepub fn connect_timeout(self, duration: Duration) -> Self
pub fn connect_timeout(self, duration: Duration) -> Self
Set the TCP connection timeout.
Sourcepub fn proxy(self, url: Url) -> Self
pub fn proxy(self, url: Url) -> Self
Route all traffic (HTTP and HTTPS) through the given proxy.
Sourcepub fn http_proxy(self, url: Url) -> Self
pub fn http_proxy(self, url: Url) -> Self
Route HTTP traffic through the given proxy.
Sourcepub fn https_proxy(self, url: Url) -> Self
pub fn https_proxy(self, url: Url) -> Self
Route HTTPS traffic through the given proxy.
Sourcepub fn danger_accept_invalid_certs(self, accept: bool) -> Self
pub fn danger_accept_invalid_certs(self, accept: bool) -> Self
Skip TLS certificate verification.
Only use this in development against self-signed certificates.
Sourcepub fn add_root_certificate(self, pem: &[u8]) -> Self
pub fn add_root_certificate(self, pem: &[u8]) -> Self
Trust an additional PEM-encoded CA certificate.
May be called multiple times to add more than one certificate.
Sourcepub fn build(self) -> Result<NifiClient, NifiError>
pub fn build(self) -> Result<NifiClient, NifiError>
Build the NifiClient.
Sourcepub async fn build_dynamic(self) -> Result<DynamicClient, NifiError>
pub async fn build_dynamic(self) -> Result<DynamicClient, NifiError>
Build a DynamicClient that auto-detects the NiFi version.
Connects to the NiFi instance, calls the about endpoint to detect the API version, and returns a client that dispatches to the correct generated API module at runtime.
§Example
use nifi_rust_client::NifiClientBuilder;
let mut client = NifiClientBuilder::new("https://nifi.example.com:8443")?
.danger_accept_invalid_certs(true)
.build_dynamic()
.await?;
client.login("admin", "password").await?;