Skip to main content

hanzo_client/apis/
licensing_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 [`get_licensing_download_by_release`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum GetLicensingDownloadByReleaseError {
22    UnknownValue(serde_json::Value),
23}
24
25/// struct for typed errors of method [`get_licensing_healthz`]
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum GetLicensingHealthzError {
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_licensing_jwks`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetLicensingJwksError {
36    UnknownValue(serde_json::Value),
37}
38
39/// struct for typed errors of method [`get_licensing_pubkey`]
40#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum GetLicensingPubkeyError {
43    UnknownValue(serde_json::Value),
44}
45
46/// struct for typed errors of method [`get_licensing_releases`]
47#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum GetLicensingReleasesError {
50    UnknownValue(serde_json::Value),
51}
52
53/// struct for typed errors of method [`get_licensing_releases_by_release`]
54#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum GetLicensingReleasesByReleaseError {
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`post_licensing_fingerprint`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum PostLicensingFingerprintError {
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`post_licensing_issue`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum PostLicensingIssueError {
71    UnknownValue(serde_json::Value),
72}
73
74/// struct for typed errors of method [`post_licensing_releases`]
75#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum PostLicensingReleasesError {
78    UnknownValue(serde_json::Value),
79}
80
81/// struct for typed errors of method [`post_licensing_revoke`]
82#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum PostLicensingRevokeError {
85    UnknownValue(serde_json::Value),
86}
87
88/// struct for typed errors of method [`post_licensing_verify`]
89#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum PostLicensingVerifyError {
92    UnknownValue(serde_json::Value),
93}
94
95
96/// Download resolves a release to its artifact, gated on a valid license.  The gate is the LICENSE token, not the IAM bearer: being signed in is not permission to download a paid binary — holding a good license for it is. The token must verify against this deployment's public key, be unrevoked, be scoped to the release's app, and carry every feature the release requires. Present it as the `X-License-Token` header (preferred, since a header does not land in proxy logs) or as `?token=`.  The response pairs the artifact URL with its cosign signature so the client verifies the binary BEFORE trusting it: a signed URL alone proves where the bytes came from, not what they are. A yanked release is 410 Gone.
97pub async fn get_licensing_download_by_release(configuration: &configuration::Configuration, release: &str, x_license_token: Option<&str>, token: Option<&str>) -> Result<models::LicensingPeriodReleaseAsset, Error<GetLicensingDownloadByReleaseError>> {
98    // add a prefix to parameters to efficiently prevent name collisions
99    let p_release = release;
100    let p_x_license_token = x_license_token;
101    let p_token = token;
102
103    let uri_str = format!("{}/v1/licensing/download/{release}", configuration.base_path, release=crate::apis::urlencode(p_release));
104    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
105
106    if let Some(ref param_value) = p_token {
107        req_builder = req_builder.query(&[("token", &param_value.to_string())]);
108    }
109    if let Some(ref user_agent) = configuration.user_agent {
110        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
111    }
112    if let Some(param_value) = p_x_license_token {
113        req_builder = req_builder.header("X-License-Token", param_value.to_string());
114    }
115    if let Some(ref token) = configuration.bearer_access_token {
116        req_builder = req_builder.bearer_auth(token.to_owned());
117    };
118
119    let req = req_builder.build()?;
120    let resp = configuration.client.execute(req).await?;
121
122    let status = resp.status();
123    let content_type = resp
124        .headers()
125        .get("content-type")
126        .and_then(|v| v.to_str().ok())
127        .unwrap_or("application/octet-stream");
128    let content_type = super::ContentType::from(content_type);
129
130    if !status.is_client_error() && !status.is_server_error() {
131        let content = resp.text().await?;
132        match content_type {
133            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
134            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodReleaseAsset`"))),
135            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::LicensingPeriodReleaseAsset`")))),
136        }
137    } else {
138        let content = resp.text().await?;
139        let entity: Option<GetLicensingDownloadByReleaseError> = serde_json::from_str(&content).ok();
140        Err(Error::ResponseError(ResponseContent { status, content, entity }))
141    }
142}
143
144/// Health reports which signer this deployment mints with, and in which env.  It answers 200 whenever the process is up: there is nothing downstream to probe, since the KMS is reached only when a token is actually minted. Its value is the `signer` field — `\"signer\":\"local\"` on a production host says that deployment is signing licenses with a development key, which is a misconfiguration worth paging on rather than a healthy 200.
145pub async fn get_licensing_healthz(configuration: &configuration::Configuration, ) -> Result<models::LicensingPeriodHealthView, Error<GetLicensingHealthzError>> {
146
147    let uri_str = format!("{}/v1/licensing/healthz", configuration.base_path);
148    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
149
150    if let Some(ref user_agent) = configuration.user_agent {
151        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
152    }
153    if let Some(ref token) = configuration.bearer_access_token {
154        req_builder = req_builder.bearer_auth(token.to_owned());
155    };
156
157    let req = req_builder.build()?;
158    let resp = configuration.client.execute(req).await?;
159
160    let status = resp.status();
161    let content_type = resp
162        .headers()
163        .get("content-type")
164        .and_then(|v| v.to_str().ok())
165        .unwrap_or("application/octet-stream");
166    let content_type = super::ContentType::from(content_type);
167
168    if !status.is_client_error() && !status.is_server_error() {
169        let content = resp.text().await?;
170        match content_type {
171            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
172            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodHealthView`"))),
173            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::LicensingPeriodHealthView`")))),
174        }
175    } else {
176        let content = resp.text().await?;
177        let entity: Option<GetLicensingHealthzError> = serde_json::from_str(&content).ok();
178        Err(Error::ResponseError(ResponseContent { status, content, entity }))
179    }
180}
181
182/// Pubkey publishes the Ed25519 PUBLIC verification key, at both /pubkey and /jwks.  This is the only public-safe surface here and the reason the whole scheme works offline: the engine embeds or fetches this key once and then verifies every license itself, with no call home per launch. The private half never enters this process — it lives in the KMS — so nothing served here is a secret. `provider` names the KMS holding that half; `\"local\"` means a development key, and a token signed by one is not a production credential.
183pub async fn get_licensing_jwks(configuration: &configuration::Configuration, ) -> Result<models::LicensingPeriodPubkeyView, Error<GetLicensingJwksError>> {
184
185    let uri_str = format!("{}/v1/licensing/jwks", configuration.base_path);
186    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
187
188    if let Some(ref user_agent) = configuration.user_agent {
189        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
190    }
191    if let Some(ref token) = configuration.bearer_access_token {
192        req_builder = req_builder.bearer_auth(token.to_owned());
193    };
194
195    let req = req_builder.build()?;
196    let resp = configuration.client.execute(req).await?;
197
198    let status = resp.status();
199    let content_type = resp
200        .headers()
201        .get("content-type")
202        .and_then(|v| v.to_str().ok())
203        .unwrap_or("application/octet-stream");
204    let content_type = super::ContentType::from(content_type);
205
206    if !status.is_client_error() && !status.is_server_error() {
207        let content = resp.text().await?;
208        match content_type {
209            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
210            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodPubkeyView`"))),
211            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::LicensingPeriodPubkeyView`")))),
212        }
213    } else {
214        let content = resp.text().await?;
215        let entity: Option<GetLicensingJwksError> = serde_json::from_str(&content).ok();
216        Err(Error::ResponseError(ResponseContent { status, content, entity }))
217    }
218}
219
220/// Pubkey publishes the Ed25519 PUBLIC verification key, at both /pubkey and /jwks.  This is the only public-safe surface here and the reason the whole scheme works offline: the engine embeds or fetches this key once and then verifies every license itself, with no call home per launch. The private half never enters this process — it lives in the KMS — so nothing served here is a secret. `provider` names the KMS holding that half; `\"local\"` means a development key, and a token signed by one is not a production credential.
221pub async fn get_licensing_pubkey(configuration: &configuration::Configuration, ) -> Result<models::LicensingPeriodPubkeyView, Error<GetLicensingPubkeyError>> {
222
223    let uri_str = format!("{}/v1/licensing/pubkey", configuration.base_path);
224    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
225
226    if let Some(ref user_agent) = configuration.user_agent {
227        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
228    }
229    if let Some(ref token) = configuration.bearer_access_token {
230        req_builder = req_builder.bearer_auth(token.to_owned());
231    };
232
233    let req = req_builder.build()?;
234    let resp = configuration.client.execute(req).await?;
235
236    let status = resp.status();
237    let content_type = resp
238        .headers()
239        .get("content-type")
240        .and_then(|v| v.to_str().ok())
241        .unwrap_or("application/octet-stream");
242    let content_type = super::ContentType::from(content_type);
243
244    if !status.is_client_error() && !status.is_server_error() {
245        let content = resp.text().await?;
246        match content_type {
247            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
248            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodPubkeyView`"))),
249            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::LicensingPeriodPubkeyView`")))),
250        }
251    } else {
252        let content = resp.text().await?;
253        let entity: Option<GetLicensingPubkeyError> = serde_json::from_str(&content).ok();
254        Err(Error::ResponseError(ResponseContent { status, content, entity }))
255    }
256}
257
258/// Lists the signed binary releases this deployment can serve.  Metadata only, and no download URL: the artifact is behind GET /v1/licensing/download/{release}, which is gated on a valid license token. Knowing that a release exists is not permission to run it, which is why this list needs no license of its own.
259pub async fn get_licensing_releases(configuration: &configuration::Configuration, ) -> Result<models::LicensingPeriodReleaseList, Error<GetLicensingReleasesError>> {
260
261    let uri_str = format!("{}/v1/licensing/releases", configuration.base_path);
262    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
263
264    if let Some(ref user_agent) = configuration.user_agent {
265        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
266    }
267    if let Some(ref token) = configuration.bearer_access_token {
268        req_builder = req_builder.bearer_auth(token.to_owned());
269    };
270
271    let req = req_builder.build()?;
272    let resp = configuration.client.execute(req).await?;
273
274    let status = resp.status();
275    let content_type = resp
276        .headers()
277        .get("content-type")
278        .and_then(|v| v.to_str().ok())
279        .unwrap_or("application/octet-stream");
280    let content_type = super::ContentType::from(content_type);
281
282    if !status.is_client_error() && !status.is_server_error() {
283        let content = resp.text().await?;
284        match content_type {
285            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
286            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodReleaseList`"))),
287            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::LicensingPeriodReleaseList`")))),
288        }
289    } else {
290        let content = resp.text().await?;
291        let entity: Option<GetLicensingReleasesError> = serde_json::from_str(&content).ok();
292        Err(Error::ResponseError(ResponseContent { status, content, entity }))
293    }
294}
295
296/// Reads one release's metadata: its product, version, platform and the cosign material a client verifies the binary against.  An unknown id is 404. Like the list, this is metadata only — the bytes are behind the license-gated download.
297pub async fn get_licensing_releases_by_release(configuration: &configuration::Configuration, release: &str) -> Result<models::LicensingPeriodRelease, Error<GetLicensingReleasesByReleaseError>> {
298    // add a prefix to parameters to efficiently prevent name collisions
299    let p_release = release;
300
301    let uri_str = format!("{}/v1/licensing/releases/{release}", configuration.base_path, release=crate::apis::urlencode(p_release));
302    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
303
304    if let Some(ref user_agent) = configuration.user_agent {
305        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306    }
307    if let Some(ref token) = configuration.bearer_access_token {
308        req_builder = req_builder.bearer_auth(token.to_owned());
309    };
310
311    let req = req_builder.build()?;
312    let resp = configuration.client.execute(req).await?;
313
314    let status = resp.status();
315    let content_type = resp
316        .headers()
317        .get("content-type")
318        .and_then(|v| v.to_str().ok())
319        .unwrap_or("application/octet-stream");
320    let content_type = super::ContentType::from(content_type);
321
322    if !status.is_client_error() && !status.is_server_error() {
323        let content = resp.text().await?;
324        match content_type {
325            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
326            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodRelease`"))),
327            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::LicensingPeriodRelease`")))),
328        }
329    } else {
330        let content = resp.text().await?;
331        let entity: Option<GetLicensingReleasesByReleaseError> = serde_json::from_str(&content).ok();
332        Err(Error::ResponseError(ResponseContent { status, content, entity }))
333    }
334}
335
336/// Fingerprint turns raw device signals into the opaque value that binds a license to one machine.  This is the anti-copy step: the value returned here is folded into the signed token, so a token minted with it runs only on the device it was bound to. The derivation is one-way and salted — the signals are never stored and never echoed back — so the response is safe to persist client-side and pass to issue. Signals too weak to identify a machine (a hostname alone) are refused rather than turned into a binding that would collide with other machines.
337pub async fn post_licensing_fingerprint(configuration: &configuration::Configuration, licensing_period_fingerprint_request: models::LicensingPeriodFingerprintRequest) -> Result<models::LicensingPeriodFingerprintResponse, Error<PostLicensingFingerprintError>> {
338    // add a prefix to parameters to efficiently prevent name collisions
339    let p_licensing_period_fingerprint_request = licensing_period_fingerprint_request;
340
341    let uri_str = format!("{}/v1/licensing/fingerprint", configuration.base_path);
342    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
343
344    if let Some(ref user_agent) = configuration.user_agent {
345        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
346    }
347    if let Some(ref token) = configuration.bearer_access_token {
348        req_builder = req_builder.bearer_auth(token.to_owned());
349    };
350    req_builder = req_builder.json(&p_licensing_period_fingerprint_request);
351
352    let req = req_builder.build()?;
353    let resp = configuration.client.execute(req).await?;
354
355    let status = resp.status();
356    let content_type = resp
357        .headers()
358        .get("content-type")
359        .and_then(|v| v.to_str().ok())
360        .unwrap_or("application/octet-stream");
361    let content_type = super::ContentType::from(content_type);
362
363    if !status.is_client_error() && !status.is_server_error() {
364        let content = resp.text().await?;
365        match content_type {
366            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
367            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodFingerprintResponse`"))),
368            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::LicensingPeriodFingerprintResponse`")))),
369        }
370    } else {
371        let content = resp.text().await?;
372        let entity: Option<PostLicensingFingerprintError> = serde_json::from_str(&content).ok();
373        Err(Error::ResponseError(ResponseContent { status, content, entity }))
374    }
375}
376
377/// Issue mints a signed license token for a product the caller's org already pays for.  The order is the whole security argument: the caller is an IAM-validated principal, commerce is then asked whether that principal's ORG holds an ACTIVE entitlement for the product, and only then is a token signed — by the KMS, never by key material in this process. A product the org does not own answers 403 and no token. The signed features are the plan's features verbatim, so the engine enforces exactly what was bought, and the expiry is clamped to the entitlement's so a token cannot outlive the subscription that paid for it.  The token is the credential the engine runs on. Treat it as a secret.
378pub async fn post_licensing_issue(configuration: &configuration::Configuration, licensing_period_issue_request: models::LicensingPeriodIssueRequest) -> Result<models::LicensingPeriodIssueResponse, Error<PostLicensingIssueError>> {
379    // add a prefix to parameters to efficiently prevent name collisions
380    let p_licensing_period_issue_request = licensing_period_issue_request;
381
382    let uri_str = format!("{}/v1/licensing/issue", configuration.base_path);
383    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
384
385    if let Some(ref user_agent) = configuration.user_agent {
386        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
387    }
388    if let Some(ref token) = configuration.bearer_access_token {
389        req_builder = req_builder.bearer_auth(token.to_owned());
390    };
391    req_builder = req_builder.json(&p_licensing_period_issue_request);
392
393    let req = req_builder.build()?;
394    let resp = configuration.client.execute(req).await?;
395
396    let status = resp.status();
397    let content_type = resp
398        .headers()
399        .get("content-type")
400        .and_then(|v| v.to_str().ok())
401        .unwrap_or("application/octet-stream");
402    let content_type = super::ContentType::from(content_type);
403
404    if !status.is_client_error() && !status.is_server_error() {
405        let content = resp.text().await?;
406        match content_type {
407            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
408            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodIssueResponse`"))),
409            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::LicensingPeriodIssueResponse`")))),
410        }
411    } else {
412        let content = resp.text().await?;
413        let entity: Option<PostLicensingIssueError> = serde_json::from_str(&content).ok();
414        Err(Error::ResponseError(ResponseContent { status, content, entity }))
415    }
416}
417
418/// Publishes a signed binary release, answering 201 Created.  Outside dev a release MUST carry its cosign signature: this is how a binary becomes downloadable, so accepting an unsigned one would let an unverifiable artifact into the distribution path. Org-admin only — publishing is an operator action, not something a licensee does.
419pub async fn post_licensing_releases(configuration: &configuration::Configuration, licensing_period_release: models::LicensingPeriodRelease) -> Result<models::LicensingPeriodRelease, Error<PostLicensingReleasesError>> {
420    // add a prefix to parameters to efficiently prevent name collisions
421    let p_licensing_period_release = licensing_period_release;
422
423    let uri_str = format!("{}/v1/licensing/releases", configuration.base_path);
424    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
425
426    if let Some(ref user_agent) = configuration.user_agent {
427        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
428    }
429    if let Some(ref token) = configuration.bearer_access_token {
430        req_builder = req_builder.bearer_auth(token.to_owned());
431    };
432    req_builder = req_builder.json(&p_licensing_period_release);
433
434    let req = req_builder.build()?;
435    let resp = configuration.client.execute(req).await?;
436
437    let status = resp.status();
438    let content_type = resp
439        .headers()
440        .get("content-type")
441        .and_then(|v| v.to_str().ok())
442        .unwrap_or("application/octet-stream");
443    let content_type = super::ContentType::from(content_type);
444
445    if !status.is_client_error() && !status.is_server_error() {
446        let content = resp.text().await?;
447        match content_type {
448            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
449            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodRelease`"))),
450            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::LicensingPeriodRelease`")))),
451        }
452    } else {
453        let content = resp.text().await?;
454        let entity: Option<PostLicensingReleasesError> = serde_json::from_str(&content).ok();
455        Err(Error::ResponseError(ResponseContent { status, content, entity }))
456    }
457}
458
459/// Revoke turns off tokens that have already been issued.  A signed token cannot be un-signed, so revocation is the only way to withdraw one: this appends an entry that verify and the license-gated download both consult. It is a POST rather than a DELETE because it APPENDS a durable, attributed record — the entry names the admin who recorded it and when — rather than removing one.  Org-admin only. Scope it as narrowly as the incident allows: \"nonce\" for one leaked token, \"holder\" for one compromised account, \"fingerprint\" for one stolen machine, \"release\" when a whole build is bad.
460pub async fn post_licensing_revoke(configuration: &configuration::Configuration, licensing_period_revoke_request: models::LicensingPeriodRevokeRequest) -> Result<models::LicensingPeriodRevokeResponse, Error<PostLicensingRevokeError>> {
461    // add a prefix to parameters to efficiently prevent name collisions
462    let p_licensing_period_revoke_request = licensing_period_revoke_request;
463
464    let uri_str = format!("{}/v1/licensing/revoke", configuration.base_path);
465    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
466
467    if let Some(ref user_agent) = configuration.user_agent {
468        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
469    }
470    if let Some(ref token) = configuration.bearer_access_token {
471        req_builder = req_builder.bearer_auth(token.to_owned());
472    };
473    req_builder = req_builder.json(&p_licensing_period_revoke_request);
474
475    let req = req_builder.build()?;
476    let resp = configuration.client.execute(req).await?;
477
478    let status = resp.status();
479    let content_type = resp
480        .headers()
481        .get("content-type")
482        .and_then(|v| v.to_str().ok())
483        .unwrap_or("application/octet-stream");
484    let content_type = super::ContentType::from(content_type);
485
486    if !status.is_client_error() && !status.is_server_error() {
487        let content = resp.text().await?;
488        match content_type {
489            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
490            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodRevokeResponse`"))),
491            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::LicensingPeriodRevokeResponse`")))),
492        }
493    } else {
494        let content = resp.text().await?;
495        let entity: Option<PostLicensingRevokeError> = serde_json::from_str(&content).ok();
496        Err(Error::ResponseError(ResponseContent { status, content, entity }))
497    }
498}
499
500/// Verify checks a license token online: signature, schema, expiry, app_id and the revocation list.  It is UNAUTHENTICATED and always answers 200 — a bad token is `valid:false` with a reason rather than an error status, because \"is this token good\" is a question anyone may ask about a credential they already hold and the answer is the same either way. It is also OPTIONAL: the engine verifies OFFLINE against the published public key (GET /v1/licensing/pubkey) and needs this endpoint only to learn about revocation, so an outage here never stops a paid customer working.
501pub async fn post_licensing_verify(configuration: &configuration::Configuration, licensing_period_verify_request: models::LicensingPeriodVerifyRequest) -> Result<models::LicensingPeriodVerifyResponse, Error<PostLicensingVerifyError>> {
502    // add a prefix to parameters to efficiently prevent name collisions
503    let p_licensing_period_verify_request = licensing_period_verify_request;
504
505    let uri_str = format!("{}/v1/licensing/verify", configuration.base_path);
506    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
507
508    if let Some(ref user_agent) = configuration.user_agent {
509        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
510    }
511    if let Some(ref token) = configuration.bearer_access_token {
512        req_builder = req_builder.bearer_auth(token.to_owned());
513    };
514    req_builder = req_builder.json(&p_licensing_period_verify_request);
515
516    let req = req_builder.build()?;
517    let resp = configuration.client.execute(req).await?;
518
519    let status = resp.status();
520    let content_type = resp
521        .headers()
522        .get("content-type")
523        .and_then(|v| v.to_str().ok())
524        .unwrap_or("application/octet-stream");
525    let content_type = super::ContentType::from(content_type);
526
527    if !status.is_client_error() && !status.is_server_error() {
528        let content = resp.text().await?;
529        match content_type {
530            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
531            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LicensingPeriodVerifyResponse`"))),
532            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::LicensingPeriodVerifyResponse`")))),
533        }
534    } else {
535        let content = resp.text().await?;
536        let entity: Option<PostLicensingVerifyError> = serde_json::from_str(&content).ok();
537        Err(Error::ResponseError(ResponseContent { status, content, entity }))
538    }
539}
540