diff --git a/cloudflare/src/endpoints/dns.rs b/cloudflare/src/endpoints/dns.rs index 871945ff..9450d4ec 100644 --- a/cloudflare/src/endpoints/dns.rs +++ b/cloudflare/src/endpoints/dns.rs @@ -125,6 +125,54 @@ pub struct UpdateDnsRecordParams<'a> { /// Type of the DNS record that also holds the record value #[serde(flatten)] pub content: DnsContent, + /// Comments or notes about the DNS record + pub comment: Option<&'a str>, + /// Custom tags for the DNS record. This field has no effect on DNS responses + pub tags: Option<&'a Vec>, +} + +/// Patch DNS Record +/// +#[derive(Debug)] +pub struct PatchDnsRecord<'a> { + pub zone_identifier: &'a str, + pub identifier: &'a str, + pub params: PatchDnsRecordParams<'a>, +} + +impl<'a> EndpointSpec for PatchDnsRecord<'a> { + fn method(&self) -> Method { + Method::PATCH + } + fn path(&self) -> String { + format!( + "zones/{}/dns_records/{}", + self.zone_identifier, self.identifier + ) + } + #[inline] + fn body(&self) -> Option { + let body = serde_json::to_string(&self.params).unwrap(); + Some(body) + } +} + +#[serde_with::skip_serializing_none] +#[derive(Serialize, Clone, Debug)] +pub struct PatchDnsRecordParams<'a> { + /// Time to live for DNS record. Value of 1 is 'automatic' + pub ttl: Option, + /// Whether the record is receiving the performance and security benefits of Cloudflare + pub proxied: Option, + /// DNS record name + pub name: &'a str, + /// Type of the DNS record that also holds the record value + #[serde(flatten)] + pub content: DnsContent, + /// Comments or notes about the DNS record + pub comment: Option<&'a str>, + /// Custom tags for the DNS record. This field has no effect on DNS responses + pub tags: Option<&'a Vec>, } #[derive(Serialize, Clone, Debug)] @@ -207,6 +255,10 @@ pub struct DnsRecord { pub proxied: bool, /// The domain of the record pub zone_name: String, + /// Comments or notes about the DNS record + pub comment: Option, + /// Custom tags for the DNS record. This field has no effect on DNS responses + pub tags: Vec, } impl ApiResult for DnsRecord {}