Skip to main content

hanzo_client/apis/
platform_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_platform_projects_by_project_apps_by_app`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum DeletePlatformProjectsByProjectAppsByAppError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`delete_platform_projects_by_project_apps_by_app_domains_by_host`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum DeletePlatformProjectsByProjectAppsByAppDomainsByHostError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_platform_apps`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetPlatformAppsError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_platform_apps_by_app`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetPlatformAppsByAppError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_platform_apps_by_app_cd`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetPlatformAppsByAppCdError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_platform_builds`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetPlatformBuildsError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`get_platform_cd`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetPlatformCdError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`get_platform_ci`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetPlatformCiError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`get_platform_environments`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetPlatformEnvironmentsError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`get_platform_fleet`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetPlatformFleetError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`get_platform_fleet_by_app`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum GetPlatformFleetByAppError {
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_platform_health`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetPlatformHealthError {
99    Status503(models::Readiness),
100    UnknownValue(serde_json::Value),
101}
102
103/// struct for typed errors of method [`get_platform_pipelines`]
104#[derive(Debug, Clone, Serialize, Deserialize)]
105#[serde(untagged)]
106pub enum GetPlatformPipelinesError {
107    UnknownValue(serde_json::Value),
108}
109
110/// struct for typed errors of method [`get_platform_projects`]
111#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum GetPlatformProjectsError {
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`get_platform_projects_by_project`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum GetPlatformProjectsByProjectError {
121    UnknownValue(serde_json::Value),
122}
123
124/// struct for typed errors of method [`get_platform_projects_by_project_apps`]
125#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum GetPlatformProjectsByProjectAppsError {
128    UnknownValue(serde_json::Value),
129}
130
131/// struct for typed errors of method [`get_platform_projects_by_project_apps_by_app`]
132#[derive(Debug, Clone, Serialize, Deserialize)]
133#[serde(untagged)]
134pub enum GetPlatformProjectsByProjectAppsByAppError {
135    UnknownValue(serde_json::Value),
136}
137
138/// struct for typed errors of method [`get_platform_projects_by_project_apps_by_app_deployments`]
139#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum GetPlatformProjectsByProjectAppsByAppDeploymentsError {
142    UnknownValue(serde_json::Value),
143}
144
145/// struct for typed errors of method [`get_platform_projects_by_project_apps_by_app_deployments_by_id`]
146#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum GetPlatformProjectsByProjectAppsByAppDeploymentsByIdError {
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`get_platform_projects_by_project_apps_by_app_deployments_by_id_logs`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum GetPlatformProjectsByProjectAppsByAppDeploymentsByIdLogsError {
156    UnknownValue(serde_json::Value),
157}
158
159/// struct for typed errors of method [`get_platform_projects_by_project_apps_by_app_domains`]
160#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum GetPlatformProjectsByProjectAppsByAppDomainsError {
163    UnknownValue(serde_json::Value),
164}
165
166/// struct for typed errors of method [`get_platform_releases`]
167#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum GetPlatformReleasesError {
170    UnknownValue(serde_json::Value),
171}
172
173/// struct for typed errors of method [`post_platform_apps`]
174#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum PostPlatformAppsError {
177    UnknownValue(serde_json::Value),
178}
179
180/// struct for typed errors of method [`post_platform_fleet_by_app_deploy`]
181#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum PostPlatformFleetByAppDeployError {
184    UnknownValue(serde_json::Value),
185}
186
187/// struct for typed errors of method [`post_platform_hook`]
188#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum PostPlatformHookError {
191    UnknownValue(serde_json::Value),
192}
193
194/// struct for typed errors of method [`post_platform_projects_by_project_apps`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum PostPlatformProjectsByProjectAppsError {
198    UnknownValue(serde_json::Value),
199}
200
201/// struct for typed errors of method [`post_platform_projects_by_project_apps_by_app_deploy`]
202#[derive(Debug, Clone, Serialize, Deserialize)]
203#[serde(untagged)]
204pub enum PostPlatformProjectsByProjectAppsByAppDeployError {
205    UnknownValue(serde_json::Value),
206}
207
208/// struct for typed errors of method [`post_platform_projects_by_project_apps_by_app_domains`]
209#[derive(Debug, Clone, Serialize, Deserialize)]
210#[serde(untagged)]
211pub enum PostPlatformProjectsByProjectAppsByAppDomainsError {
212    UnknownValue(serde_json::Value),
213}
214
215/// struct for typed errors of method [`post_platform_projects_by_project_apps_by_app_domains_by_host_verify`]
216#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum PostPlatformProjectsByProjectAppsByAppDomainsByHostVerifyError {
219    UnknownValue(serde_json::Value),
220}
221
222/// struct for typed errors of method [`post_platform_projects_by_project_apps_by_app_preview`]
223#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum PostPlatformProjectsByProjectAppsByAppPreviewError {
226    UnknownValue(serde_json::Value),
227}
228
229/// struct for typed errors of method [`post_platform_projects_by_project_apps_by_app_promote`]
230#[derive(Debug, Clone, Serialize, Deserialize)]
231#[serde(untagged)]
232pub enum PostPlatformProjectsByProjectAppsByAppPromoteError {
233    UnknownValue(serde_json::Value),
234}
235
236/// struct for typed errors of method [`post_platform_projects_by_project_apps_by_app_rollback`]
237#[derive(Debug, Clone, Serialize, Deserialize)]
238#[serde(untagged)]
239pub enum PostPlatformProjectsByProjectAppsByAppRollbackError {
240    UnknownValue(serde_json::Value),
241}
242
243/// struct for typed errors of method [`post_platform_projects_by_project_apps_by_app_start`]
244#[derive(Debug, Clone, Serialize, Deserialize)]
245#[serde(untagged)]
246pub enum PostPlatformProjectsByProjectAppsByAppStartError {
247    UnknownValue(serde_json::Value),
248}
249
250/// struct for typed errors of method [`post_platform_projects_by_project_apps_by_app_stop`]
251#[derive(Debug, Clone, Serialize, Deserialize)]
252#[serde(untagged)]
253pub enum PostPlatformProjectsByProjectAppsByAppStopError {
254    UnknownValue(serde_json::Value),
255}
256
257/// struct for typed errors of method [`post_platform_run`]
258#[derive(Debug, Clone, Serialize, Deserialize)]
259#[serde(untagged)]
260pub enum PostPlatformRunError {
261    UnknownValue(serde_json::Value),
262}
263
264/// struct for typed errors of method [`post_platform_runner`]
265#[derive(Debug, Clone, Serialize, Deserialize)]
266#[serde(untagged)]
267pub enum PostPlatformRunnerError {
268    UnknownValue(serde_json::Value),
269}
270
271/// struct for typed errors of method [`put_platform_projects_by_project_apps_by_app_env`]
272#[derive(Debug, Clone, Serialize, Deserialize)]
273#[serde(untagged)]
274pub enum PutPlatformProjectsByProjectAppsByAppEnvError {
275    UnknownValue(serde_json::Value),
276}
277
278
279/// Deletes an application and tears down what it runs.  It removes the application record and tears down what it owns in the org's tenant namespace — its operator Service CR and its KMSSecret — then answers 204. An app this org and project do not have is 404, never a silent success.  Teardown is best-effort by design: a cluster that refuses or is unreachable does not block the delete, so the record cannot be left orphaned behind a broken cluster; the failure is logged for operators and the orphan reaper reconciles it. Requires a validated principal; 403 without one.
280pub async fn delete_platform_projects_by_project_apps_by_app(configuration: &configuration::Configuration, project: &str, app: &str) -> Result<(), Error<DeletePlatformProjectsByProjectAppsByAppError>> {
281    // add a prefix to parameters to efficiently prevent name collisions
282    let p_project = project;
283    let p_app = app;
284
285    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
286    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
287
288    if let Some(ref user_agent) = configuration.user_agent {
289        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
290    }
291    if let Some(ref token) = configuration.bearer_access_token {
292        req_builder = req_builder.bearer_auth(token.to_owned());
293    };
294
295    let req = req_builder.build()?;
296    let resp = configuration.client.execute(req).await?;
297
298    let status = resp.status();
299
300    if !status.is_client_error() && !status.is_server_error() {
301        Ok(())
302    } else {
303        let content = resp.text().await?;
304        let entity: Option<DeletePlatformProjectsByProjectAppsByAppError> = serde_json::from_str(&content).ok();
305        Err(Error::ResponseError(ResponseContent { status, content, entity }))
306    }
307}
308
309/// Detaches a hostname and releases the claim.  It drops the host from the app's ingress and releases any custom claim on it, so the name becomes claimable again — by this org or any other. Answers 204.  The default host is permanent and cannot be removed: that is 400, not 404. A host that is neither attached nor claimed here is 404. Requires a validated principal; 403 without one.
310pub async fn delete_platform_projects_by_project_apps_by_app_domains_by_host(configuration: &configuration::Configuration, project: &str, app: &str, host: &str) -> Result<(), Error<DeletePlatformProjectsByProjectAppsByAppDomainsByHostError>> {
311    // add a prefix to parameters to efficiently prevent name collisions
312    let p_project = project;
313    let p_app = app;
314    let p_host = host;
315
316    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/domains/{host}", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app), host=crate::apis::urlencode(p_host));
317    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
318
319    if let Some(ref user_agent) = configuration.user_agent {
320        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
321    }
322    if let Some(ref token) = configuration.bearer_access_token {
323        req_builder = req_builder.bearer_auth(token.to_owned());
324    };
325
326    let req = req_builder.build()?;
327    let resp = configuration.client.execute(req).await?;
328
329    let status = resp.status();
330
331    if !status.is_client_error() && !status.is_server_error() {
332        Ok(())
333    } else {
334        let content = resp.text().await?;
335        let entity: Option<DeletePlatformProjectsByProjectAppsByAppDomainsByHostError> = serde_json::from_str(&content).ok();
336        Err(Error::ResponseError(ResponseContent { status, content, entity }))
337    }
338}
339
340/// Answers what this organisation has declared, joined with what the delivery plane has done about it.  The join is best-effort BY DESIGN and says so when it is missing: the declarations ARE the answer to \"what have I deployed\", so refusing the whole board because the cluster is unreadable would lose the half that is readable. What must never happen is a silent null — an unreadable plane is reported as `cd.unavailable` carrying the reason, never as an app with no reconciliation.
341pub async fn get_platform_apps(configuration: &configuration::Configuration, org: Option<&str>) -> Result<models::DeclaredResp, Error<GetPlatformAppsError>> {
342    // add a prefix to parameters to efficiently prevent name collisions
343    let p_org = org;
344
345    let uri_str = format!("{}/v1/platform/apps", configuration.base_path);
346    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
347
348    if let Some(ref param_value) = p_org {
349        req_builder = req_builder.query(&[("org", &param_value.to_string())]);
350    }
351    if let Some(ref user_agent) = configuration.user_agent {
352        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
353    }
354    if let Some(ref token) = configuration.bearer_access_token {
355        req_builder = req_builder.bearer_auth(token.to_owned());
356    };
357
358    let req = req_builder.build()?;
359    let resp = configuration.client.execute(req).await?;
360
361    let status = resp.status();
362    let content_type = resp
363        .headers()
364        .get("content-type")
365        .and_then(|v| v.to_str().ok())
366        .unwrap_or("application/octet-stream");
367    let content_type = super::ContentType::from(content_type);
368
369    if !status.is_client_error() && !status.is_server_error() {
370        let content = resp.text().await?;
371        match content_type {
372            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
373            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeclaredResp`"))),
374            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeclaredResp`")))),
375        }
376    } else {
377        let content = resp.text().await?;
378        let entity: Option<GetPlatformAppsError> = serde_json::from_str(&content).ok();
379        Err(Error::ResponseError(ResponseContent { status, content, entity }))
380    }
381}
382
383/// Answers ONE declaration — what git says this app is, before the delivery plane has had any say in it.
384pub async fn get_platform_apps_by_app(configuration: &configuration::Configuration, app: &str, org: Option<&str>) -> Result<models::Declaration, Error<GetPlatformAppsByAppError>> {
385    // add a prefix to parameters to efficiently prevent name collisions
386    let p_app = app;
387    let p_org = org;
388
389    let uri_str = format!("{}/v1/platform/apps/{app}", configuration.base_path, app=crate::apis::urlencode(p_app));
390    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
391
392    if let Some(ref param_value) = p_org {
393        req_builder = req_builder.query(&[("org", &param_value.to_string())]);
394    }
395    if let Some(ref user_agent) = configuration.user_agent {
396        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
397    }
398    if let Some(ref token) = configuration.bearer_access_token {
399        req_builder = req_builder.bearer_auth(token.to_owned());
400    };
401
402    let req = req_builder.build()?;
403    let resp = configuration.client.execute(req).await?;
404
405    let status = resp.status();
406    let content_type = resp
407        .headers()
408        .get("content-type")
409        .and_then(|v| v.to_str().ok())
410        .unwrap_or("application/octet-stream");
411    let content_type = super::ContentType::from(content_type);
412
413    if !status.is_client_error() && !status.is_server_error() {
414        let content = resp.text().await?;
415        match content_type {
416            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
417            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Declaration`"))),
418            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Declaration`")))),
419        }
420    } else {
421        let content = resp.text().await?;
422        let entity: Option<GetPlatformAppsByAppError> = serde_json::from_str(&content).ok();
423        Err(Error::ResponseError(ResponseContent { status, content, entity }))
424    }
425}
426
427/// Answers ONE app's reconciliation alone — the poll a deploy console makes while it waits, without re-reading the whole inventory each time.
428pub async fn get_platform_apps_by_app_cd(configuration: &configuration::Configuration, app: &str, org: Option<&str>) -> Result<models::CdApp, Error<GetPlatformAppsByAppCdError>> {
429    // add a prefix to parameters to efficiently prevent name collisions
430    let p_app = app;
431    let p_org = org;
432
433    let uri_str = format!("{}/v1/platform/apps/{app}/cd", configuration.base_path, app=crate::apis::urlencode(p_app));
434    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
435
436    if let Some(ref param_value) = p_org {
437        req_builder = req_builder.query(&[("org", &param_value.to_string())]);
438    }
439    if let Some(ref user_agent) = configuration.user_agent {
440        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
441    }
442    if let Some(ref token) = configuration.bearer_access_token {
443        req_builder = req_builder.bearer_auth(token.to_owned());
444    };
445
446    let req = req_builder.build()?;
447    let resp = configuration.client.execute(req).await?;
448
449    let status = resp.status();
450    let content_type = resp
451        .headers()
452        .get("content-type")
453        .and_then(|v| v.to_str().ok())
454        .unwrap_or("application/octet-stream");
455    let content_type = super::ContentType::from(content_type);
456
457    if !status.is_client_error() && !status.is_server_error() {
458        let content = resp.text().await?;
459        match content_type {
460            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
461            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CdApp`"))),
462            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CdApp`")))),
463        }
464    } else {
465        let content = resp.text().await?;
466        let entity: Option<GetPlatformAppsByAppCdError> = serde_json::from_str(&content).ok();
467        Err(Error::ResponseError(ResponseContent { status, content, entity }))
468    }
469}
470
471/// Returns real build records for your org.  It lists the org's BuildKit build records — the git build step behind a deploy — each with the repo it built, the short commit, its status, when it started and how long it took. These are real records or an honest empty list; a build appears here because one ran, never because a page needed a row. Builds are created only by /deploy and the push-to-deploy hook. Requires a validated principal; 403 without one.
472pub async fn get_platform_builds(configuration: &configuration::Configuration, ) -> Result<models::BuildBoard, Error<GetPlatformBuildsError>> {
473
474    let uri_str = format!("{}/v1/platform/builds", configuration.base_path);
475    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
476
477    if let Some(ref user_agent) = configuration.user_agent {
478        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
479    }
480    if let Some(ref token) = configuration.bearer_access_token {
481        req_builder = req_builder.bearer_auth(token.to_owned());
482    };
483
484    let req = req_builder.build()?;
485    let resp = configuration.client.execute(req).await?;
486
487    let status = resp.status();
488    let content_type = resp
489        .headers()
490        .get("content-type")
491        .and_then(|v| v.to_str().ok())
492        .unwrap_or("application/octet-stream");
493    let content_type = super::ContentType::from(content_type);
494
495    if !status.is_client_error() && !status.is_server_error() {
496        let content = resp.text().await?;
497        match content_type {
498            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
499            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BuildBoard`"))),
500            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::BuildBoard`")))),
501        }
502    } else {
503        let content = resp.text().await?;
504        let entity: Option<GetPlatformBuildsError> = serde_json::from_str(&content).ok();
505        Err(Error::ResponseError(ResponseContent { status, content, entity }))
506    }
507}
508
509/// Answers every Application the delivery plane holds.  Scoped to the namespaces the caller's own validated org owns: the ROLE admits the caller and the tenant boundary is applied inside, so an admin of one org never observes another's.
510pub async fn get_platform_cd(configuration: &configuration::Configuration, ) -> Result<models::CdResp, Error<GetPlatformCdError>> {
511
512    let uri_str = format!("{}/v1/platform/cd", configuration.base_path);
513    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
514
515    if let Some(ref user_agent) = configuration.user_agent {
516        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
517    }
518    if let Some(ref token) = configuration.bearer_access_token {
519        req_builder = req_builder.bearer_auth(token.to_owned());
520    };
521
522    let req = req_builder.build()?;
523    let resp = configuration.client.execute(req).await?;
524
525    let status = resp.status();
526    let content_type = resp
527        .headers()
528        .get("content-type")
529        .and_then(|v| v.to_str().ok())
530        .unwrap_or("application/octet-stream");
531    let content_type = super::ContentType::from(content_type);
532
533    if !status.is_client_error() && !status.is_server_error() {
534        let content = resp.text().await?;
535        match content_type {
536            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
537            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CdResp`"))),
538            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CdResp`")))),
539        }
540    } else {
541        let content = resp.text().await?;
542        let entity: Option<GetPlatformCdError> = serde_json::from_str(&content).ok();
543        Err(Error::ResponseError(ResponseContent { status, content, entity }))
544    }
545}
546
547/// Answers 501. The forge's Actions runs need a Forgejo API client and this deployment has none; an empty run list would be indistinguishable from a forge with no runs.
548pub async fn get_platform_ci(configuration: &configuration::Configuration, ) -> Result<(), Error<GetPlatformCiError>> {
549
550    let uri_str = format!("{}/v1/platform/ci", configuration.base_path);
551    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
552
553    if let Some(ref user_agent) = configuration.user_agent {
554        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
555    }
556    if let Some(ref token) = configuration.bearer_access_token {
557        req_builder = req_builder.bearer_auth(token.to_owned());
558    };
559
560    let req = req_builder.build()?;
561    let resp = configuration.client.execute(req).await?;
562
563    let status = resp.status();
564
565    if !status.is_client_error() && !status.is_server_error() {
566        Ok(())
567    } else {
568        let content = resp.text().await?;
569        let entity: Option<GetPlatformCiError> = serde_json::from_str(&content).ok();
570        Err(Error::ResponseError(ResponseContent { status, content, entity }))
571    }
572}
573
574/// Returns your deploy targets, and what is running on each.  It returns the org's environments — the distinct deploy targets its applications name, `production` for anything that names none — each aggregating the apps that target it, a rolled-up status and when it last changed.  An environment is DERIVED, not stored: there is nothing to create or delete here, and an environment exists exactly as long as an app points at it. Requires a validated principal; 403 without one.
575pub async fn get_platform_environments(configuration: &configuration::Configuration, ) -> Result<models::EnvironmentBoard, Error<GetPlatformEnvironmentsError>> {
576
577    let uri_str = format!("{}/v1/platform/environments", configuration.base_path);
578    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
579
580    if let Some(ref user_agent) = configuration.user_agent {
581        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
582    }
583    if let Some(ref token) = configuration.bearer_access_token {
584        req_builder = req_builder.bearer_auth(token.to_owned());
585    };
586
587    let req = req_builder.build()?;
588    let resp = configuration.client.execute(req).await?;
589
590    let status = resp.status();
591    let content_type = resp
592        .headers()
593        .get("content-type")
594        .and_then(|v| v.to_str().ok())
595        .unwrap_or("application/octet-stream");
596    let content_type = super::ContentType::from(content_type);
597
598    if !status.is_client_error() && !status.is_server_error() {
599        let content = resp.text().await?;
600        match content_type {
601            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
602            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::EnvironmentBoard`"))),
603            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::EnvironmentBoard`")))),
604        }
605    } else {
606        let content = resp.text().await?;
607        let entity: Option<GetPlatformEnvironmentsError> = serde_json::from_str(&content).ok();
608        Err(Error::ResponseError(ResponseContent { status, content, entity }))
609    }
610}
611
612/// Returns the platform's own service tier, and where it has drifted.  It returns the board for the services the PLATFORM itself runs — iam, kms, gateway and the rest — as `{apps, summary}`: per service its environment, health, phase, the image tag its CR DECLARES, the tag actually running, and the drift between them, plus a summary counting the board green, yellow and red.  This is not a customer surface. `/v1/platform/projects/:project/apps` is a tenant's apps; this is the tier those tenants run ON, which is why the two are named differently rather than sharing a prefix.  Admission is scoped at the SCAN, before any CR is read: a platform SuperAdmin observes the whole fleet, an org admin observes only their own org's namespaces, and an org that owns none gets an empty board — a non-super caller never even lists another org's services. Narrow further with `env`, `health`, `org`, or `drift=1` for only what has drifted.  It degrades honestly rather than failing whole: a namespace that does not exist is skipped, and a running-state read the caller cannot make leaves the running tag empty — an unknown, never a guess — while the declared, health and phase columns still render.
613pub async fn get_platform_fleet(configuration: &configuration::Configuration, env: Option<&str>, health: Option<&str>, org: Option<&str>, drift: Option<&str>) -> Result<models::DriftBoard, Error<GetPlatformFleetError>> {
614    // add a prefix to parameters to efficiently prevent name collisions
615    let p_env = env;
616    let p_health = health;
617    let p_org = org;
618    let p_drift = drift;
619
620    let uri_str = format!("{}/v1/platform/fleet", configuration.base_path);
621    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
622
623    if let Some(ref param_value) = p_env {
624        req_builder = req_builder.query(&[("env", &param_value.to_string())]);
625    }
626    if let Some(ref param_value) = p_health {
627        req_builder = req_builder.query(&[("health", &param_value.to_string())]);
628    }
629    if let Some(ref param_value) = p_org {
630        req_builder = req_builder.query(&[("org", &param_value.to_string())]);
631    }
632    if let Some(ref param_value) = p_drift {
633        req_builder = req_builder.query(&[("drift", &param_value.to_string())]);
634    }
635    if let Some(ref user_agent) = configuration.user_agent {
636        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
637    }
638    if let Some(ref token) = configuration.bearer_access_token {
639        req_builder = req_builder.bearer_auth(token.to_owned());
640    };
641
642    let req = req_builder.build()?;
643    let resp = configuration.client.execute(req).await?;
644
645    let status = resp.status();
646    let content_type = resp
647        .headers()
648        .get("content-type")
649        .and_then(|v| v.to_str().ok())
650        .unwrap_or("application/octet-stream");
651    let content_type = super::ContentType::from(content_type);
652
653    if !status.is_client_error() && !status.is_server_error() {
654        let content = resp.text().await?;
655        match content_type {
656            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
657            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DriftBoard`"))),
658            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DriftBoard`")))),
659        }
660    } else {
661        let content = resp.text().await?;
662        let entity: Option<GetPlatformFleetError> = serde_json::from_str(&content).ok();
663        Err(Error::ResponseError(ResponseContent { status, content, entity }))
664    }
665}
666
667/// Returns one platform service, resolved to production by default.  It returns a single platform service by its CR name, with the same declared-versus-running and drift facts the board carries. The name must be a DNS-1123 label; anything else is 400.  Namespaces are scanned in lifecycle order — main, then test, then dev — and the first match wins, so a bare name resolves to PRODUCTION. The scan covers only the namespaces the caller is authorized for, so an org admin can never read a service outside their own org, and a name found in none of them is 404 rather than a leak.
668pub async fn get_platform_fleet_by_app(configuration: &configuration::Configuration, app: &str, env: Option<&str>) -> Result<models::AppView, Error<GetPlatformFleetByAppError>> {
669    // add a prefix to parameters to efficiently prevent name collisions
670    let p_app = app;
671    let p_env = env;
672
673    let uri_str = format!("{}/v1/platform/fleet/{app}", configuration.base_path, app=crate::apis::urlencode(p_app));
674    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
675
676    if let Some(ref param_value) = p_env {
677        req_builder = req_builder.query(&[("env", &param_value.to_string())]);
678    }
679    if let Some(ref user_agent) = configuration.user_agent {
680        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
681    }
682    if let Some(ref token) = configuration.bearer_access_token {
683        req_builder = req_builder.bearer_auth(token.to_owned());
684    };
685
686    let req = req_builder.build()?;
687    let resp = configuration.client.execute(req).await?;
688
689    let status = resp.status();
690    let content_type = resp
691        .headers()
692        .get("content-type")
693        .and_then(|v| v.to_str().ok())
694        .unwrap_or("application/octet-stream");
695    let content_type = super::ContentType::from(content_type);
696
697    if !status.is_client_error() && !status.is_server_error() {
698        let content = resp.text().await?;
699        match content_type {
700            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
701            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AppView`"))),
702            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AppView`")))),
703        }
704    } else {
705        let content = resp.text().await?;
706        let entity: Option<GetPlatformFleetByAppError> = serde_json::from_str(&content).ok();
707        Err(Error::ResponseError(ResponseContent { status, content, entity }))
708    }
709}
710
711/// Reports whether this control plane can actually deploy anything.  A real probe, not a status page. It answers 200 only when the metadata store is open AND the cluster is genuinely reachable — proved by LISTING the operator App CRD, which settles reachability and CRD presence in one bounded call, and which is the exact question every deploy depends on. Anything else is 503 carrying the real reason and whether the CRD was found.  A constructed cluster client proves nothing — it is built from a kubeconfig, not from a reachable apiserver — so this deliberately spends a round trip rather than reporting `ok` while every deploy fails. Not admin-gated: liveness has to be probe-able without a credential.
712pub async fn get_platform_health(configuration: &configuration::Configuration, ) -> Result<models::Readiness, Error<GetPlatformHealthError>> {
713
714    let uri_str = format!("{}/v1/platform/health", configuration.base_path);
715    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
716
717    if let Some(ref user_agent) = configuration.user_agent {
718        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
719    }
720    if let Some(ref token) = configuration.bearer_access_token {
721        req_builder = req_builder.bearer_auth(token.to_owned());
722    };
723
724    let req = req_builder.build()?;
725    let resp = configuration.client.execute(req).await?;
726
727    let status = resp.status();
728    let content_type = resp
729        .headers()
730        .get("content-type")
731        .and_then(|v| v.to_str().ok())
732        .unwrap_or("application/octet-stream");
733    let content_type = super::ContentType::from(content_type);
734
735    if !status.is_client_error() && !status.is_server_error() {
736        let content = resp.text().await?;
737        match content_type {
738            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
739            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Readiness`"))),
740            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Readiness`")))),
741        }
742    } else {
743        let content = resp.text().await?;
744        let entity: Option<GetPlatformHealthError> = serde_json::from_str(&content).ok();
745        Err(Error::ResponseError(ResponseContent { status, content, entity }))
746    }
747}
748
749/// Returns one build-and-deploy pipeline per app, with its latest run.  It returns one pipeline per application in the caller's org — its repo or image source, its current status, and when its most recent deployment ran and how long it took. A pipeline is a PROJECTION of an app plus its newest deployment, not a separate record: it comes into existence with the app and is triggered only through /deploy, never here. Requires a validated principal; 403 without one.
750pub async fn get_platform_pipelines(configuration: &configuration::Configuration, ) -> Result<models::PipelineBoard, Error<GetPlatformPipelinesError>> {
751
752    let uri_str = format!("{}/v1/platform/pipelines", configuration.base_path);
753    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
754
755    if let Some(ref user_agent) = configuration.user_agent {
756        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
757    }
758    if let Some(ref token) = configuration.bearer_access_token {
759        req_builder = req_builder.bearer_auth(token.to_owned());
760    };
761
762    let req = req_builder.build()?;
763    let resp = configuration.client.execute(req).await?;
764
765    let status = resp.status();
766    let content_type = resp
767        .headers()
768        .get("content-type")
769        .and_then(|v| v.to_str().ok())
770        .unwrap_or("application/octet-stream");
771    let content_type = super::ContentType::from(content_type);
772
773    if !status.is_client_error() && !status.is_server_error() {
774        let content = resp.text().await?;
775        match content_type {
776            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
777            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PipelineBoard`"))),
778            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PipelineBoard`")))),
779        }
780    } else {
781        let content = resp.text().await?;
782        let entity: Option<GetPlatformPipelinesError> = serde_json::from_str(&content).ok();
783        Err(Error::ResponseError(ResponseContent { status, content, entity }))
784    }
785}
786
787/// Returns your org's projects, each with how many apps live under it.  It lists the caller org's projects with the number of platform applications in each. A project is IAM's resource — it is created and deleted at /v1/iam/projects, never here — so this is the ONE projection IAM cannot serve: the project plus what the platform has put under it.  Requires a validated principal; 403 without one, and the org comes from that validated identity rather than a request header. This is the console's first authenticated read, so a project store that is not yet initialised degrades to an EMPTY list rather than a 500 — a new org genuinely has zero projects — and the real cause is surfaced to operators instead of to the caller.
788pub async fn get_platform_projects(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProjectView>, Error<GetPlatformProjectsError>> {
789
790    let uri_str = format!("{}/v1/platform/projects", configuration.base_path);
791    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
792
793    if let Some(ref user_agent) = configuration.user_agent {
794        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
795    }
796    if let Some(ref token) = configuration.bearer_access_token {
797        req_builder = req_builder.bearer_auth(token.to_owned());
798    };
799
800    let req = req_builder.build()?;
801    let resp = configuration.client.execute(req).await?;
802
803    let status = resp.status();
804    let content_type = resp
805        .headers()
806        .get("content-type")
807        .and_then(|v| v.to_str().ok())
808        .unwrap_or("application/octet-stream");
809    let content_type = super::ContentType::from(content_type);
810
811    if !status.is_client_error() && !status.is_server_error() {
812        let content = resp.text().await?;
813        match content_type {
814            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
815            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::ProjectView&gt;`"))),
816            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::ProjectView&gt;`")))),
817        }
818    } else {
819        let content = resp.text().await?;
820        let entity: Option<GetPlatformProjectsError> = serde_json::from_str(&content).ok();
821        Err(Error::ResponseError(ResponseContent { status, content, entity }))
822    }
823}
824
825/// Returns one project and its app count.  It returns a single project of the caller's org with the number of platform applications under it. A project this org does not have is 404, which is also what another tenant's project looks like from here. Requires a validated principal; 403 without one.
826pub async fn get_platform_projects_by_project(configuration: &configuration::Configuration, project: &str) -> Result<models::ProjectView, Error<GetPlatformProjectsByProjectError>> {
827    // add a prefix to parameters to efficiently prevent name collisions
828    let p_project = project;
829
830    let uri_str = format!("{}/v1/platform/projects/{project}", configuration.base_path, project=crate::apis::urlencode(p_project));
831    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
832
833    if let Some(ref user_agent) = configuration.user_agent {
834        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
835    }
836    if let Some(ref token) = configuration.bearer_access_token {
837        req_builder = req_builder.bearer_auth(token.to_owned());
838    };
839
840    let req = req_builder.build()?;
841    let resp = configuration.client.execute(req).await?;
842
843    let status = resp.status();
844    let content_type = resp
845        .headers()
846        .get("content-type")
847        .and_then(|v| v.to_str().ok())
848        .unwrap_or("application/octet-stream");
849    let content_type = super::ContentType::from(content_type);
850
851    if !status.is_client_error() && !status.is_server_error() {
852        let content = resp.text().await?;
853        match content_type {
854            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
855            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ProjectView`"))),
856            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ProjectView`")))),
857        }
858    } else {
859        let content = resp.text().await?;
860        let entity: Option<GetPlatformProjectsByProjectError> = serde_json::from_str(&content).ok();
861        Err(Error::ResponseError(ResponseContent { status, content, entity }))
862    }
863}
864
865/// Returns the applications in one project, with what the cluster says about them.  It lists the caller org's applications under one project. Each row carries the stored record and, for an app that is live or deploying, the LIVE phase and health read from its operator Service CR; an app with sealed env also carries its secret-sync state. Those cluster reads are best-effort — an unreachable cluster leaves those fields empty and never blocks the listing.  The project must exist in IAM for this org, or the answer is 404; the `default` project is implicit and always accepted, because it is part of what an org IS. Requires a validated principal; 403 without one.
866pub async fn get_platform_projects_by_project_apps(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::AppView>, Error<GetPlatformProjectsByProjectAppsError>> {
867    // add a prefix to parameters to efficiently prevent name collisions
868    let p_project = project;
869
870    let uri_str = format!("{}/v1/platform/projects/{project}/apps", configuration.base_path, project=crate::apis::urlencode(p_project));
871    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
872
873    if let Some(ref user_agent) = configuration.user_agent {
874        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
875    }
876    if let Some(ref token) = configuration.bearer_access_token {
877        req_builder = req_builder.bearer_auth(token.to_owned());
878    };
879
880    let req = req_builder.build()?;
881    let resp = configuration.client.execute(req).await?;
882
883    let status = resp.status();
884    let content_type = resp
885        .headers()
886        .get("content-type")
887        .and_then(|v| v.to_str().ok())
888        .unwrap_or("application/octet-stream");
889    let content_type = super::ContentType::from(content_type);
890
891    if !status.is_client_error() && !status.is_server_error() {
892        let content = resp.text().await?;
893        match content_type {
894            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
895            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::AppView&gt;`"))),
896            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::AppView&gt;`")))),
897        }
898    } else {
899        let content = resp.text().await?;
900        let entity: Option<GetPlatformProjectsByProjectAppsError> = serde_json::from_str(&content).ok();
901        Err(Error::ResponseError(ResponseContent { status, content, entity }))
902    }
903}
904
905/// Returns one application, with its live phase, health and secret sync.  It returns a single application of the caller's org together with what the cluster currently reports for it: the operator Service CR's phase and health, and whether its sealed env has synced. An app this org and project do not have is 404. Requires a validated principal; 403 without one.
906pub async fn get_platform_projects_by_project_apps_by_app(configuration: &configuration::Configuration, project: &str, app: &str) -> Result<models::AppView, Error<GetPlatformProjectsByProjectAppsByAppError>> {
907    // add a prefix to parameters to efficiently prevent name collisions
908    let p_project = project;
909    let p_app = app;
910
911    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
912    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
913
914    if let Some(ref user_agent) = configuration.user_agent {
915        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
916    }
917    if let Some(ref token) = configuration.bearer_access_token {
918        req_builder = req_builder.bearer_auth(token.to_owned());
919    };
920
921    let req = req_builder.build()?;
922    let resp = configuration.client.execute(req).await?;
923
924    let status = resp.status();
925    let content_type = resp
926        .headers()
927        .get("content-type")
928        .and_then(|v| v.to_str().ok())
929        .unwrap_or("application/octet-stream");
930    let content_type = super::ContentType::from(content_type);
931
932    if !status.is_client_error() && !status.is_server_error() {
933        let content = resp.text().await?;
934        match content_type {
935            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
936            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AppView`"))),
937            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AppView`")))),
938        }
939    } else {
940        let content = resp.text().await?;
941        let entity: Option<GetPlatformProjectsByProjectAppsByAppError> = serde_json::from_str(&content).ok();
942        Err(Error::ResponseError(ResponseContent { status, content, entity }))
943    }
944}
945
946/// Returns an app's deployment history.  It lists every deployment recorded for one of the caller org's applications, newest version first, each with its version, status, source, commit and image. Failed and superseded attempts are included — that is the point of a history. Requires a validated principal; 403 without one.
947pub async fn get_platform_projects_by_project_apps_by_app_deployments(configuration: &configuration::Configuration, project: &str, app: &str) -> Result<Vec<models::DeploymentView>, Error<GetPlatformProjectsByProjectAppsByAppDeploymentsError>> {
948    // add a prefix to parameters to efficiently prevent name collisions
949    let p_project = project;
950    let p_app = app;
951
952    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/deployments", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
953    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
954
955    if let Some(ref user_agent) = configuration.user_agent {
956        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
957    }
958    if let Some(ref token) = configuration.bearer_access_token {
959        req_builder = req_builder.bearer_auth(token.to_owned());
960    };
961
962    let req = req_builder.build()?;
963    let resp = configuration.client.execute(req).await?;
964
965    let status = resp.status();
966    let content_type = resp
967        .headers()
968        .get("content-type")
969        .and_then(|v| v.to_str().ok())
970        .unwrap_or("application/octet-stream");
971    let content_type = super::ContentType::from(content_type);
972
973    if !status.is_client_error() && !status.is_server_error() {
974        let content = resp.text().await?;
975        match content_type {
976            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
977            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::DeploymentView&gt;`"))),
978            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::DeploymentView&gt;`")))),
979        }
980    } else {
981        let content = resp.text().await?;
982        let entity: Option<GetPlatformProjectsByProjectAppsByAppDeploymentsError> = serde_json::from_str(&content).ok();
983        Err(Error::ResponseError(ResponseContent { status, content, entity }))
984    }
985}
986
987/// Returns one deployment of one app.  It returns a single deployment by id, scoped to the named application of the caller's org — so an id belonging to another app or another tenant is 404, not a read. Requires a validated principal; 403 without one.
988pub async fn get_platform_projects_by_project_apps_by_app_deployments_by_id(configuration: &configuration::Configuration, project: &str, app: &str, id: &str) -> Result<models::DeploymentView, Error<GetPlatformProjectsByProjectAppsByAppDeploymentsByIdError>> {
989    // add a prefix to parameters to efficiently prevent name collisions
990    let p_project = project;
991    let p_app = app;
992    let p_id = id;
993
994    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/deployments/{id}", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app), id=crate::apis::urlencode(p_id));
995    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
996
997    if let Some(ref user_agent) = configuration.user_agent {
998        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
999    }
1000    if let Some(ref token) = configuration.bearer_access_token {
1001        req_builder = req_builder.bearer_auth(token.to_owned());
1002    };
1003
1004    let req = req_builder.build()?;
1005    let resp = configuration.client.execute(req).await?;
1006
1007    let status = resp.status();
1008    let content_type = resp
1009        .headers()
1010        .get("content-type")
1011        .and_then(|v| v.to_str().ok())
1012        .unwrap_or("application/octet-stream");
1013    let content_type = super::ContentType::from(content_type);
1014
1015    if !status.is_client_error() && !status.is_server_error() {
1016        let content = resp.text().await?;
1017        match content_type {
1018            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1019            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeploymentView`"))),
1020            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeploymentView`")))),
1021        }
1022    } else {
1023        let content = resp.text().await?;
1024        let entity: Option<GetPlatformProjectsByProjectAppsByAppDeploymentsByIdError> = serde_json::from_str(&content).ok();
1025        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1026    }
1027}
1028
1029/// Returns real logs for a deployment — the build's, then the app's.  It returns the deployment's recorded status timeline together with LIVE pod logs pulled from the cluster: the build pod's output while a git build is running, and the running app's output once it is deployed. The `source` field says which of the two the body is — `build`, `app` or `none` — so a console can label the pane honestly.  It never fabricates log content. When no pod exists yet, or the cluster is unreachable, it degrades to the recorded timeline and says so. Every cluster read is confined to the caller org's own namespaces and time-boxed. Requires a validated principal; 403 without one.
1030pub async fn get_platform_projects_by_project_apps_by_app_deployments_by_id_logs(configuration: &configuration::Configuration, project: &str, app: &str, id: &str) -> Result<models::DeployLogs, Error<GetPlatformProjectsByProjectAppsByAppDeploymentsByIdLogsError>> {
1031    // add a prefix to parameters to efficiently prevent name collisions
1032    let p_project = project;
1033    let p_app = app;
1034    let p_id = id;
1035
1036    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/deployments/{id}/logs", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app), id=crate::apis::urlencode(p_id));
1037    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1038
1039    if let Some(ref user_agent) = configuration.user_agent {
1040        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1041    }
1042    if let Some(ref token) = configuration.bearer_access_token {
1043        req_builder = req_builder.bearer_auth(token.to_owned());
1044    };
1045
1046    let req = req_builder.build()?;
1047    let resp = configuration.client.execute(req).await?;
1048
1049    let status = resp.status();
1050    let content_type = resp
1051        .headers()
1052        .get("content-type")
1053        .and_then(|v| v.to_str().ok())
1054        .unwrap_or("application/octet-stream");
1055    let content_type = super::ContentType::from(content_type);
1056
1057    if !status.is_client_error() && !status.is_server_error() {
1058        let content = resp.text().await?;
1059        match content_type {
1060            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1061            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeployLogs`"))),
1062            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeployLogs`")))),
1063        }
1064    } else {
1065        let content = resp.text().await?;
1066        let entity: Option<GetPlatformProjectsByProjectAppsByAppDeploymentsByIdLogsError> = serde_json::from_str(&content).ok();
1067        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1068    }
1069}
1070
1071/// Returns every hostname this app answers on.  It lists the app's hosts: the permanent default host it was born with, any org-subtree hosts attached to it, and every custom host claimed for it with its verification state and, while pending, the DNS challenge records to publish. Live endpoint status for each host is observed from the cluster. Requires a validated principal; 403 without one.
1072pub async fn get_platform_projects_by_project_apps_by_app_domains(configuration: &configuration::Configuration, project: &str, app: &str) -> Result<Vec<models::DomainView>, Error<GetPlatformProjectsByProjectAppsByAppDomainsError>> {
1073    // add a prefix to parameters to efficiently prevent name collisions
1074    let p_project = project;
1075    let p_app = app;
1076
1077    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/domains", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1078    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1079
1080    if let Some(ref user_agent) = configuration.user_agent {
1081        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1082    }
1083    if let Some(ref token) = configuration.bearer_access_token {
1084        req_builder = req_builder.bearer_auth(token.to_owned());
1085    };
1086
1087    let req = req_builder.build()?;
1088    let resp = configuration.client.execute(req).await?;
1089
1090    let status = resp.status();
1091    let content_type = resp
1092        .headers()
1093        .get("content-type")
1094        .and_then(|v| v.to_str().ok())
1095        .unwrap_or("application/octet-stream");
1096    let content_type = super::ContentType::from(content_type);
1097
1098    if !status.is_client_error() && !status.is_server_error() {
1099        let content = resp.text().await?;
1100        match content_type {
1101            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1102            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::DomainView&gt;`"))),
1103            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::DomainView&gt;`")))),
1104        }
1105    } else {
1106        let content = resp.text().await?;
1107        let entity: Option<GetPlatformProjectsByProjectAppsByAppDomainsError> = serde_json::from_str(&content).ok();
1108        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1109    }
1110}
1111
1112/// Returns the versions that actually reached the cluster.  It lists the org's releases: the deployments that were genuinely applied to the cluster, with the app they belong to, their version, environment, status and when they were released. A deployment that failed or is still building is NOT a release and is excluded — reaching the cluster is what makes one. Requires a validated principal; 403 without one.
1113pub async fn get_platform_releases(configuration: &configuration::Configuration, ) -> Result<models::ReleaseBoard, Error<GetPlatformReleasesError>> {
1114
1115    let uri_str = format!("{}/v1/platform/releases", configuration.base_path);
1116    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1117
1118    if let Some(ref user_agent) = configuration.user_agent {
1119        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1120    }
1121    if let Some(ref token) = configuration.bearer_access_token {
1122        req_builder = req_builder.bearer_auth(token.to_owned());
1123    };
1124
1125    let req = req_builder.build()?;
1126    let resp = configuration.client.execute(req).await?;
1127
1128    let status = resp.status();
1129    let content_type = resp
1130        .headers()
1131        .get("content-type")
1132        .and_then(|v| v.to_str().ok())
1133        .unwrap_or("application/octet-stream");
1134    let content_type = super::ContentType::from(content_type);
1135
1136    if !status.is_client_error() && !status.is_server_error() {
1137        let content = resp.text().await?;
1138        match content_type {
1139            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1140            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ReleaseBoard`"))),
1141            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ReleaseBoard`")))),
1142        }
1143    } else {
1144        let content = resp.text().await?;
1145        let entity: Option<GetPlatformReleasesError> = serde_json::from_str(&content).ok();
1146        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1147    }
1148}
1149
1150/// Builds a git repository into an image and writes the declaration that names it — a values file in `hanzoai/universe` under `charts/app/values/<namespace>/<name>.yaml`, which the `fleet` ApplicationSet renders as one Application. That file IS the deployment: nothing else has to be applied.  `mode` decides whether anything can go live. The default, `branch`, pushes to `deploy/<namespace>/<name>/<tag>` and returns a review URL; the generator reads main, so a branch declaration deploys NOTHING and merging the review is the deliberate act. `commit` writes main, and proves the image is pullable first — a declaration naming an image the registry cannot serve is an ImagePullBackOff with no rollback path.  Omit `tag` to build; give it to declare an image an earlier call already built, which is how a green build is released without rebuilding it.  An org is its name: the values DIRECTORY, the destination NAMESPACE and the AppProject FENCE are all `<org>`, and the image is `<registry>/<org>/<app>`. None of them is a request field — the directory decides what CD admits the sync under and the repository decides what the cluster pulls, so a caller who could name either could reach outside its own org.  `org` is an ACT-AS, not a placement field: it defaults to the caller's own, and naming another requires SuperAdmin. So does naming a RESERVED org — the platform's own namespace family (the brands and their environments, the control and delivery planes, `admin`) — even when it is the caller's own, because an IAM org named `kube-system` does not own Kubernetes. Both refuse rather than downgrade, so an escape attempt is never indistinguishable from a normal request.  A host outside the caller's org subtree is refused: claim and verify a custom domain first.
1151pub async fn post_platform_apps(configuration: &configuration::Configuration, ) -> Result<(), Error<PostPlatformAppsError>> {
1152
1153    let uri_str = format!("{}/v1/platform/apps", configuration.base_path);
1154    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1155
1156    if let Some(ref user_agent) = configuration.user_agent {
1157        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1158    }
1159    if let Some(ref token) = configuration.bearer_access_token {
1160        req_builder = req_builder.bearer_auth(token.to_owned());
1161    };
1162
1163    let req = req_builder.build()?;
1164    let resp = configuration.client.execute(req).await?;
1165
1166    let status = resp.status();
1167
1168    if !status.is_client_error() && !status.is_server_error() {
1169        Ok(())
1170    } else {
1171        let content = resp.text().await?;
1172        let entity: Option<PostPlatformAppsError> = serde_json::from_str(&content).ok();
1173        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1174    }
1175}
1176
1177/// Rolls a platform service's pods, in a named environment.  It triggers a rolling restart of one platform service's Deployment by stamping a fresh restart annotation, and answers 202 with the app, the namespace, the environment and the timestamp. It restarts pods; it does NOT change the image — a version change is the release path, not this.  SuperAdmin ONLY, and deliberately narrower than the read gate beside it. The only namespaces this board touches are the platform's own tier, so a restart here recycles a SHARED service every tenant depends on. A brand-org admin is a customer-org admin, not a platform operator: observing the board is bounded and audited, and restarting production identity is not.  `?env=main|test|dev` is REQUIRED — a bare call does not default to production, which is what closes the fat-finger and confused-deputy hazard — and any other value is 400. A service with no Deployment to restart in that environment is 404.
1178pub async fn post_platform_fleet_by_app_deploy(configuration: &configuration::Configuration, app: &str, restart_ref: models::RestartRef) -> Result<models::Restarted, Error<PostPlatformFleetByAppDeployError>> {
1179    // add a prefix to parameters to efficiently prevent name collisions
1180    let p_app = app;
1181    let p_restart_ref = restart_ref;
1182
1183    let uri_str = format!("{}/v1/platform/fleet/{app}/deploy", configuration.base_path, app=crate::apis::urlencode(p_app));
1184    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1185
1186    if let Some(ref user_agent) = configuration.user_agent {
1187        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1188    }
1189    if let Some(ref token) = configuration.bearer_access_token {
1190        req_builder = req_builder.bearer_auth(token.to_owned());
1191    };
1192    req_builder = req_builder.json(&p_restart_ref);
1193
1194    let req = req_builder.build()?;
1195    let resp = configuration.client.execute(req).await?;
1196
1197    let status = resp.status();
1198    let content_type = resp
1199        .headers()
1200        .get("content-type")
1201        .and_then(|v| v.to_str().ok())
1202        .unwrap_or("application/octet-stream");
1203    let content_type = super::ContentType::from(content_type);
1204
1205    if !status.is_client_error() && !status.is_server_error() {
1206        let content = resp.text().await?;
1207        match content_type {
1208            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1209            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Restarted`"))),
1210            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Restarted`")))),
1211        }
1212    } else {
1213        let content = resp.text().await?;
1214        let entity: Option<PostPlatformFleetByAppDeployError> = serde_json::from_str(&content).ok();
1215        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1216    }
1217}
1218
1219/// The forge's push-to-deploy endpoint. git.hanzo.ai runs as a separate server, so its pushes never reach this fleet's own receive-pack; without this a push to the host we call canonical builds nothing. A verified push is handed to the SAME two clients a native push travels — the single-registrant deploy trigger, and the many-subscriber lifecycle stream that notifies and indexes — and the build decision itself stays downstream in the one place that knows what a push means.  PUBLIC at the JWT layer, because the forge carries no Hanzo session: AUTHENTICATION IS THE SIGNATURE. The HMAC covers the raw bytes and is verified BEFORE the payload is parsed, so an unauthenticated body is never decoded. The secret is read from KMS; a deployment that cannot read it answers 503 and processes nothing, rather than trusting a delivery it could not check. The body is read UNCOMPRESSED — a request declaring a Content-Encoding is refused 415 before it is touched, because decoding one is unbounded work bought with a few bytes and no credential. A bad signature is 401, a payload over 8 MiB is 413, and a malformed one 400.  A verified push that reaches both clients answers 200 with fired true and the NUMBER OF BUILDS it launched — zero is ordinary, since most pushes track no application, and it is the answer 'fired' cannot give. A push that could not be dispatched answers 500: the delivery page shows it red, and the Replay that prompts reaches a fresh attempt rather than being declined as already landed.  The deliveries deliberately ignored answer 200 with a reason and nothing else: a payload that is not a push, a ref DELETE (a zero `after` has no commit to build), a BOT-authored push (release automation pushes as the forge's own Actions user, and a release must never rebuild itself), a push from a forge namespace that maps to no org, and a redelivery of a push already fired. Branches and tags both reach the build trigger, because releases are cut by tag and filtering here would silently stop publishing.
1220pub async fn post_platform_hook(configuration: &configuration::Configuration, push: Option<models::Push>) -> Result<models::Verdict, Error<PostPlatformHookError>> {
1221    // add a prefix to parameters to efficiently prevent name collisions
1222    let p_push = push;
1223
1224    let uri_str = format!("{}/v1/platform/hook", configuration.base_path);
1225    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1226
1227    if let Some(ref user_agent) = configuration.user_agent {
1228        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1229    }
1230    if let Some(ref token) = configuration.bearer_access_token {
1231        req_builder = req_builder.bearer_auth(token.to_owned());
1232    };
1233    req_builder = req_builder.json(&p_push);
1234
1235    let req = req_builder.build()?;
1236    let resp = configuration.client.execute(req).await?;
1237
1238    let status = resp.status();
1239    let content_type = resp
1240        .headers()
1241        .get("content-type")
1242        .and_then(|v| v.to_str().ok())
1243        .unwrap_or("application/octet-stream");
1244    let content_type = super::ContentType::from(content_type);
1245
1246    if !status.is_client_error() && !status.is_server_error() {
1247        let content = resp.text().await?;
1248        match content_type {
1249            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1250            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Verdict`"))),
1251            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Verdict`")))),
1252        }
1253    } else {
1254        let content = resp.text().await?;
1255        let entity: Option<PostPlatformHookError> = serde_json::from_str(&content).ok();
1256        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1257    }
1258}
1259
1260/// Creates an application from a git repo or a container image.  It registers a new application under one of the caller org's projects and answers 201 with it. Creating does NOT deploy: the app lands in `draft` and nothing reaches the cluster until /deploy.  `source` is `git` — which requires `repo.url` — or `image`, which requires `image.repository`; anything else is 400. A git app builds with zero-config `pack` by default and may opt into `dockerfile`; an image app never builds. The repo URL and Dockerfile path are validated here against the SAME allowlist the privileged build enforces, so an unsafe source is refused before it is ever persisted.  The `slug` is the app's identity in the cluster: given or derived from `name`, it must match `^[a-z0-9]([a-z0-9-]{0,38}[a-z0-9])?$`, and a slug already used in this project is 409. `replicas` and `storageGb` are clamped to the deployment's limits rather than refused.  Env keys must match `^[A-Za-z_][A-Za-z0-9_]*$`. A variable marked `secret: true` is SEALED into KMS and its plaintext is never written to the database — and if KMS is unavailable the create fails 503 rather than falling back to storing a secret in the clear.  The app is seeded with its canonical default host, so it has a working HTTPS URL the moment it deploys. A bare custom domain cannot be attached here — it has to go through add-domain and DNS verification first. Requires a validated principal; 403 without one, and every cluster object it will later create lands in that org's own `tenant-<org>` namespace.
1261pub async fn post_platform_projects_by_project_apps(configuration: &configuration::Configuration, project: &str, create_app_req: models::CreateAppReq) -> Result<models::AppView, Error<PostPlatformProjectsByProjectAppsError>> {
1262    // add a prefix to parameters to efficiently prevent name collisions
1263    let p_project = project;
1264    let p_create_app_req = create_app_req;
1265
1266    let uri_str = format!("{}/v1/platform/projects/{project}/apps", configuration.base_path, project=crate::apis::urlencode(p_project));
1267    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1268
1269    if let Some(ref user_agent) = configuration.user_agent {
1270        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1271    }
1272    if let Some(ref token) = configuration.bearer_access_token {
1273        req_builder = req_builder.bearer_auth(token.to_owned());
1274    };
1275    req_builder = req_builder.json(&p_create_app_req);
1276
1277    let req = req_builder.build()?;
1278    let resp = configuration.client.execute(req).await?;
1279
1280    let status = resp.status();
1281    let content_type = resp
1282        .headers()
1283        .get("content-type")
1284        .and_then(|v| v.to_str().ok())
1285        .unwrap_or("application/octet-stream");
1286    let content_type = super::ContentType::from(content_type);
1287
1288    if !status.is_client_error() && !status.is_server_error() {
1289        let content = resp.text().await?;
1290        match content_type {
1291            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1292            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AppView`"))),
1293            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AppView`")))),
1294        }
1295    } else {
1296        let content = resp.text().await?;
1297        let entity: Option<PostPlatformProjectsByProjectAppsError> = serde_json::from_str(&content).ok();
1298        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1299    }
1300}
1301
1302/// Deploys the app — building it first if it comes from git.  It starts a new, monotonically versioned deployment of the app and answers 202 with the deployment record. A 202 is an ACCEPTED deployment, not a live one.  An IMAGE app deploys the tag you name (falling back to the app's tag, then `latest`) by writing its operator Service CR; the operator reconciles it to running. A GIT app launches an in-cluster BuildKit Job at `commit` — or the app's branch — and comes back in `building`; the Service CR is applied later, by the reconciler, once the Job succeeds. The reconciler is restart-safe, so a build in flight survives a cloud restart.  Deploys are bounded per org: over the concurrent-deploy cap is 429 and NOTHING is recorded, so a rejected deploy leaves no phantom in the history. An unreachable cluster is 503 but still records an honest `error` deployment, because a deploy that was attempted and failed must not be indistinguishable from one never made. Every other failure is likewise recorded in its real terminal state.  This is metered work: a git build is billed to the org's ledger in wall-clock build minutes once the Job finishes, and the running deployment is billed for its compute per tick for as long as it stays live. Requires a validated principal; 403 without one, and everything is written into that org's own `tenant-<org>` namespace.
1303pub async fn post_platform_projects_by_project_apps_by_app_deploy(configuration: &configuration::Configuration, project: &str, app: &str, deploy_req: models::DeployReq) -> Result<models::DeploymentView, Error<PostPlatformProjectsByProjectAppsByAppDeployError>> {
1304    // add a prefix to parameters to efficiently prevent name collisions
1305    let p_project = project;
1306    let p_app = app;
1307    let p_deploy_req = deploy_req;
1308
1309    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/deploy", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1310    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1311
1312    if let Some(ref user_agent) = configuration.user_agent {
1313        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1314    }
1315    if let Some(ref token) = configuration.bearer_access_token {
1316        req_builder = req_builder.bearer_auth(token.to_owned());
1317    };
1318    req_builder = req_builder.json(&p_deploy_req);
1319
1320    let req = req_builder.build()?;
1321    let resp = configuration.client.execute(req).await?;
1322
1323    let status = resp.status();
1324    let content_type = resp
1325        .headers()
1326        .get("content-type")
1327        .and_then(|v| v.to_str().ok())
1328        .unwrap_or("application/octet-stream");
1329    let content_type = super::ContentType::from(content_type);
1330
1331    if !status.is_client_error() && !status.is_server_error() {
1332        let content = resp.text().await?;
1333        match content_type {
1334            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1335            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeploymentView`"))),
1336            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeploymentView`")))),
1337        }
1338    } else {
1339        let content = resp.text().await?;
1340        let entity: Option<PostPlatformProjectsByProjectAppsByAppDeployError> = serde_json::from_str(&content).ok();
1341        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1342    }
1343}
1344
1345/// Attaches a hostname — instantly if you already own it, otherwise with a DNS challenge.  It attaches `host` to the app, and which of two things happens depends on who owns the name. A host inside the caller org's own subtree is structurally owned, so it goes ACTIVE immediately and answers 201. A bring-your-own host is claimed as PENDING and answers the DNS challenge records to publish; it is NOT rendered into the app's ingress until /verify passes.  Claims are globally unique. A host already claimed by another organization is 409, and so is one claimed by a different app in your own; re-adding this app's OWN claim is idempotent and answers its current state at 200. The default host is always attached and re-adding it is 409. A host under the platform's shared apex that is not the caller's own subtree is 403 — it belongs to whoever owns that subtree and can never be grabbed through the custom path.  `host` must be a valid DNS hostname; anything else is 400. Requires a validated principal; 403 without one.
1346pub async fn post_platform_projects_by_project_apps_by_app_domains(configuration: &configuration::Configuration, project: &str, app: &str, add_domain_req: models::AddDomainReq) -> Result<models::DomainView, Error<PostPlatformProjectsByProjectAppsByAppDomainsError>> {
1347    // add a prefix to parameters to efficiently prevent name collisions
1348    let p_project = project;
1349    let p_app = app;
1350    let p_add_domain_req = add_domain_req;
1351
1352    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/domains", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1353    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1354
1355    if let Some(ref user_agent) = configuration.user_agent {
1356        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1357    }
1358    if let Some(ref token) = configuration.bearer_access_token {
1359        req_builder = req_builder.bearer_auth(token.to_owned());
1360    };
1361    req_builder = req_builder.json(&p_add_domain_req);
1362
1363    let req = req_builder.build()?;
1364    let resp = configuration.client.execute(req).await?;
1365
1366    let status = resp.status();
1367    let content_type = resp
1368        .headers()
1369        .get("content-type")
1370        .and_then(|v| v.to_str().ok())
1371        .unwrap_or("application/octet-stream");
1372    let content_type = super::ContentType::from(content_type);
1373
1374    if !status.is_client_error() && !status.is_server_error() {
1375        let content = resp.text().await?;
1376        match content_type {
1377            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1378            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DomainView`"))),
1379            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DomainView`")))),
1380        }
1381    } else {
1382        let content = resp.text().await?;
1383        let entity: Option<PostPlatformProjectsByProjectAppsByAppDomainsError> = serde_json::from_str(&content).ok();
1384        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1385    }
1386}
1387
1388/// Checks a custom domain's DNS and turns it on if it passes.  It runs the DNS challenge check for a pending custom host and, when it passes, marks the host verified and renders it into the app's ingress so it starts serving.  A check that RAN and did not pass is not an error: it answers 200 with the host still pending and the reason in `detail`, so a console can show the operator what DNS is actually returning. An already-verified host answers as-is without re-checking. A host not claimed by this app is 404. Requires a validated principal; 403 without one.
1389pub async fn post_platform_projects_by_project_apps_by_app_domains_by_host_verify(configuration: &configuration::Configuration, project: &str, app: &str, host: &str) -> Result<models::DomainView, Error<PostPlatformProjectsByProjectAppsByAppDomainsByHostVerifyError>> {
1390    // add a prefix to parameters to efficiently prevent name collisions
1391    let p_project = project;
1392    let p_app = app;
1393    let p_host = host;
1394
1395    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/domains/{host}/verify", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app), host=crate::apis::urlencode(p_host));
1396    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1397
1398    if let Some(ref user_agent) = configuration.user_agent {
1399        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1400    }
1401    if let Some(ref token) = configuration.bearer_access_token {
1402        req_builder = req_builder.bearer_auth(token.to_owned());
1403    };
1404
1405    let req = req_builder.build()?;
1406    let resp = configuration.client.execute(req).await?;
1407
1408    let status = resp.status();
1409    let content_type = resp
1410        .headers()
1411        .get("content-type")
1412        .and_then(|v| v.to_str().ok())
1413        .unwrap_or("application/octet-stream");
1414    let content_type = super::ContentType::from(content_type);
1415
1416    if !status.is_client_error() && !status.is_server_error() {
1417        let content = resp.text().await?;
1418        match content_type {
1419            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1420            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DomainView`"))),
1421            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DomainView`")))),
1422        }
1423    } else {
1424        let content = resp.text().await?;
1425        let entity: Option<PostPlatformProjectsByProjectAppsByAppDomainsByHostVerifyError> = serde_json::from_str(&content).ok();
1426        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1427    }
1428}
1429
1430/// Puts a branch on its own URL.  It deploys an already-built `image` to a per-branch preview and answers its URL, the branch, the preview's slug and the deployment. The preview is a FIRST-CLASS application named `<app>-<branch>` in the same project and tenant namespace, with its own default host — so it is completely isolated from production while reusing the same deploy mechanic. Re-previewing a branch converges that same target in place rather than stacking another one.  It carries NO environment variables, deliberately: a preview never inherits production's secrets. It also does not build — `image` is required and must already exist, and `branch` defaults to the parent app's. A branch that does not resolve to a valid slug distinct from the parent's is 400. Requires a validated principal; 403 without one.
1431pub async fn post_platform_projects_by_project_apps_by_app_preview(configuration: &configuration::Configuration, project: &str, app: &str, preview_req: models::PreviewReq) -> Result<models::PreviewView, Error<PostPlatformProjectsByProjectAppsByAppPreviewError>> {
1432    // add a prefix to parameters to efficiently prevent name collisions
1433    let p_project = project;
1434    let p_app = app;
1435    let p_preview_req = preview_req;
1436
1437    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/preview", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1438    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1439
1440    if let Some(ref user_agent) = configuration.user_agent {
1441        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1442    }
1443    if let Some(ref token) = configuration.bearer_access_token {
1444        req_builder = req_builder.bearer_auth(token.to_owned());
1445    };
1446    req_builder = req_builder.json(&p_preview_req);
1447
1448    let req = req_builder.build()?;
1449    let resp = configuration.client.execute(req).await?;
1450
1451    let status = resp.status();
1452    let content_type = resp
1453        .headers()
1454        .get("content-type")
1455        .and_then(|v| v.to_str().ok())
1456        .unwrap_or("application/octet-stream");
1457    let content_type = super::ContentType::from(content_type);
1458
1459    if !status.is_client_error() && !status.is_server_error() {
1460        let content = resp.text().await?;
1461        match content_type {
1462            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1463            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::PreviewView`"))),
1464            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::PreviewView`")))),
1465        }
1466    } else {
1467        let content = resp.text().await?;
1468        let entity: Option<PostPlatformProjectsByProjectAppsByAppPreviewError> = serde_json::from_str(&content).ok();
1469        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1470    }
1471}
1472
1473/// Promotes an already-built release to the app.  It redeploys an image that already exists — named either by `deploymentId`, which promotes that deployment's exact built image, or by `tag`, resolved the same way a deploy resolves one. One of the two is required; neither is 400.  Promotion never builds. A deployment that carries no built image cannot be promoted and is 400, and a deployment id outside this app is 404. It runs through the same deploy core as everything else, so it takes a NEW version number and is subject to the same per-org concurrency cap. Requires a validated principal; 403 without one.
1474pub async fn post_platform_projects_by_project_apps_by_app_promote(configuration: &configuration::Configuration, project: &str, app: &str, promote_req: models::PromoteReq) -> Result<models::DeploymentView, Error<PostPlatformProjectsByProjectAppsByAppPromoteError>> {
1475    // add a prefix to parameters to efficiently prevent name collisions
1476    let p_project = project;
1477    let p_app = app;
1478    let p_promote_req = promote_req;
1479
1480    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/promote", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1481    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1482
1483    if let Some(ref user_agent) = configuration.user_agent {
1484        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1485    }
1486    if let Some(ref token) = configuration.bearer_access_token {
1487        req_builder = req_builder.bearer_auth(token.to_owned());
1488    };
1489    req_builder = req_builder.json(&p_promote_req);
1490
1491    let req = req_builder.build()?;
1492    let resp = configuration.client.execute(req).await?;
1493
1494    let status = resp.status();
1495    let content_type = resp
1496        .headers()
1497        .get("content-type")
1498        .and_then(|v| v.to_str().ok())
1499        .unwrap_or("application/octet-stream");
1500    let content_type = super::ContentType::from(content_type);
1501
1502    if !status.is_client_error() && !status.is_server_error() {
1503        let content = resp.text().await?;
1504        match content_type {
1505            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1506            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeploymentView`"))),
1507            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeploymentView`")))),
1508        }
1509    } else {
1510        let content = resp.text().await?;
1511        let entity: Option<PostPlatformProjectsByProjectAppsByAppPromoteError> = serde_json::from_str(&content).ok();
1512        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1513    }
1514}
1515
1516/// Goes back to the previous release.  It redeploys a prior image: the one named by `deploymentId`, or — with no body — the newest earlier deployment that carries a real built image and did not error, skipping the release currently live. An app with nothing earlier to return to is 400.  A rollback is a deploy of an old image, not a rewind: it takes a NEW version number and appends to the history rather than erasing what came after. Both lookups are scoped to this app and org, so another tenant's image can never be rolled in. Requires a validated principal; 403 without one.
1517pub async fn post_platform_projects_by_project_apps_by_app_rollback(configuration: &configuration::Configuration, project: &str, app: &str, rollback_req: models::RollbackReq) -> Result<models::DeploymentView, Error<PostPlatformProjectsByProjectAppsByAppRollbackError>> {
1518    // add a prefix to parameters to efficiently prevent name collisions
1519    let p_project = project;
1520    let p_app = app;
1521    let p_rollback_req = rollback_req;
1522
1523    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/rollback", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1524    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1525
1526    if let Some(ref user_agent) = configuration.user_agent {
1527        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1528    }
1529    if let Some(ref token) = configuration.bearer_access_token {
1530        req_builder = req_builder.bearer_auth(token.to_owned());
1531    };
1532    req_builder = req_builder.json(&p_rollback_req);
1533
1534    let req = req_builder.build()?;
1535    let resp = configuration.client.execute(req).await?;
1536
1537    let status = resp.status();
1538    let content_type = resp
1539        .headers()
1540        .get("content-type")
1541        .and_then(|v| v.to_str().ok())
1542        .unwrap_or("application/octet-stream");
1543    let content_type = super::ContentType::from(content_type);
1544
1545    if !status.is_client_error() && !status.is_server_error() {
1546        let content = resp.text().await?;
1547        match content_type {
1548            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1549            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeploymentView`"))),
1550            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeploymentView`")))),
1551        }
1552    } else {
1553        let content = resp.text().await?;
1554        let entity: Option<PostPlatformProjectsByProjectAppsByAppRollbackError> = serde_json::from_str(&content).ok();
1555        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1556    }
1557}
1558
1559/// Starts a stopped app back up.  It scales the app's Service back to its configured replica count and marks it live, answering the updated application. It does not redeploy: the image already on the Service CR is what comes back.  The billing watermark is reset to now as part of starting, so the org is charged for THIS live span and never for the gap the app spent stopped. An app with no Service CR is 404, an unreachable cluster is 503, and a cluster that refuses the scale is 502. Requires a validated principal; 403 without one.
1560pub async fn post_platform_projects_by_project_apps_by_app_start(configuration: &configuration::Configuration, project: &str, app: &str) -> Result<models::AppView, Error<PostPlatformProjectsByProjectAppsByAppStartError>> {
1561    // add a prefix to parameters to efficiently prevent name collisions
1562    let p_project = project;
1563    let p_app = app;
1564
1565    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/start", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1566    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1567
1568    if let Some(ref user_agent) = configuration.user_agent {
1569        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1570    }
1571    if let Some(ref token) = configuration.bearer_access_token {
1572        req_builder = req_builder.bearer_auth(token.to_owned());
1573    };
1574
1575    let req = req_builder.build()?;
1576    let resp = configuration.client.execute(req).await?;
1577
1578    let status = resp.status();
1579    let content_type = resp
1580        .headers()
1581        .get("content-type")
1582        .and_then(|v| v.to_str().ok())
1583        .unwrap_or("application/octet-stream");
1584    let content_type = super::ContentType::from(content_type);
1585
1586    if !status.is_client_error() && !status.is_server_error() {
1587        let content = resp.text().await?;
1588        match content_type {
1589            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1590            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AppView`"))),
1591            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AppView`")))),
1592        }
1593    } else {
1594        let content = resp.text().await?;
1595        let entity: Option<PostPlatformProjectsByProjectAppsByAppStartError> = serde_json::from_str(&content).ok();
1596        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1597    }
1598}
1599
1600/// Stops an app without deleting it.  It scales the app's Service to zero replicas and marks it stopped, answering the updated application. Nothing else is removed — the record, its env, its domains and its deployment history all survive, and /start brings it back at the same replica count.  An app that is not deployed has no Service CR to scale and is 404. An unreachable cluster is 503 and a cluster that refuses the scale is 502. Because the pods stop, so does the compute metering. Requires a validated principal; 403 without one.
1601pub async fn post_platform_projects_by_project_apps_by_app_stop(configuration: &configuration::Configuration, project: &str, app: &str) -> Result<models::AppView, Error<PostPlatformProjectsByProjectAppsByAppStopError>> {
1602    // add a prefix to parameters to efficiently prevent name collisions
1603    let p_project = project;
1604    let p_app = app;
1605
1606    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/stop", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1607    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1608
1609    if let Some(ref user_agent) = configuration.user_agent {
1610        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1611    }
1612    if let Some(ref token) = configuration.bearer_access_token {
1613        req_builder = req_builder.bearer_auth(token.to_owned());
1614    };
1615
1616    let req = req_builder.build()?;
1617    let resp = configuration.client.execute(req).await?;
1618
1619    let status = resp.status();
1620    let content_type = resp
1621        .headers()
1622        .get("content-type")
1623        .and_then(|v| v.to_str().ok())
1624        .unwrap_or("application/octet-stream");
1625    let content_type = super::ContentType::from(content_type);
1626
1627    if !status.is_client_error() && !status.is_server_error() {
1628        let content = resp.text().await?;
1629        match content_type {
1630            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1631            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AppView`"))),
1632            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AppView`")))),
1633        }
1634    } else {
1635        let content = resp.text().await?;
1636        let entity: Option<PostPlatformProjectsByProjectAppsByAppStopError> = serde_json::from_str(&content).ok();
1637        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1638    }
1639}
1640
1641/// Runs a container image and gives back a URL.  The one-call shortcut over project → app → deploy: give it a `name` and an `image` and it creates or updates an image-source application in your org's DEFAULT project, deploys it through the same operator Service-CR writer everything else uses, and answers its id, name, live URL, status and shape. Re-running the same name UPDATES it in place, so the call is idempotent by name.  What it produces is a first-class application, not a special object: it is listable, stoppable and redeployable through the /v1/platform routes like any other app.  `minScale` is the replica floor. `maxScale` above it declares an autoscaling ceiling; `maxScale: 0` means no autoscaler at all — a fixed run at the floor. Both are clamped to the deployment's limits. `runtime` and `shape` are accepted for the client contract and echoed back: the image is the runtime unit and sizing is the operator's default.  It is BILLING-GATED before it touches the cluster: a flat per-run fee is authorized against the org's own prepaid balance first, so an org that cannot pay is refused without anything being created. An unreachable cluster is 503 — a run never reports a URL it did not create. Secret env is sealed into KMS and fails closed without it.  Requires a validated principal; 403 without one. The org is resolved from that validated identity and is what both pays and owns the namespace — it is never read from the body.
1642pub async fn post_platform_run(configuration: &configuration::Configuration, run_req: models::RunReq) -> Result<models::RunView, Error<PostPlatformRunError>> {
1643    // add a prefix to parameters to efficiently prevent name collisions
1644    let p_run_req = run_req;
1645
1646    let uri_str = format!("{}/v1/platform/run", configuration.base_path);
1647    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1648
1649    if let Some(ref user_agent) = configuration.user_agent {
1650        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1651    }
1652    if let Some(ref token) = configuration.bearer_access_token {
1653        req_builder = req_builder.bearer_auth(token.to_owned());
1654    };
1655    req_builder = req_builder.json(&p_run_req);
1656
1657    let req = req_builder.build()?;
1658    let resp = configuration.client.execute(req).await?;
1659
1660    let status = resp.status();
1661    let content_type = resp
1662        .headers()
1663        .get("content-type")
1664        .and_then(|v| v.to_str().ok())
1665        .unwrap_or("application/octet-stream");
1666    let content_type = super::ContentType::from(content_type);
1667
1668    if !status.is_client_error() && !status.is_server_error() {
1669        let content = resp.text().await?;
1670        match content_type {
1671            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1672            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RunView`"))),
1673            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RunView`")))),
1674        }
1675    } else {
1676        let content = resp.text().await?;
1677        let entity: Option<PostPlatformRunError> = serde_json::from_str(&content).ok();
1678        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1679    }
1680}
1681
1682/// Triggers a native build — an image, or the binaries a repo declares.  The fabric's own build trigger, and what `hanzo build` and git-push-to-deploy call. It answers 202 with the build job id: a queued build, not a pushed artifact.  Two lanes, and a build is exactly one of them. The IMAGE lane takes `repo` and the output `image` and launches a BuildKit Job that pushes it. The ARTIFACT lane takes `binaries` — the same recipe the repo's hanzo.yml declares — and publishes to object storage instead; it must carry no `image`, because a build produces binaries or an image, never both.  PRIVILEGED, and A BUILD BELONGS TO THE ORGANIZATION ITS CREDENTIAL NAMES. Two credentials, never a third:    - one that NAMES an organization — a person who administers it (the `hanzo     build` path, so one IAM login authorizes a build with no separate build     token), or that organization's own machine identity (the pipeline path). The     build is attributed to that org and confined to what it owns.   - the shared build-callback token, compared in constant time. It names NO     organization, which is both why the fabric's own release can publish across     brands with it and why anything that CAN name one is read first.  Both are bounded by the owned-registry allowlist. The org path is bounded again, by the org: the image's registry namespace must be one that organization owns, so it publishes into its own brand and can never overwrite another's through the shared push credential. The same confinement applies to the artifact lane's repo owner. There is no request field naming an organization — the attribution is read off the credential, so there is nothing for a caller to write it with.  The output image is parsed and validated as a single well-formed OCI ref before any authorization decision reads it, so a crafted ref cannot smuggle a build-exporter attribute past the check.
1683pub async fn post_platform_runner(configuration: &configuration::Configuration, runner_build_req: models::RunnerBuildReq) -> Result<models::RunnerBuildResp, Error<PostPlatformRunnerError>> {
1684    // add a prefix to parameters to efficiently prevent name collisions
1685    let p_runner_build_req = runner_build_req;
1686
1687    let uri_str = format!("{}/v1/platform/runner", configuration.base_path);
1688    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1689
1690    if let Some(ref user_agent) = configuration.user_agent {
1691        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1692    }
1693    if let Some(ref token) = configuration.bearer_access_token {
1694        req_builder = req_builder.bearer_auth(token.to_owned());
1695    };
1696    req_builder = req_builder.json(&p_runner_build_req);
1697
1698    let req = req_builder.build()?;
1699    let resp = configuration.client.execute(req).await?;
1700
1701    let status = resp.status();
1702    let content_type = resp
1703        .headers()
1704        .get("content-type")
1705        .and_then(|v| v.to_str().ok())
1706        .unwrap_or("application/octet-stream");
1707    let content_type = super::ContentType::from(content_type);
1708
1709    if !status.is_client_error() && !status.is_server_error() {
1710        let content = resp.text().await?;
1711        match content_type {
1712            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1713            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RunnerBuildResp`"))),
1714            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::RunnerBuildResp`")))),
1715        }
1716    } else {
1717        let content = resp.text().await?;
1718        let entity: Option<PostPlatformRunnerError> = serde_json::from_str(&content).ok();
1719        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1720    }
1721}
1722
1723/// Replaces an app's environment variables.  It writes the app's whole environment set and answers the updated application. This is the one post-create write path for env, and it REPLACES rather than merges: a variable absent from the body is gone, and a secret dropped from the set leaves the app's Secret on its next deploy.  Keys must match `^[A-Za-z_][A-Za-z0-9_]*$`. A value marked `secret: true` is sealed into KMS and blanked in the database, so plaintext is never persisted — and the write fails 503 if KMS is unavailable rather than storing one in the clear.  The rule worth knowing: this does not restart anything. Once the app has been deployed the secret sync is re-declared immediately so the operator re-materialises the Secret, but RUNNING pods keep the environment they started with until their next deploy or restart. Requires a validated principal; 403 without one.
1724pub async fn put_platform_projects_by_project_apps_by_app_env(configuration: &configuration::Configuration, project: &str, app: &str, set_env_req: models::SetEnvReq) -> Result<models::AppView, Error<PutPlatformProjectsByProjectAppsByAppEnvError>> {
1725    // add a prefix to parameters to efficiently prevent name collisions
1726    let p_project = project;
1727    let p_app = app;
1728    let p_set_env_req = set_env_req;
1729
1730    let uri_str = format!("{}/v1/platform/projects/{project}/apps/{app}/env", configuration.base_path, project=crate::apis::urlencode(p_project), app=crate::apis::urlencode(p_app));
1731    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1732
1733    if let Some(ref user_agent) = configuration.user_agent {
1734        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1735    }
1736    if let Some(ref token) = configuration.bearer_access_token {
1737        req_builder = req_builder.bearer_auth(token.to_owned());
1738    };
1739    req_builder = req_builder.json(&p_set_env_req);
1740
1741    let req = req_builder.build()?;
1742    let resp = configuration.client.execute(req).await?;
1743
1744    let status = resp.status();
1745    let content_type = resp
1746        .headers()
1747        .get("content-type")
1748        .and_then(|v| v.to_str().ok())
1749        .unwrap_or("application/octet-stream");
1750    let content_type = super::ContentType::from(content_type);
1751
1752    if !status.is_client_error() && !status.is_server_error() {
1753        let content = resp.text().await?;
1754        match content_type {
1755            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1756            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AppView`"))),
1757            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AppView`")))),
1758        }
1759    } else {
1760        let content = resp.text().await?;
1761        let entity: Option<PutPlatformProjectsByProjectAppsByAppEnvError> = serde_json::from_str(&content).ok();
1762        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1763    }
1764}
1765