Skip to main content

hanzo_client/models/
wire.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
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Wire {
16    /// Action is the verb that was performed. It is the event's name, not the HTTP method — a request-sourced record carries both, and the pair is what makes a row readable (\"grant.create\" at POST /v1/admin/grants).
17    #[serde(rename = "action", skip_serializing_if = "Option::is_none")]
18    pub action: Option<String>,
19    /// Auth is the credential the actor presented: \"jwt\", \"api-key\", or \"none\".
20    #[serde(rename = "authMethod", skip_serializing_if = "Option::is_none")]
21    pub auth_method: Option<String>,
22    /// Email is the actor's validated address, absent when the credential carried none. It comes from the verified token, never from a client header.
23    #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
24    pub email: Option<String>,
25    /// Hash is this record's SHA-256 over its own canonical JSON with both hash fields cleared, folded with prevHash. Recomputing it from the row's other fields is what proves the row has not been edited.
26    #[serde(rename = "hash", skip_serializing_if = "Option::is_none")]
27    pub hash: Option<String>,
28    /// Home is present ONLY on a cross-org action: the org the actor came FROM, while Org is the org they acted IN. A console row carrying `home` is a platform-admin impersonation and should be rendered as one.
29    #[serde(rename = "home", skip_serializing_if = "Option::is_none")]
30    pub home: Option<String>,
31    /// IsAdmin is the VALIDATED platform-SuperAdmin bit at decision time (membership of the reserved admin org), never the client's own claim to be one.
32    #[serde(rename = "isAdmin", skip_serializing_if = "Option::is_none")]
33    pub is_admin: Option<bool>,
34    /// Method is the HTTP verb, on a record a request produced. Absent on an event emitted from inside the binary with no request behind it.
35    #[serde(rename = "method", skip_serializing_if = "Option::is_none")]
36    pub method: Option<String>,
37    /// Org is the tenant the action was taken IN — the effective org, which for everyone but an impersonating SuperAdmin is also the actor's own. Empty on an unauthenticated request.
38    #[serde(rename = "org", skip_serializing_if = "Option::is_none")]
39    pub org: Option<String>,
40    /// Path is the request's route. Any segment shaped like a credential is replaced before the record is written, so a key that rides in a path is not preserved here by the very control meant to watch it.
41    #[serde(rename = "path", skip_serializing_if = "Option::is_none")]
42    pub path: Option<String>,
43    /// PrevHash is the hash of record seq-1, which is what links the rows into a chain: a deleted or reordered record breaks the recomputation at that point. The first record of a chain carries 64 zeros rather than an empty string, so \"start of chain\" and \"field missing\" cannot look alike.
44    #[serde(rename = "prevHash", skip_serializing_if = "Option::is_none")]
45    pub prev_hash: Option<String>,
46    /// Reason is a short explanation for a deny or an error (\"SuperAdmin required\", \"insufficient_balance\"). It is never a secret and never a raw upstream error body; absent on a success.
47    #[serde(rename = "reason", skip_serializing_if = "Option::is_none")]
48    pub reason: Option<String>,
49    /// RequestID ties this row to the request-line log and any downstream trace — the X-Request-Id the pipeline minted for that request.
50    #[serde(rename = "requestId", skip_serializing_if = "Option::is_none")]
51    pub request_id: Option<String>,
52    /// Resource is the KIND of thing acted upon (\"org\", \"role\", \"secret\", \"provider-config\", \"credit\"). Where a mutation has no finer semantics than its route, this is the route family and resourceId is empty — the action and the path already pin the object.
53    #[serde(rename = "resource", skip_serializing_if = "Option::is_none")]
54    pub resource: Option<String>,
55    /// ResourceID is the specific instance, absent when the kind alone identifies it.
56    #[serde(rename = "resourceId", skip_serializing_if = "Option::is_none")]
57    pub resource_id: Option<String>,
58    /// Result is how the action ended: \"success\", \"deny\" or \"error\". A deny is a decision this binary made and is as much evidence as a success.
59    #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
60    pub result: Option<String>,
61    /// Seq is the record's position in the chain, 0-based and gapless. The Recorder assigns it under its own lock, so it is a true total order: seq n+1 was written after seq n, and a missing number is a missing record.
62    #[serde(rename = "seq", skip_serializing_if = "Option::is_none")]
63    pub seq: Option<i32>,
64    /// SourceIP is the client address the edge resolved for the request, after the proxy chain — the address a responder would act on, not the socket peer.
65    #[serde(rename = "sourceIp", skip_serializing_if = "Option::is_none")]
66    pub source_ip: Option<String>,
67    /// Status is the HTTP status the caller received. It is the outcome as the client saw it, so a 200 carrying a domain refusal still reads 200 here.
68    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
69    pub status: Option<i32>,
70    /// Sub is the acting user (the IAM subject). Empty for a machine principal or an anonymous request, which is how a service action is told from a person's.
71    #[serde(rename = "sub", skip_serializing_if = "Option::is_none")]
72    pub sub: Option<String>,
73    /// Time is when the action happened, RFC3339Nano in UTC. The stored column has the same precision and sorts the same way, so a client can range and order on this string verbatim.
74    #[serde(rename = "time", skip_serializing_if = "Option::is_none")]
75    pub time: Option<String>,
76    /// UserAgent is the client the request announced itself as. Client-supplied, so it is evidence about what claimed to act, not proof of it.
77    #[serde(rename = "userAgent", skip_serializing_if = "Option::is_none")]
78    pub user_agent: Option<String>,
79}
80
81impl Wire {
82    pub fn new() -> Wire {
83        Wire {
84            action: None,
85            auth_method: None,
86            email: None,
87            hash: None,
88            home: None,
89            is_admin: None,
90            method: None,
91            org: None,
92            path: None,
93            prev_hash: None,
94            reason: None,
95            request_id: None,
96            resource: None,
97            resource_id: None,
98            result: None,
99            seq: None,
100            source_ip: None,
101            status: None,
102            sub: None,
103            time: None,
104            user_agent: None,
105        }
106    }
107}
108