Skip to main content

hanzo_client/apis/
dns_api.rs

1/*
2 * Hanzo Cloud API
3 *
4 * The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`delete_dns_zones_by_zone`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeleteDnsZonesByZoneError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`delete_dns_zones_by_zone_records_by_record`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeleteDnsZonesByZoneRecordsByRecordError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_dns_health`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetDnsHealthError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_dns_zones`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetDnsZonesError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_dns_zones_by_zone`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetDnsZonesByZoneError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_dns_zones_by_zone_records`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetDnsZonesByZoneRecordsError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_dns_zones_by_zone_records_by_record`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetDnsZonesByZoneRecordsByRecordError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`patch_dns_zones_by_zone_records_by_record`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum PatchDnsZonesByZoneRecordsByRecordError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`post_dns_sync`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum PostDnsSyncError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`post_dns_zones`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum PostDnsZonesError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`post_dns_zones_by_zone_records`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PostDnsZonesByZoneRecordsError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`put_dns_zones_by_zone_records_by_record`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum PutDnsZonesByZoneRecordsByRecordError {
99    UnknownValue(serde_json::Value),
100}
101
102
103/// Removes one of the calling org's zones, and the records in it, from the DNS control plane. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
104pub async fn delete_dns_zones_by_zone(configuration: &configuration::Configuration, zone: &str) -> Result<(), Error<DeleteDnsZonesByZoneError>> {
105    // add a prefix to parameters to efficiently prevent name collisions
106    let p_zone = zone;
107
108    let uri_str = format!("{}/v1/dns/zones/{zone}", configuration.base_path, zone=crate::apis::urlencode(p_zone));
109    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
110
111    if let Some(ref user_agent) = configuration.user_agent {
112        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
113    }
114    if let Some(ref token) = configuration.bearer_access_token {
115        req_builder = req_builder.bearer_auth(token.to_owned());
116    };
117
118    let req = req_builder.build()?;
119    let resp = configuration.client.execute(req).await?;
120
121    let status = resp.status();
122
123    if !status.is_client_error() && !status.is_server_error() {
124        Ok(())
125    } else {
126        let content = resp.text().await?;
127        let entity: Option<DeleteDnsZonesByZoneError> = serde_json::from_str(&content).ok();
128        Err(Error::ResponseError(ResponseContent { status, content, entity }))
129    }
130}
131
132/// Removes one record from one zone. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
133pub async fn delete_dns_zones_by_zone_records_by_record(configuration: &configuration::Configuration, zone: &str, record: &str) -> Result<(), Error<DeleteDnsZonesByZoneRecordsByRecordError>> {
134    // add a prefix to parameters to efficiently prevent name collisions
135    let p_zone = zone;
136    let p_record = record;
137
138    let uri_str = format!("{}/v1/dns/zones/{zone}/records/{record}", configuration.base_path, zone=crate::apis::urlencode(p_zone), record=crate::apis::urlencode(p_record));
139    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
140
141    if let Some(ref user_agent) = configuration.user_agent {
142        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
143    }
144    if let Some(ref token) = configuration.bearer_access_token {
145        req_builder = req_builder.bearer_auth(token.to_owned());
146    };
147
148    let req = req_builder.build()?;
149    let resp = configuration.client.execute(req).await?;
150
151    let status = resp.status();
152
153    if !status.is_client_error() && !status.is_server_error() {
154        Ok(())
155    } else {
156        let content = resp.text().await?;
157        let entity: Option<DeleteDnsZonesByZoneRecordsByRecordError> = serde_json::from_str(&content).ok();
158        Err(Error::ResponseError(ResponseContent { status, content, entity }))
159    }
160}
161
162/// Reports whether the DNS control plane is answering. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
163pub async fn get_dns_health(configuration: &configuration::Configuration, ) -> Result<(), Error<GetDnsHealthError>> {
164
165    let uri_str = format!("{}/v1/dns/health", configuration.base_path);
166    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
167
168    if let Some(ref user_agent) = configuration.user_agent {
169        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
170    }
171    if let Some(ref token) = configuration.bearer_access_token {
172        req_builder = req_builder.bearer_auth(token.to_owned());
173    };
174
175    let req = req_builder.build()?;
176    let resp = configuration.client.execute(req).await?;
177
178    let status = resp.status();
179
180    if !status.is_client_error() && !status.is_server_error() {
181        Ok(())
182    } else {
183        let content = resp.text().await?;
184        let entity: Option<GetDnsHealthError> = serde_json::from_str(&content).ok();
185        Err(Error::ResponseError(ResponseContent { status, content, entity }))
186    }
187}
188
189/// Lists every DNS zone the calling org holds, authoritative and provider-backed alike. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
190pub async fn get_dns_zones(configuration: &configuration::Configuration, ) -> Result<(), Error<GetDnsZonesError>> {
191
192    let uri_str = format!("{}/v1/dns/zones", configuration.base_path);
193    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
194
195    if let Some(ref user_agent) = configuration.user_agent {
196        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
197    }
198    if let Some(ref token) = configuration.bearer_access_token {
199        req_builder = req_builder.bearer_auth(token.to_owned());
200    };
201
202    let req = req_builder.build()?;
203    let resp = configuration.client.execute(req).await?;
204
205    let status = resp.status();
206
207    if !status.is_client_error() && !status.is_server_error() {
208        Ok(())
209    } else {
210        let content = resp.text().await?;
211        let entity: Option<GetDnsZonesError> = serde_json::from_str(&content).ok();
212        Err(Error::ResponseError(ResponseContent { status, content, entity }))
213    }
214}
215
216/// Reads one of the calling org's zones by name. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
217pub async fn get_dns_zones_by_zone(configuration: &configuration::Configuration, zone: &str) -> Result<(), Error<GetDnsZonesByZoneError>> {
218    // add a prefix to parameters to efficiently prevent name collisions
219    let p_zone = zone;
220
221    let uri_str = format!("{}/v1/dns/zones/{zone}", configuration.base_path, zone=crate::apis::urlencode(p_zone));
222    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
223
224    if let Some(ref user_agent) = configuration.user_agent {
225        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
226    }
227    if let Some(ref token) = configuration.bearer_access_token {
228        req_builder = req_builder.bearer_auth(token.to_owned());
229    };
230
231    let req = req_builder.build()?;
232    let resp = configuration.client.execute(req).await?;
233
234    let status = resp.status();
235
236    if !status.is_client_error() && !status.is_server_error() {
237        Ok(())
238    } else {
239        let content = resp.text().await?;
240        let entity: Option<GetDnsZonesByZoneError> = serde_json::from_str(&content).ok();
241        Err(Error::ResponseError(ResponseContent { status, content, entity }))
242    }
243}
244
245/// Lists the records in one zone. A provider-backed zone is read from the provider, which is its source of truth. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
246pub async fn get_dns_zones_by_zone_records(configuration: &configuration::Configuration, zone: &str) -> Result<(), Error<GetDnsZonesByZoneRecordsError>> {
247    // add a prefix to parameters to efficiently prevent name collisions
248    let p_zone = zone;
249
250    let uri_str = format!("{}/v1/dns/zones/{zone}/records", configuration.base_path, zone=crate::apis::urlencode(p_zone));
251    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
252
253    if let Some(ref user_agent) = configuration.user_agent {
254        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
255    }
256    if let Some(ref token) = configuration.bearer_access_token {
257        req_builder = req_builder.bearer_auth(token.to_owned());
258    };
259
260    let req = req_builder.build()?;
261    let resp = configuration.client.execute(req).await?;
262
263    let status = resp.status();
264
265    if !status.is_client_error() && !status.is_server_error() {
266        Ok(())
267    } else {
268        let content = resp.text().await?;
269        let entity: Option<GetDnsZonesByZoneRecordsError> = serde_json::from_str(&content).ok();
270        Err(Error::ResponseError(ResponseContent { status, content, entity }))
271    }
272}
273
274/// Reads one record of one zone by its id. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
275pub async fn get_dns_zones_by_zone_records_by_record(configuration: &configuration::Configuration, zone: &str, record: &str) -> Result<(), Error<GetDnsZonesByZoneRecordsByRecordError>> {
276    // add a prefix to parameters to efficiently prevent name collisions
277    let p_zone = zone;
278    let p_record = record;
279
280    let uri_str = format!("{}/v1/dns/zones/{zone}/records/{record}", configuration.base_path, zone=crate::apis::urlencode(p_zone), record=crate::apis::urlencode(p_record));
281    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
282
283    if let Some(ref user_agent) = configuration.user_agent {
284        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
285    }
286    if let Some(ref token) = configuration.bearer_access_token {
287        req_builder = req_builder.bearer_auth(token.to_owned());
288    };
289
290    let req = req_builder.build()?;
291    let resp = configuration.client.execute(req).await?;
292
293    let status = resp.status();
294
295    if !status.is_client_error() && !status.is_server_error() {
296        Ok(())
297    } else {
298        let content = resp.text().await?;
299        let entity: Option<GetDnsZonesByZoneRecordsByRecordError> = serde_json::from_str(&content).ok();
300        Err(Error::ResponseError(ResponseContent { status, content, entity }))
301    }
302}
303
304/// Amends one record of one zone. Only the fields the body carries change; the rest keep the values they hold at the plane. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
305pub async fn patch_dns_zones_by_zone_records_by_record(configuration: &configuration::Configuration, zone: &str, record: &str) -> Result<(), Error<PatchDnsZonesByZoneRecordsByRecordError>> {
306    // add a prefix to parameters to efficiently prevent name collisions
307    let p_zone = zone;
308    let p_record = record;
309
310    let uri_str = format!("{}/v1/dns/zones/{zone}/records/{record}", configuration.base_path, zone=crate::apis::urlencode(p_zone), record=crate::apis::urlencode(p_record));
311    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
312
313    if let Some(ref user_agent) = configuration.user_agent {
314        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
315    }
316    if let Some(ref token) = configuration.bearer_access_token {
317        req_builder = req_builder.bearer_auth(token.to_owned());
318    };
319
320    let req = req_builder.build()?;
321    let resp = configuration.client.execute(req).await?;
322
323    let status = resp.status();
324
325    if !status.is_client_error() && !status.is_server_error() {
326        Ok(())
327    } else {
328        let content = resp.text().await?;
329        let entity: Option<PatchDnsZonesByZoneRecordsByRecordError> = serde_json::from_str(&content).ok();
330        Err(Error::ResponseError(ResponseContent { status, content, entity }))
331    }
332}
333
334/// Replaces the calling org's zones and their records in bulk. The owning org is the caller's own validated claim, never the body, so a sync reaches nobody else's zones. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
335pub async fn post_dns_sync(configuration: &configuration::Configuration, ) -> Result<(), Error<PostDnsSyncError>> {
336
337    let uri_str = format!("{}/v1/dns/sync", configuration.base_path);
338    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
339
340    if let Some(ref user_agent) = configuration.user_agent {
341        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
342    }
343    if let Some(ref token) = configuration.bearer_access_token {
344        req_builder = req_builder.bearer_auth(token.to_owned());
345    };
346
347    let req = req_builder.build()?;
348    let resp = configuration.client.execute(req).await?;
349
350    let status = resp.status();
351
352    if !status.is_client_error() && !status.is_server_error() {
353        Ok(())
354    } else {
355        let content = resp.text().await?;
356        let entity: Option<PostDnsSyncError> = serde_json::from_str(&content).ok();
357        Err(Error::ResponseError(ResponseContent { status, content, entity }))
358    }
359}
360
361/// Creates a zone for the calling org — authoritative, or backed by a DNS provider the org has connected. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
362pub async fn post_dns_zones(configuration: &configuration::Configuration, ) -> Result<(), Error<PostDnsZonesError>> {
363
364    let uri_str = format!("{}/v1/dns/zones", configuration.base_path);
365    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
366
367    if let Some(ref user_agent) = configuration.user_agent {
368        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
369    }
370    if let Some(ref token) = configuration.bearer_access_token {
371        req_builder = req_builder.bearer_auth(token.to_owned());
372    };
373
374    let req = req_builder.build()?;
375    let resp = configuration.client.execute(req).await?;
376
377    let status = resp.status();
378
379    if !status.is_client_error() && !status.is_server_error() {
380        Ok(())
381    } else {
382        let content = resp.text().await?;
383        let entity: Option<PostDnsZonesError> = serde_json::from_str(&content).ok();
384        Err(Error::ResponseError(ResponseContent { status, content, entity }))
385    }
386}
387
388/// Creates a record in one zone. A provider-backed zone is written at the provider first, then mirrored locally so the resolver serves it. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
389pub async fn post_dns_zones_by_zone_records(configuration: &configuration::Configuration, zone: &str) -> Result<(), Error<PostDnsZonesByZoneRecordsError>> {
390    // add a prefix to parameters to efficiently prevent name collisions
391    let p_zone = zone;
392
393    let uri_str = format!("{}/v1/dns/zones/{zone}/records", configuration.base_path, zone=crate::apis::urlencode(p_zone));
394    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
395
396    if let Some(ref user_agent) = configuration.user_agent {
397        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
398    }
399    if let Some(ref token) = configuration.bearer_access_token {
400        req_builder = req_builder.bearer_auth(token.to_owned());
401    };
402
403    let req = req_builder.build()?;
404    let resp = configuration.client.execute(req).await?;
405
406    let status = resp.status();
407
408    if !status.is_client_error() && !status.is_server_error() {
409        Ok(())
410    } else {
411        let content = resp.text().await?;
412        let entity: Option<PostDnsZonesByZoneRecordsError> = serde_json::from_str(&content).ok();
413        Err(Error::ResponseError(ResponseContent { status, content, entity }))
414    }
415}
416
417/// Amends one record of one zone. Only the fields the body carries change; this is the same partial update PATCH performs, not a replacement of the whole record. The plane owns the authoritative zone and record store behind every name pointed at Hanzo; this head keeps none of it. The address and the query string ARE the plane's own, relayed verbatim, and the plane's answer comes back unchanged — its status code, its Content-Type, and its Location on a redirect this head never follows.  It travels under the CALLER'S OWN identity and substitutes no service credential, which would collapse tenants: the caller's validated session bearer goes upstream as Authorization and the server-validated org as X-Org-Id, so a caller in one org reaches only that org's zones, exactly as if it had called the plane directly. The upstream host comes only from deployment config, never from the request, so no path can re-target another host.  Fails closed before a byte leaves cloud: no validated principal is 403; an API key is 401, because a pk-/sk- key is not a JWT the OIDC-gated plane can validate and there is no substitute credential to send in its place; a path that normalizes outside /v1/dns, or still carries a percent-escape or a `..` after one decode, is 400; an unconfigured plane is 503 and an unreachable one 502.
418pub async fn put_dns_zones_by_zone_records_by_record(configuration: &configuration::Configuration, zone: &str, record: &str) -> Result<(), Error<PutDnsZonesByZoneRecordsByRecordError>> {
419    // add a prefix to parameters to efficiently prevent name collisions
420    let p_zone = zone;
421    let p_record = record;
422
423    let uri_str = format!("{}/v1/dns/zones/{zone}/records/{record}", configuration.base_path, zone=crate::apis::urlencode(p_zone), record=crate::apis::urlencode(p_record));
424    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
425
426    if let Some(ref user_agent) = configuration.user_agent {
427        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
428    }
429    if let Some(ref token) = configuration.bearer_access_token {
430        req_builder = req_builder.bearer_auth(token.to_owned());
431    };
432
433    let req = req_builder.build()?;
434    let resp = configuration.client.execute(req).await?;
435
436    let status = resp.status();
437
438    if !status.is_client_error() && !status.is_server_error() {
439        Ok(())
440    } else {
441        let content = resp.text().await?;
442        let entity: Option<PutDnsZonesByZoneRecordsByRecordError> = serde_json::from_str(&content).ok();
443        Err(Error::ResponseError(ResponseContent { status, content, entity }))
444    }
445}
446