pub struct CloudflareClient { /* private fields */ }Expand description
Cloudflare API client for DNS and Origin CA management
Implementations§
Source§impl CloudflareClient
impl CloudflareClient
pub fn new(config: &ResolvedCloudflareConfig, base_domain: &str) -> Self
Sourcepub async fn create_record(
&self,
subdomain: &str,
proxied: bool,
) -> Result<String, CloudflareError>
pub async fn create_record( &self, subdomain: &str, proxied: bool, ) -> Result<String, CloudflareError>
Sourcepub async fn delete_record(
&self,
record_id: &str,
) -> Result<(), CloudflareError>
pub async fn delete_record( &self, record_id: &str, ) -> Result<(), CloudflareError>
Delete a DNS record
Sourcepub async fn create_origin_certificate(
&self,
validity_days: u32,
) -> Result<OriginCertificate, CloudflareError>
pub async fn create_origin_certificate( &self, validity_days: u32, ) -> Result<OriginCertificate, CloudflareError>
Create an Origin CA certificate for the base domain
This generates a private key and CSR locally, then requests a certificate from Cloudflare’s Origin CA. The certificate is valid for HTTPS connections from Cloudflare to this origin server (Full Strict mode).
§Arguments
validity_days- Certificate validity in days (default: 365)
§Returns
An OriginCertificate containing the certificate and private key in PEM format
Sourcepub async fn cleanup_old_origin_certificates(
&self,
) -> Result<u32, CloudflareError>
pub async fn cleanup_old_origin_certificates( &self, ) -> Result<u32, CloudflareError>
Clean up old Origin CA certificates for this domain
This revokes any existing Origin CA certificates that match our base domain (either *.base_domain or base_domain). Should be called before creating a new certificate to avoid accumulating old ones.
Trait Implementations§
Source§impl DnsProvider for CloudflareClient
impl DnsProvider for CloudflareClient
Source§fn create_record<'life0, 'life1, 'async_trait>(
&'life0 self,
subdomain: &'life1 str,
proxied: bool,
) -> Pin<Box<dyn Future<Output = Result<String, DnsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_record<'life0, 'life1, 'async_trait>(
&'life0 self,
subdomain: &'life1 str,
proxied: bool,
) -> Pin<Box<dyn Future<Output = Result<String, DnsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a DNS record for a subdomain Read more
Source§fn delete_record<'life0, 'life1, 'async_trait>(
&'life0 self,
record_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), DnsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_record<'life0, 'life1, 'async_trait>(
&'life0 self,
record_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), DnsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a DNS record by its ID
Auto Trait Implementations§
impl Freeze for CloudflareClient
impl !RefUnwindSafe for CloudflareClient
impl Send for CloudflareClient
impl Sync for CloudflareClient
impl Unpin for CloudflareClient
impl !UnwindSafe for CloudflareClient
Blanket Implementations§
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
Mutably borrows from an owned value. Read more