MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / dns_cred_to_proto

Function dns_cred_to_proto

gateway/src/admin_service.rs:762–781  ·  view source on GitHub ↗
(cred: DnsCredential)

Source from the content-addressed store, hash-verified

760}
761
762fn 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
783fn redact_token(token: &str) -> String {
784 let len = token.len();

Callers 3

get_dns_credentialMethod · 0.85
create_dns_credentialMethod · 0.85
update_dns_credentialMethod · 0.85

Calls 2

redact_tokenFunction · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected