axonflow-sdk-rust 0.10.0

Rust SDK for the AxonFlow AI governance platform
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
{
  "artifact": "axonflow-authzen-surface",
  "artifact_version": 1,
  "profile": "axonflow-authzen-profile-2026-08-29",
  "profile_header": "X-Axonflow-AuthZEN-Profile",
  "route": {
    "method": "POST",
    "path": "/api/v1/access/evaluation"
  },
  "contract_schema_version": "2026-08-29",
  "source_schema_id": "https://schemas.getaxonflow.com/decision/contract-2026-08-29.schema.json",
  "source_schema_sha256": "sha256:04f63f4d97215faa9fbf2b6a5152630f7310edbe47440b975d0f66ad63df811f",
  "enums": [
    {
      "name": "authzen_error_code",
      "values": [
        "malformed_envelope",
        "incomplete_evaluation",
        "unsupported_subject",
        "unsupported_action",
        "unsupported_resource",
        "unevaluable_attribute",
        "missing_evaluable_content",
        "evaluation_unavailable"
      ]
    },
    {
      "name": "category",
      "values": [
        "allowed",
        "not_permitted",
        "approval_required",
        "temporarily_unavailable",
        "invalid_request"
      ]
    },
    {
      "name": "identifier_kind",
      "values": [
        "organization",
        "principal",
        "group",
        "resource",
        "action",
        "tool",
        "client",
        "session"
      ]
    },
    {
      "name": "obligation_type",
      "values": [
        "approval_challenge",
        "field_remove",
        "field_redact",
        "field_hash",
        "field_mask",
        "field_annotate",
        "field_tokenize",
        "schema_transform",
        "response_filter",
        "route_restriction",
        "step_up_authentication",
        "quota_reservation",
        "immutable_audit",
        "notification"
      ]
    },
    {
      "name": "operational_state",
      "values": [
        "ALLOW",
        "DENY",
        "CHALLENGE",
        "ERROR"
      ]
    },
    {
      "name": "reason_code",
      "values": [
        "permitted",
        "approval_required",
        "explicit_constraint",
        "no_matching_permission",
        "unknown_constraint",
        "unknown_permission",
        "unknown_requirement",
        "invalid_input",
        "evaluation_error",
        "unsupported_obligation",
        "obligation_conflict",
        "unknown_action",
        "unknown_realm",
        "schema_violation",
        "delegation_depth_exceeded",
        "budget_exhausted",
        "binding_mismatch",
        "approval_unsatisfiable",
        "approval_expired",
        "authoring_rejected"
      ]
    }
  ],
  "types": [
    {
      "name": "approval_clause",
      "doc": "One immutable threshold clause: a quorum of distinct approvers drawn from a named eligible set. It is named here rather than inlined under approval_requirement so it corresponds one-to-one with the Go ApprovalClause, which is what lets the drift guard compare it and every SDK generate it as a type rather than an anonymous shape.",
      "fields": [
        {
          "name": "quorum",
          "required": true,
          "type": {
            "kind": "int"
          }
        },
        {
          "name": "eligible",
          "required": true,
          "type": {
            "kind": "array",
            "items": {
              "kind": "ref",
              "ref": "identifier"
            }
          },
          "min_items": 1
        }
      ]
    },
    {
      "name": "approval_requirement",
      "doc": "A conjunction of immutable threshold clauses. Clauses are never collapsed by pool intersection or union.",
      "fields": [
        {
          "name": "all_of",
          "required": true,
          "type": {
            "kind": "array",
            "items": {
              "kind": "ref",
              "ref": "approval_clause"
            }
          },
          "min_items": 1
        },
        {
          "name": "separation_of_duties",
          "required": true,
          "type": {
            "kind": "bool"
          }
        },
        {
          "name": "expires_at",
          "required": true,
          "type": {
            "kind": "string"
          }
        }
      ]
    },
    {
      "name": "authzen_action",
      "doc": "The AuthZEN action object.",
      "fields": [
        {
          "name": "name",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "properties",
          "required": false,
          "type": {
            "kind": "object"
          }
        }
      ]
    },
    {
      "name": "authzen_bulk",
      "doc": "The plural envelope: a shared subject, action, resource and context at the top level, with one entry per decision. The number of decisions is fixed by the MAPPING, never by argument data, so an empty evaluations array is malformed rather than a request for zero decisions.",
      "fields": [
        {
          "name": "subject",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_subject"
          }
        },
        {
          "name": "action",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_action"
          }
        },
        {
          "name": "resource",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_resource"
          }
        },
        {
          "name": "context",
          "required": false,
          "type": {
            "kind": "object"
          }
        },
        {
          "name": "evaluations",
          "required": true,
          "type": {
            "kind": "array",
            "items": {
              "kind": "ref",
              "ref": "authzen_request"
            }
          },
          "min_items": 1
        }
      ]
    },
    {
      "name": "authzen_envelope",
      "doc": "The top level. Exactly two members are defined and exactly one may be PRESENT. Presence is decided on the KEY SET, not on a decoded pointer, so {\"evaluation\": {...}, \"evaluations\": null} carries both declared members and is malformed.",
      "fields": [
        {
          "name": "evaluation",
          "doc": "The singular member. Unlike a plural entry it has no shared base to inherit from, so it must carry its own subject, action and resource.",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_request"
          },
          "requires_members": [
            "action",
            "resource",
            "subject"
          ]
        },
        {
          "name": "evaluations",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_bulk"
          }
        }
      ],
      "exactly_one_of": [
        [
          "evaluation",
          "evaluations"
        ]
      ]
    },
    {
      "name": "authzen_error",
      "doc": "The structured refusal body, returned when a request could not be EVALUATED. It is a separate shape from the response rather than an extra member on it, because a refusal is not a decision: a response carrying decision=false says the request was evaluated and denied, and returning that for a request that was never evaluated would make 'denied' and 'unevaluable' the same event in every audit and every client branch.",
      "fields": [
        {
          "name": "code",
          "required": true,
          "type": {
            "kind": "enum",
            "enum": "authzen_error_code"
          }
        },
        {
          "name": "pointer",
          "required": false,
          "type": {
            "kind": "string"
          }
        },
        {
          "name": "message",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "supported",
          "required": false,
          "type": {
            "kind": "array",
            "items": {
              "kind": "string"
            }
          }
        },
        {
          "name": "request_id",
          "required": false,
          "type": {
            "kind": "string"
          }
        }
      ]
    },
    {
      "name": "authzen_request",
      "doc": "One subject-action-resource-context evaluation. Every member is structurally OPTIONAL here because a plural-envelope entry inherits any member it omits from the envelope's shared base. The completeness invariant - that the MERGED entry carries a subject, an action and a resource - is a cross-object property this document cannot express, and AuthZENEnvelope.Project enforces it. A validator that passes this schema has therefore NOT established completeness, which is why the singular member below carries its own required list.",
      "fields": [
        {
          "name": "subject",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_subject"
          }
        },
        {
          "name": "action",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_action"
          }
        },
        {
          "name": "resource",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_resource"
          }
        },
        {
          "name": "context",
          "required": false,
          "type": {
            "kind": "object"
          }
        }
      ]
    },
    {
      "name": "authzen_resource",
      "doc": "The AuthZEN resource object.",
      "fields": [
        {
          "name": "type",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "id",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "properties",
          "required": false,
          "type": {
            "kind": "object"
          }
        }
      ]
    },
    {
      "name": "authzen_response",
      "doc": "The AuthZEN reply. `decision` is the collapsed boolean: ALLOW is true and every other state is false. It is the only member an un-negotiated enforcement point receives.",
      "fields": [
        {
          "name": "decision",
          "required": true,
          "type": {
            "kind": "bool"
          }
        },
        {
          "name": "context",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "authzen_response_context"
          }
        }
      ]
    },
    {
      "name": "authzen_response_context",
      "doc": "The versioned AxonFlow profile payload. It is present only for a Policy Enforcement Point that NEGOTIATED the profile; one that did not receives the boolean alone, because handing a partial interpretation to a plane that cannot act on it is the failure ADR-065 invariant 12 forbids.",
      "fields": [
        {
          "name": "profile",
          "required": true,
          "type": {
            "kind": "string"
          },
          "const": "axonflow-authzen-profile-2026-08-29"
        },
        {
          "name": "state",
          "required": true,
          "type": {
            "kind": "enum",
            "enum": "operational_state"
          }
        },
        {
          "name": "category",
          "required": true,
          "type": {
            "kind": "enum",
            "enum": "category"
          }
        },
        {
          "name": "reason",
          "required": false,
          "type": {
            "kind": "enum",
            "enum": "reason_code"
          }
        },
        {
          "name": "obligations",
          "required": false,
          "type": {
            "kind": "array",
            "items": {
              "kind": "ref",
              "ref": "obligation"
            }
          }
        },
        {
          "name": "approval",
          "required": false,
          "type": {
            "kind": "ref",
            "ref": "approval_requirement"
          }
        },
        {
          "name": "decision_id",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "schema_version",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        }
      ]
    },
    {
      "name": "authzen_subject",
      "doc": "The AuthZEN subject object. type and id are canonical identifier components; a display name, an email or a token claim is never one of them.",
      "fields": [
        {
          "name": "type",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "id",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "properties",
          "required": false,
          "type": {
            "kind": "object"
          }
        }
      ]
    },
    {
      "name": "identifier",
      "doc": "A canonical identifier. Display names, emails, token claims, connector names and aliases are never identifiers.",
      "fields": [
        {
          "name": "kind",
          "required": true,
          "type": {
            "kind": "enum",
            "enum": "identifier_kind"
          }
        },
        {
          "name": "type",
          "required": true,
          "type": {
            "kind": "string"
          }
        },
        {
          "name": "qualifier",
          "required": false,
          "type": {
            "kind": "string"
          }
        },
        {
          "name": "local",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        }
      ]
    },
    {
      "name": "obligation",
      "doc": "One typed instruction owned by a named enforcement component.",
      "fields": [
        {
          "name": "type",
          "required": true,
          "type": {
            "kind": "enum",
            "enum": "obligation_type"
          }
        },
        {
          "name": "target",
          "required": false,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "params",
          "required": false,
          "type": {
            "kind": "map",
            "value": {
              "kind": "string"
            }
          }
        },
        {
          "name": "mandatory",
          "required": true,
          "type": {
            "kind": "bool"
          }
        },
        {
          "name": "source_policy",
          "required": true,
          "type": {
            "kind": "string"
          },
          "min_length": 1
        },
        {
          "name": "schema_version",
          "required": true,
          "type": {
            "kind": "int"
          }
        }
      ]
    }
  ]
}