(cred: DnsCredential)
| 760 | } |
| 761 | |
| 762 | fn dns_cred_to_proto(cred: DnsCredential) -> DnsCredentialInfo { |
| 763 | let (provider_type, cf_api_token, cf_api_url) = match &cred.provider { |
| 764 | DnsProvider::Cloudflare { api_token, api_url } => ( |
| 765 | "cloudflare".to_string(), |
| 766 | redact_token(api_token), |
| 767 | api_url.clone().unwrap_or_default(), |
| 768 | ), |
| 769 | }; |
| 770 | DnsCredentialInfo { |
| 771 | id: cred.id, |
| 772 | name: cred.name, |
| 773 | provider_type, |
| 774 | cf_api_token, |
| 775 | cf_api_url, |
| 776 | created_at: cred.created_at, |
| 777 | updated_at: cred.updated_at, |
| 778 | dns_txt_ttl: Some(cred.dns_txt_ttl), |
| 779 | max_dns_wait: Some(cred.max_dns_wait.as_secs() as u32), |
| 780 | } |
| 781 | } |
| 782 | |
| 783 | fn redact_token(token: &str) -> String { |
| 784 | let len = token.len(); |
no test coverage detected