Skip to main content

lodestone_wire/
lib.rs

1//! @generated by scripts/generate-lodestone-api.py; do not edit by hand.
2//! Active Lodestone API public DTOs; predecessor public reachability is absent.
3
4use serde::{Deserialize, Serialize};
5mod bulk_batch_id;
6pub use bulk_batch_id::{BulkBatchIdError, bulk_batch_id};
7
8pub const LODESTONE_API_SCHEMA_ID: &str = "lodestone-api";
9pub const LODESTONE_API_SPEC_SHA256: &str = "b17cbe5f743605fededf1dda098e19340f48a1c182c612fef8de1d1ffe616ab4";
10pub const LODESTONE_API_FORMAT_VERSION: u16 = 2;
11pub const LODESTONE_API_ALPN: &str = "lodestone";
12pub const BULK_BATCH_ID_FORMAT_VERSION: u16 = 2;
13pub const BULK_BATCH_ID_DOMAIN: &[u8] = b"lodestone/bulk-batch\0";
14
15#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
16#[serde(transparent)]
17pub struct I64 {
18    pub value: String,
19}
20#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
21#[serde(transparent)]
22pub struct U64 {
23    pub value: String,
24}
25#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
26#[serde(transparent)]
27pub struct Identity {
28    pub value: String,
29}
30#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
31#[serde(transparent)]
32pub struct Digest {
33    pub value: String,
34}
35#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
36pub struct ExactDecimal {
37    pub coefficient: String,
38    pub scale: u32,
39}
40#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
41#[serde(transparent)]
42pub struct ApproximateNumber {
43    pub canonical_value: String,
44}
45#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
46#[serde(deny_unknown_fields)]
47pub struct RawJson {
48    pub bytes_base64: String,
49}
50#[derive(Clone, Copy, Debug, Eq, PartialEq)]
51pub enum ScalarError {
52    InvalidI64,
53    InvalidU64,
54    InvalidIdentity,
55    InvalidDigest,
56    InvalidDecimal,
57    InvalidApproximateNumber,
58}
59impl std::fmt::Display for ScalarError {
60    fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
61        write!(formatter, "invalid Lodestone API scalar: {self:?}")
62    }
63}
64impl I64 {
65    pub fn validate(&self) -> Result<(), ScalarError> {
66        self.value
67            .parse::<i64>()
68            .ok()
69            .filter(|parsed| parsed.to_string() == self.value)
70            .map(|_| ())
71            .ok_or(ScalarError::InvalidI64)
72    }
73}
74impl U64 {
75    pub fn validate(&self) -> Result<(), ScalarError> {
76        self.value
77            .parse::<u64>()
78            .ok()
79            .filter(|parsed| parsed.to_string() == self.value)
80            .map(|_| ())
81            .ok_or(ScalarError::InvalidU64)
82    }
83}
84impl Identity {
85    pub fn validate(&self) -> Result<(), ScalarError> {
86        (self.value.len() == 32
87            && self
88                .value
89                .bytes()
90                .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte)))
91        .then_some(())
92        .ok_or(ScalarError::InvalidIdentity)
93    }
94}
95impl Digest {
96    pub fn validate(&self) -> Result<(), ScalarError> {
97        (self.value.len() == 64
98            && self
99                .value
100                .bytes()
101                .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte)))
102        .then_some(())
103        .ok_or(ScalarError::InvalidDigest)
104    }
105}
106impl ExactDecimal {
107    pub fn validate(&self) -> Result<(), ScalarError> {
108        let unsigned = self.coefficient.strip_prefix('-').unwrap_or(&self.coefficient);
109        let canonical = self.coefficient == "0"
110            || (!unsigned.is_empty()
111                && !unsigned.starts_with('0')
112                && unsigned.bytes().all(|byte| byte.is_ascii_digit()));
113        (canonical
114            && self.coefficient != "-0"
115            && self.scale <= 1024
116            && (self.scale == 0 || !self.coefficient.ends_with('0')))
117        .then_some(())
118        .ok_or(ScalarError::InvalidDecimal)
119    }
120}
121impl ApproximateNumber {
122    pub fn validate(&self) -> Result<(), ScalarError> {
123        self.canonical_value
124            .parse::<f64>()
125            .ok()
126            .filter(|parsed| {
127                parsed.is_finite() && self.canonical_value != "-0" && parsed.to_string() == self.canonical_value
128            })
129            .map(|_| ())
130            .ok_or(ScalarError::InvalidApproximateNumber)
131    }
132}
133macro_rules! deserialize_validated_string_scalar {
134    ($type:ty) => {
135        impl<'de> Deserialize<'de> for $type {
136            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
137            where
138                D: serde::Deserializer<'de>,
139            {
140                let value = String::deserialize(deserializer)?;
141                let scalar = Self { value };
142                scalar.validate().map_err(serde::de::Error::custom)?;
143                Ok(scalar)
144            }
145        }
146    };
147}
148deserialize_validated_string_scalar!(I64);
149deserialize_validated_string_scalar!(U64);
150deserialize_validated_string_scalar!(Identity);
151deserialize_validated_string_scalar!(Digest);
152impl<'de> Deserialize<'de> for ExactDecimal {
153    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
154    where
155        D: serde::Deserializer<'de>,
156    {
157        #[derive(Deserialize)]
158        #[serde(deny_unknown_fields)]
159        struct Wire {
160            coefficient: String,
161            scale: u32,
162        }
163        let wire = Wire::deserialize(deserializer)?;
164        let scalar = Self {
165            coefficient: wire.coefficient,
166            scale: wire.scale,
167        };
168        scalar.validate().map_err(serde::de::Error::custom)?;
169        Ok(scalar)
170    }
171}
172impl<'de> Deserialize<'de> for ApproximateNumber {
173    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
174    where
175        D: serde::Deserializer<'de>,
176    {
177        let canonical_value = String::deserialize(deserializer)?;
178        let scalar = Self { canonical_value };
179        scalar.validate().map_err(serde::de::Error::custom)?;
180        Ok(scalar)
181    }
182}
183#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
184#[serde(tag = "kind", content = "value", rename_all = "snake_case")]
185pub enum JsonValue {
186    Null,
187    Bool(bool),
188    String(String),
189    I64(I64),
190    U64(U64),
191    ExactDecimal(ExactDecimal),
192    Approximate(ApproximateNumber),
193    Array(Vec<JsonValue>),
194    Object(Vec<JsonField>),
195}
196#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
197#[serde(deny_unknown_fields)]
198pub struct JsonField {
199    pub name: String,
200    pub value: JsonValue,
201}
202#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
203#[serde(rename_all = "snake_case")]
204pub enum Action {
205    IdentityDiscovery,
206    DataRead,
207    DataWrite,
208    Append,
209    ResolveAppend,
210    IndexAdmin,
211    CatalogRead,
212    TaskRead,
213    SubscriptionRead,
214    DiagnosticsRead,
215    DiagnosticsCreate,
216    BackupRead,
217    BackupAdmin,
218    SecurityRead,
219    SecurityAdmin,
220    AuditRead,
221    QuotaRead,
222    QuotaAdmin,
223    BindingRead,
224    LifecycleAdmin,
225    AdmissionRead,
226    AdmissionAdmin,
227    UsageRead,
228    OperationRead,
229    OperationCancel,
230}
231
232#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
233#[serde(rename_all = "snake_case")]
234pub enum ErrorCode {
235    Aborted,
236    DeadlineExceeded,
237    InvalidRequest,
238    UnsupportedVersion,
239    Unauthenticated,
240    PermissionDenied,
241    NotFound,
242    Conflict,
243    StaleCursor,
244    RestartBudgetExhausted,
245    LimitExceeded,
246    CapabilityUnavailable,
247    NotSubmitted,
248    SubmittedIndeterminate,
249    ExpiredUnknown,
250    SecretNotEscrowed,
251    RetentionGap,
252    ArtifactRangeInvalid,
253    ChecksumMismatch,
254    TemporarilyUnavailable,
255    Internal,
256}
257
258#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
259#[serde(rename_all = "snake_case")]
260pub enum Command {
261    Discover,
262    ListIndexes,
263    GetIndex,
264    ValidateIndexChange,
265    ApplyIndexChange,
266    ApplyAdministrationMutation,
267    ListAliases,
268    GetAlias,
269    ListDataStreams,
270    GetDataStream,
271    ListComponentTemplates,
272    GetComponentTemplate,
273    ListIndexTemplates,
274    GetIndexTemplate,
275    ListIngestPipelines,
276    GetIngestPipeline,
277    SimulateIngestPipeline,
278    ReprocessByQuery,
279    ListLifecyclePolicies,
280    GetLifecyclePolicy,
281    PrepareCreateIndex,
282    PrepareDeleteIndex,
283    SubmitCatalogAction,
284    ResolveCatalogAction,
285    PrepareReplayableSourceIndex,
286    SubmitReplayableSourceIndex,
287    GetReplayableSource,
288    ControlReplayableSource,
289    CloneIndex,
290    ConfigureHistory,
291    GetHistory,
292    ResolveHistory,
293    PlaceHistoryHold,
294    ReleaseHistoryHold,
295    PrepareDocumentMutation,
296    SubmitDocumentMutation,
297    PrepareDocumentBulk,
298    SubmitDocumentBulk,
299    ResolveDocumentBulk,
300    PrepareAppendBulk,
301    SubmitAppendBulk,
302    ResolveAppendBulk,
303    ObserveAppendCommitted,
304    ResolveDocumentMutation,
305    GetDocument,
306    Search,
307    OpenPit,
308    RenewPit,
309    ClosePit,
310    ListOperations,
311    GetOperation,
312    CancelOperation,
313    ListAuditEvents,
314    ExportAuditEvents,
315    ReserveServiceCredential,
316    ReserveServiceCredentialRotation,
317    ActivateServiceCredential,
318    ResolveServiceCredentialReservation,
319    PrepareRevokeServiceCredential,
320    RevokeServiceCredential,
321    ResolveSecurityAction,
322    GetSecurityRole,
323    PrepareRoleAppendAccessChange,
324    SubmitRoleAppendAccessChange,
325    ListServiceCredentials,
326    ListBackups,
327    GetBackup,
328    CreateBackup,
329    ResolveBackupAction,
330    GetRuntimeStatus,
331    GetResultCacheStatus,
332    GetFieldPromotionStatus,
333    GetOverloadStatus,
334    ConfigureExternalKey,
335    RotateExternalKeyBinding,
336    ConfigureAggregateThenDelete,
337    GetLifecycleStatus,
338    GetQuota,
339    UpdateQuota,
340    GetBinding,
341    GetAdmissionStatus,
342    SetAdmission,
343    GetQuiesceStatus,
344    GetDecommissionReadiness,
345    GetUpgradeReadiness,
346    GetMaintenanceStatus,
347    GetRestoreReadiness,
348    CreateDiagnostic,
349    GetDiagnostic,
350    ReadArtifactChunk,
351    ExportUsage,
352    ExecuteStateRead,
353    PrepareStateWrite,
354    SubmitStateWrite,
355    ResolveStateWrite,
356}
357
358#[derive(Clone, Copy, Debug, Eq, PartialEq)]
359pub struct ActionAuthorizationContract {
360    pub action: Action,
361    pub any_of_permission_ids: &'static [&'static str],
362}
363pub const LODESTONE_API_ACTION_AUTHORIZATION: &[ActionAuthorizationContract] = &[
364    ActionAuthorizationContract {
365        action: Action::IdentityDiscovery,
366        any_of_permission_ids: &["security_read"],
367    },
368    ActionAuthorizationContract {
369        action: Action::DataRead,
370        any_of_permission_ids: &["data_read"],
371    },
372    ActionAuthorizationContract {
373        action: Action::DataWrite,
374        any_of_permission_ids: &["data_write"],
375    },
376    ActionAuthorizationContract {
377        action: Action::Append,
378        any_of_permission_ids: &["append"],
379    },
380    ActionAuthorizationContract {
381        action: Action::ResolveAppend,
382        any_of_permission_ids: &["resolve_append"],
383    },
384    ActionAuthorizationContract {
385        action: Action::IndexAdmin,
386        any_of_permission_ids: &["index_admin"],
387    },
388    ActionAuthorizationContract {
389        action: Action::CatalogRead,
390        any_of_permission_ids: &["catalog_read"],
391    },
392    ActionAuthorizationContract {
393        action: Action::TaskRead,
394        any_of_permission_ids: &["task_read"],
395    },
396    ActionAuthorizationContract {
397        action: Action::SubscriptionRead,
398        any_of_permission_ids: &["subscription_read"],
399    },
400    ActionAuthorizationContract {
401        action: Action::DiagnosticsRead,
402        any_of_permission_ids: &["diagnostics_read"],
403    },
404    ActionAuthorizationContract {
405        action: Action::DiagnosticsCreate,
406        any_of_permission_ids: &["diagnostics_create"],
407    },
408    ActionAuthorizationContract {
409        action: Action::BackupRead,
410        any_of_permission_ids: &["backup_read"],
411    },
412    ActionAuthorizationContract {
413        action: Action::BackupAdmin,
414        any_of_permission_ids: &["backup_admin"],
415    },
416    ActionAuthorizationContract {
417        action: Action::SecurityRead,
418        any_of_permission_ids: &["security_read"],
419    },
420    ActionAuthorizationContract {
421        action: Action::SecurityAdmin,
422        any_of_permission_ids: &["security_admin"],
423    },
424    ActionAuthorizationContract {
425        action: Action::AuditRead,
426        any_of_permission_ids: &["audit_read"],
427    },
428    ActionAuthorizationContract {
429        action: Action::QuotaRead,
430        any_of_permission_ids: &["quota_read"],
431    },
432    ActionAuthorizationContract {
433        action: Action::QuotaAdmin,
434        any_of_permission_ids: &["quota_admin"],
435    },
436    ActionAuthorizationContract {
437        action: Action::BindingRead,
438        any_of_permission_ids: &["binding_read"],
439    },
440    ActionAuthorizationContract {
441        action: Action::LifecycleAdmin,
442        any_of_permission_ids: &["lifecycle_admin"],
443    },
444    ActionAuthorizationContract {
445        action: Action::AdmissionRead,
446        any_of_permission_ids: &["admission_read"],
447    },
448    ActionAuthorizationContract {
449        action: Action::AdmissionAdmin,
450        any_of_permission_ids: &["admission_admin"],
451    },
452    ActionAuthorizationContract {
453        action: Action::UsageRead,
454        any_of_permission_ids: &["usage_read"],
455    },
456    ActionAuthorizationContract {
457        action: Action::OperationRead,
458        any_of_permission_ids: &[
459            "catalog_read",
460            "task_read",
461            "security_read",
462            "backup_read",
463            "diagnostics_read",
464        ],
465    },
466    ActionAuthorizationContract {
467        action: Action::OperationCancel,
468        any_of_permission_ids: &[
469            "index_admin",
470            "task_admin",
471            "security_admin",
472            "backup_admin",
473            "diagnostics_create",
474        ],
475    },
476];
477pub fn action_authorization(action: Action) -> Option<&'static ActionAuthorizationContract> {
478    LODESTONE_API_ACTION_AUTHORIZATION
479        .iter()
480        .find(|contract| contract.action == action)
481}
482
483#[derive(Clone, Copy, Debug, Eq, PartialEq)]
484pub struct RuntimeCapabilityAuthorizationContract {
485    pub capability_id: &'static str,
486    pub required_permission_ids: &'static [&'static str],
487}
488pub const LODESTONE_API_RUNTIME_CAPABILITY_AUTHORIZATION: &[RuntimeCapabilityAuthorizationContract] = &[
489    RuntimeCapabilityAuthorizationContract {
490        capability_id: "search_and_append_log",
491        required_permission_ids: &["data_read", "data_write"],
492    },
493    RuntimeCapabilityAuthorizationContract {
494        capability_id: "committed_vector_and_hybrid",
495        required_permission_ids: &["data_read"],
496    },
497    RuntimeCapabilityAuthorizationContract {
498        capability_id: "realtime_or_pit_vector",
499        required_permission_ids: &["data_read"],
500    },
501    RuntimeCapabilityAuthorizationContract {
502        capability_id: "state_standard_express_ephemeral",
503        required_permission_ids: &["data_read", "data_write"],
504    },
505    RuntimeCapabilityAuthorizationContract {
506        capability_id: "state_relaxed",
507        required_permission_ids: &[],
508    },
509    RuntimeCapabilityAuthorizationContract {
510        capability_id: "bounded_resp",
511        required_permission_ids: &["data_read", "data_write"],
512    },
513    RuntimeCapabilityAuthorizationContract {
514        capability_id: "lodestone_rust_client",
515        required_permission_ids: &[],
516    },
517    RuntimeCapabilityAuthorizationContract {
518        capability_id: "replayable_source_indexes",
519        required_permission_ids: &["index_admin"],
520    },
521    RuntimeCapabilityAuthorizationContract {
522        capability_id: "zero_copy_clones",
523        required_permission_ids: &["index_admin"],
524    },
525    RuntimeCapabilityAuthorizationContract {
526        capability_id: "retained_history",
527        required_permission_ids: &["data_read"],
528    },
529    RuntimeCapabilityAuthorizationContract {
530        capability_id: "generation_result_cache",
531        required_permission_ids: &["data_read"],
532    },
533    RuntimeCapabilityAuthorizationContract {
534        capability_id: "adaptive_field_promotion",
535        required_permission_ids: &["index_admin"],
536    },
537    RuntimeCapabilityAuthorizationContract {
538        capability_id: "durable_overload_buffering",
539        required_permission_ids: &["data_read", "data_write"],
540    },
541    RuntimeCapabilityAuthorizationContract {
542        capability_id: "current_table_reader",
543        required_permission_ids: &["data_read"],
544    },
545    RuntimeCapabilityAuthorizationContract {
546        capability_id: "crypto_shred_and_rollup_lifecycle",
547        required_permission_ids: &["lifecycle_admin"],
548    },
549];
550pub fn runtime_capability_authorization(
551    capability_id: &str,
552) -> Option<&'static RuntimeCapabilityAuthorizationContract> {
553    LODESTONE_API_RUNTIME_CAPABILITY_AUTHORIZATION
554        .iter()
555        .find(|contract| contract.capability_id == capability_id)
556}
557
558pub const LODESTONE_API_CURSOR_FORMAT_VERSION: u16 = 1;
559#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
560#[serde(deny_unknown_fields)]
561pub struct Cursor {
562    pub value: String,
563}
564
565pub const LODESTONE_API_LOCATOR_FORMAT_VERSION: u16 = 1;
566#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
567#[serde(deny_unknown_fields)]
568pub struct Locator {
569    pub authority: String,
570    pub value: String,
571}
572
573pub const LODESTONE_API_RESOURCE_FORMAT_VERSION: u16 = 1;
574#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
575#[serde(deny_unknown_fields)]
576pub struct Resource {
577    pub kind: String,
578    pub name: String,
579    pub incarnation: Identity,
580}
581
582pub const LODESTONE_API_FIELD_PROMOTION_CONFIGURATION_FORMAT_VERSION: u16 = 1;
583#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
584#[serde(deny_unknown_fields)]
585pub struct FieldPromotionConfiguration {
586    pub format_version: u32,
587    pub enabled: bool,
588    pub minimum_query_count: u32,
589    pub maximum_promoted_fields: u32,
590    pub maximum_cardinality: U64,
591    pub maximum_extra_bytes: U64,
592    pub allow_sensitive: bool,
593}
594
595pub const LODESTONE_API_OVERLOAD_CONFIGURATION_FORMAT_VERSION: u16 = 2;
596#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
597#[serde(deny_unknown_fields)]
598pub struct OverloadConfiguration {
599    pub format_version: u32,
600    pub mode: String,
601    pub maximum_backlog_bytes: U64,
602    pub maximum_backlog_age_millis: U64,
603    pub maximum_collection_share_bytes: U64,
604    pub maximum_recovery_ops_per_pass: u32,
605    pub maximum_pending_overlay_documents: U64,
606}
607
608pub const LODESTONE_API_INDEX_POLICIES_FORMAT_VERSION: u16 = 1;
609#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
610#[serde(deny_unknown_fields)]
611pub struct IndexPolicies {
612    pub durability: String,
613    pub storage: String,
614    pub cache: String,
615    #[serde(default, skip_serializing_if = "Option::is_none")]
616    pub default_visibility: Option<String>,
617    pub field_promotion: FieldPromotionConfiguration,
618    pub overload: OverloadConfiguration,
619}
620
621pub const LODESTONE_API_MAINTENANCE_BUDGETS_FORMAT_VERSION: u16 = 1;
622#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
623#[serde(deny_unknown_fields)]
624pub struct MaintenanceBudgets {
625    pub memtable_max_bytes: U64,
626    pub refresh_max_millis: U64,
627    pub seal_max_bytes: U64,
628    pub seal_max_millis: U64,
629    pub merge_max_bytes: U64,
630    pub delete_resolution_max_bytes: U64,
631    pub wal_retention_max_bytes: U64,
632    pub gc_max_keys: u32,
633    pub fsck_max_objects: u32,
634    pub deleted_tombstone_retention_millis: U64,
635}
636
637pub const LODESTONE_API_RESOURCE_DURABILITY_CLASS_FORMAT_VERSION: u16 = 1;
638#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
639#[serde(rename_all = "snake_case")]
640pub enum ResourceDurabilityClass {
641    RegionalObject,
642    ZonalLowLatency,
643    Relaxed,
644    Ephemeral,
645}
646
647pub const LODESTONE_API_RESOURCE_STORAGE_CLASS_FORMAT_VERSION: u16 = 1;
648#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
649#[serde(rename_all = "snake_case")]
650pub enum ResourceStorageClass {
651    Standard,
652    Cold,
653}
654
655pub const LODESTONE_API_WORKLOAD_CLASS_FORMAT_VERSION: u16 = 1;
656#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
657#[serde(rename_all = "snake_case")]
658pub enum WorkloadClass {
659    InteractiveSearch,
660    BatchAnalytics,
661    StreamingIngest,
662    BulkBackfill,
663    InternalMaintenance,
664}
665
666pub const LODESTONE_API_INDEX_RESOURCE_SPEC_FORMAT_VERSION: u16 = 1;
667#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
668#[serde(deny_unknown_fields)]
669pub struct IndexResourceSpec {
670    pub format_version: u32,
671    pub revision: U64,
672    pub initial_shards: u32,
673    pub target_shard_bytes: U64,
674    pub durability: ResourceDurabilityClass,
675    pub storage_class: ResourceStorageClass,
676    pub ram_admission_weight: u32,
677    pub ram_hard_max_bytes: U64,
678    pub nvme_admission_weight: u32,
679    pub nvme_hard_max_bytes: U64,
680    pub refresh_objective_millis: u32,
681    pub memtable_hard_max_bytes: U64,
682    pub seal_parallelism: u32,
683    pub merge_parallelism: u32,
684    #[serde(default, skip_serializing_if = "Option::is_none")]
685    pub lifecycle_binding: Option<Identity>,
686    pub encryption_required: bool,
687    #[serde(default, skip_serializing_if = "Option::is_none")]
688    pub resolver_capability: Option<Identity>,
689}
690
691pub const LODESTONE_API_INDEX_SUMMARY_FORMAT_VERSION: u16 = 1;
692#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
693#[serde(deny_unknown_fields)]
694pub struct IndexSummary {
695    pub name: String,
696    pub incarnation: Identity,
697    pub revision: U64,
698    pub mode: String,
699    pub retained_event_identity: bool,
700    pub state: String,
701    pub schema_generation: U64,
702    pub routing_revision: U64,
703    pub shard_count: u32,
704    pub policies: IndexPolicies,
705    pub management_mode: String,
706}
707
708pub const LODESTONE_API_MAPPING_MODE_FORMAT_VERSION: u16 = 1;
709#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
710#[serde(rename_all = "snake_case")]
711pub enum MappingMode {
712    Mutable,
713    AppendLog,
714    State,
715}
716
717pub const LODESTONE_API_DYNAMIC_MAPPING_POLICY_FORMAT_VERSION: u16 = 1;
718#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
719#[serde(rename_all = "snake_case")]
720pub enum DynamicMappingPolicy {
721    True,
722    False,
723    Strict,
724}
725
726pub const LODESTONE_API_MAPPING_ANALYZER_FORMAT_VERSION: u16 = 1;
727#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
728#[serde(rename_all = "snake_case")]
729pub enum MappingAnalyzer {
730    Keyword,
731    Simple,
732    Standard,
733    Whitespace,
734}
735
736pub const LODESTONE_API_KEYWORD_NORMALIZER_FORMAT_VERSION: u16 = 1;
737#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
738#[serde(rename_all = "snake_case")]
739pub enum KeywordNormalizer {
740    Keyword,
741    Lowercase,
742}
743
744pub const LODESTONE_API_VECTOR_METRIC_FORMAT_VERSION: u16 = 1;
745#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
746#[serde(rename_all = "snake_case")]
747pub enum VectorMetric {
748    Cosine,
749    DotProduct,
750    SquaredL2,
751}
752
753pub const LODESTONE_API_MAPPING_SCALAR_FORMAT_VERSION: u16 = 1;
754#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
755#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
756pub enum MappingScalar {
757    Boolean { value: bool },
758    I64 { value: I64 },
759    U64 { value: U64 },
760    F64Bits { value: U64 },
761    Keyword { value: String },
762}
763
764pub const LODESTONE_API_MAPPING_FIELD_TYPE_FORMAT_VERSION: u16 = 1;
765#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
766#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
767pub enum MappingFieldType {
768    Text,
769    Keyword,
770    U64,
771    Date,
772    I64,
773    F64,
774    Bool,
775    Nested,
776    Vector {
777        format_version: u32,
778        field_id: u32,
779        dimensions: u32,
780        metric: VectorMetric,
781    },
782}
783
784pub const LODESTONE_API_MAPPING_FIELD_FORMAT_VERSION: u16 = 1;
785#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
786#[serde(deny_unknown_fields)]
787pub struct MappingField {
788    pub path: String,
789    pub field_type: MappingFieldType,
790    pub stored: bool,
791    #[serde(default, skip_serializing_if = "Option::is_none")]
792    pub null_value: Option<MappingScalar>,
793}
794
795pub const LODESTONE_API_MULTI_FIELD_PROJECTION_FORMAT_VERSION: u16 = 1;
796#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
797#[serde(deny_unknown_fields)]
798pub struct MultiFieldProjection {
799    pub parent: String,
800    pub child: String,
801}
802
803pub const LODESTONE_API_ANALYZER_IDENTITY_FORMAT_VERSION: u16 = 1;
804#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
805#[serde(deny_unknown_fields)]
806pub struct AnalyzerIdentity {
807    pub field: String,
808    pub index_analyzer: MappingAnalyzer,
809    pub search_analyzer: MappingAnalyzer,
810}
811
812pub const LODESTONE_API_KEYWORD_LIMIT_FORMAT_VERSION: u16 = 1;
813#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
814#[serde(deny_unknown_fields)]
815pub struct KeywordLimit {
816    pub field: String,
817    pub max_bytes: u32,
818    pub normalizer: KeywordNormalizer,
819}
820
821pub const LODESTONE_API_MAPPING_FORMAT_VERSION: u16 = 1;
822#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
823#[serde(deny_unknown_fields)]
824pub struct Mapping {
825    pub format_version: u32,
826    pub generation: U64,
827    pub mode: MappingMode,
828    pub dynamic_policy: DynamicMappingPolicy,
829    pub fields: Vec<MappingField>,
830    pub multi_field_projections: Vec<MultiFieldProjection>,
831    pub analyzer_identities: Vec<AnalyzerIdentity>,
832    pub keyword_limits: Vec<KeywordLimit>,
833    pub nested_paths: Vec<String>,
834}
835
836pub const LODESTONE_API_INDEX_DETAIL_FORMAT_VERSION: u16 = 1;
837#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
838#[serde(deny_unknown_fields)]
839pub struct IndexDetail {
840    pub summary: IndexSummary,
841    pub current_mapping: Mapping,
842    pub budgets: MaintenanceBudgets,
843    pub resource_spec: IndexResourceSpec,
844    pub aliases: Vec<String>,
845    pub data_streams: Vec<String>,
846}
847
848pub const LODESTONE_API_SOURCE_PROVIDER_FORMAT_VERSION: u16 = 1;
849#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
850#[serde(rename_all = "snake_case")]
851pub enum SourceProvider {
852    Kafka,
853    ObjectLog,
854    HttpReplay,
855    GrpcReplay,
856}
857
858pub const LODESTONE_API_SOURCE_DECODER_FORMAT_VERSION: u16 = 1;
859#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
860#[serde(rename_all = "snake_case")]
861pub enum SourceDecoder {
862    LodestoneDocumentJson,
863    DebeziumPostgresJson,
864}
865
866pub const LODESTONE_API_SOURCE_REPLAY_GUARANTEES_FORMAT_VERSION: u16 = 1;
867#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
868#[serde(deny_unknown_fields)]
869pub struct SourceReplayGuarantees {
870    pub durable_replay: bool,
871    pub stable_partition_identity: bool,
872    pub stable_operation_identity: bool,
873    pub ordered_positions: bool,
874    pub bounded_reads: bool,
875    pub explicit_retention: bool,
876    pub explicit_rewind: bool,
877    pub minimum_replay_window_millis: U64,
878}
879
880pub const LODESTONE_API_SOURCE_PARTITION_CONFIGURATION_FORMAT_VERSION: u16 = 1;
881#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
882#[serde(deny_unknown_fields)]
883pub struct SourcePartitionConfiguration {
884    pub partition_id: u32,
885    pub partition_incarnation: U64,
886    pub initial_next_ordinal: U64,
887    pub initial_resume_token_base64: String,
888}
889
890pub const LODESTONE_API_REPLAYABLE_SOURCE_CONFIGURATION_FORMAT_VERSION: u16 = 1;
891#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
892#[serde(deny_unknown_fields)]
893pub struct ReplayableSourceConfiguration {
894    pub source_incarnation: U64,
895    pub source_identity_digest: Digest,
896    pub provider: SourceProvider,
897    pub decoder: SourceDecoder,
898    pub partitions: Vec<SourcePartitionConfiguration>,
899    pub guarantees: SourceReplayGuarantees,
900}
901
902pub const LODESTONE_API_SOURCE_PARTITION_STATUS_FORMAT_VERSION: u16 = 1;
903#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
904#[serde(deny_unknown_fields)]
905pub struct SourcePartitionStatus {
906    pub partition_id: u32,
907    pub partition_incarnation: U64,
908    pub indexed_next_ordinal: U64,
909    #[serde(default, skip_serializing_if = "Option::is_none")]
910    pub provider_high_watermark_next_ordinal: Option<U64>,
911    #[serde(default, skip_serializing_if = "Option::is_none")]
912    pub retention_floor_next_ordinal: Option<U64>,
913    #[serde(default, skip_serializing_if = "Option::is_none")]
914    pub lag_records: Option<U64>,
915}
916
917pub const LODESTONE_API_REPLAYABLE_SOURCE_STATUS_FORMAT_VERSION: u16 = 1;
918#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
919#[serde(deny_unknown_fields)]
920pub struct ReplayableSourceStatus {
921    pub index: Resource,
922    pub provider: SourceProvider,
923    pub decoder: SourceDecoder,
924    pub source_incarnation: U64,
925    pub source_identity_digest: Digest,
926    pub lifecycle: String,
927    pub lifecycle_generation: U64,
928    #[serde(default, skip_serializing_if = "Option::is_none")]
929    pub pause_reason: Option<String>,
930    #[serde(default, skip_serializing_if = "Option::is_none")]
931    pub rebuild_reason: Option<String>,
932    pub retry_state: String,
933    pub retention_risk: String,
934    #[serde(default, skip_serializing_if = "Option::is_none")]
935    pub last_batch_identity: Option<Identity>,
936    pub partitions: Vec<SourcePartitionStatus>,
937}
938
939pub const LODESTONE_API_SOURCE_CONTROL_TRANSITION_FORMAT_VERSION: u16 = 1;
940#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
941#[serde(rename_all = "snake_case")]
942pub enum SourceControlTransition {
943    Pause,
944    Resume,
945    RequireRebuild,
946}
947
948pub const LODESTONE_API_HISTORY_LEDGER_PRECONDITION_FORMAT_VERSION: u16 = 1;
949#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
950#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
951pub enum HistoryLedgerPrecondition {
952    Absent,
953    Exact { revision: U64 },
954}
955
956pub const LODESTONE_API_HISTORY_RETENTION_POLICY_FORMAT_VERSION: u16 = 1;
957#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
958#[serde(deny_unknown_fields)]
959pub struct HistoryRetentionPolicy {
960    pub keep_for_millis: U64,
961    pub capture_interval_millis: U64,
962    pub maximum_cuts: u32,
963    pub privacy_overlay_identity_limit: u32,
964}
965
966pub const LODESTONE_API_HISTORY_SELECTOR_FORMAT_VERSION: u16 = 1;
967#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
968#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
969pub enum HistorySelector {
970    ExactCut { cut_id: Identity },
971    AtOrBeforeCommitTime { unix_millis: U64 },
972}
973
974pub const LODESTONE_API_HISTORY_HOLD_FORMAT_VERSION: u16 = 1;
975#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
976#[serde(deny_unknown_fields)]
977pub struct HistoryHold {
978    pub hold_id: Identity,
979    pub cut_ids: Vec<Identity>,
980}
981
982pub const LODESTONE_API_HISTORY_STATUS_FORMAT_VERSION: u16 = 1;
983#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
984#[serde(deny_unknown_fields)]
985pub struct HistoryStatus {
986    pub index: Resource,
987    pub revision: U64,
988    pub policy: HistoryRetentionPolicy,
989    pub page_count: u32,
990    pub cut_count: u32,
991    pub holds: Vec<HistoryHold>,
992}
993
994pub const LODESTONE_API_HISTORY_RESOLUTION_FORMAT_VERSION: u16 = 1;
995#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
996#[serde(deny_unknown_fields)]
997pub struct HistoryResolution {
998    pub index: Resource,
999    pub selector: HistorySelector,
1000    pub cut_id: Identity,
1001    pub committed_at_unix_millis: U64,
1002    pub uncertainty_millis: U64,
1003    pub shard_count: u32,
1004    pub security_policy_revision: U64,
1005}
1006
1007pub const LODESTONE_API_INDEX_REFERENCE_FORMAT_VERSION: u16 = 1;
1008#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1009#[serde(deny_unknown_fields)]
1010pub struct IndexReference {
1011    pub name: String,
1012    pub incarnation: Identity,
1013}
1014
1015pub const LODESTONE_API_ALIAS_TARGET_FORMAT_VERSION: u16 = 1;
1016#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1017#[serde(deny_unknown_fields)]
1018pub struct AliasTarget {
1019    pub index: IndexReference,
1020    pub write_index: bool,
1021}
1022
1023pub const LODESTONE_API_ALIAS_SUMMARY_FORMAT_VERSION: u16 = 1;
1024#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1025#[serde(deny_unknown_fields)]
1026pub struct AliasSummary {
1027    pub name: String,
1028    pub revision: U64,
1029    pub visible_target_count: u32,
1030}
1031
1032pub const LODESTONE_API_ALIAS_DETAIL_FORMAT_VERSION: u16 = 1;
1033#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1034#[serde(deny_unknown_fields)]
1035pub struct AliasDetail {
1036    pub summary: AliasSummary,
1037    pub visible_targets: Vec<AliasTarget>,
1038    #[serde(default, skip_serializing_if = "Option::is_none")]
1039    pub filter: Option<RawJson>,
1040    #[serde(default, skip_serializing_if = "Option::is_none")]
1041    pub index_routing: Option<String>,
1042    #[serde(default, skip_serializing_if = "Option::is_none")]
1043    pub search_routing: Option<String>,
1044}
1045
1046pub const LODESTONE_API_DATA_STREAM_SUMMARY_FORMAT_VERSION: u16 = 1;
1047#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1048#[serde(deny_unknown_fields)]
1049pub struct DataStreamSummary {
1050    pub name: String,
1051    pub incarnation: Identity,
1052    pub revision: U64,
1053    pub generation: U64,
1054    pub state: String,
1055    pub visible_backing_count: u32,
1056}
1057
1058pub const LODESTONE_API_COMPONENT_TEMPLATE_BINDING_FORMAT_VERSION: u16 = 1;
1059#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1060#[serde(deny_unknown_fields)]
1061pub struct ComponentTemplateBinding {
1062    pub name: String,
1063    pub incarnation: Identity,
1064    pub revision: U64,
1065}
1066
1067pub const LODESTONE_API_INDEX_TEMPLATE_BINDING_FORMAT_VERSION: u16 = 1;
1068#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1069#[serde(deny_unknown_fields)]
1070pub struct IndexTemplateBinding {
1071    pub name: String,
1072    pub incarnation: Identity,
1073    pub revision: U64,
1074}
1075
1076pub const LODESTONE_API_LIFECYCLE_POLICY_BINDING_FORMAT_VERSION: u16 = 1;
1077#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1078#[serde(deny_unknown_fields)]
1079pub struct LifecyclePolicyBinding {
1080    pub name: String,
1081    pub incarnation: Identity,
1082    pub revision: U64,
1083}
1084
1085pub const LODESTONE_API_DATA_STREAM_DETAIL_FORMAT_VERSION: u16 = 1;
1086#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1087#[serde(deny_unknown_fields)]
1088pub struct DataStreamDetail {
1089    pub summary: DataStreamSummary,
1090    pub visible_backing_indices: Vec<IndexReference>,
1091    #[serde(default, skip_serializing_if = "Option::is_none")]
1092    pub write_index: Option<IndexReference>,
1093    pub timestamp_field: String,
1094    pub index_template: IndexTemplateBinding,
1095    #[serde(default, skip_serializing_if = "Option::is_none")]
1096    pub lifecycle_policy: Option<LifecyclePolicyBinding>,
1097}
1098
1099pub const LODESTONE_API_COMPONENT_TEMPLATE_SUMMARY_FORMAT_VERSION: u16 = 1;
1100#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1101#[serde(deny_unknown_fields)]
1102pub struct ComponentTemplateSummary {
1103    pub name: String,
1104    pub incarnation: Identity,
1105    pub revision: U64,
1106}
1107
1108pub const LODESTONE_API_COMPONENT_TEMPLATE_DETAIL_FORMAT_VERSION: u16 = 1;
1109#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1110#[serde(deny_unknown_fields)]
1111pub struct ComponentTemplateDetail {
1112    pub summary: ComponentTemplateSummary,
1113    pub mapping: Mapping,
1114    pub settings: RawJson,
1115    #[serde(default, skip_serializing_if = "Option::is_none")]
1116    pub resource_spec: Option<IndexResourceSpec>,
1117}
1118
1119pub const LODESTONE_API_INDEX_TEMPLATE_SUMMARY_FORMAT_VERSION: u16 = 1;
1120#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1121#[serde(deny_unknown_fields)]
1122pub struct IndexTemplateSummary {
1123    pub name: String,
1124    pub incarnation: Identity,
1125    pub revision: U64,
1126    pub priority: i32,
1127    pub data_stream: bool,
1128}
1129
1130pub const LODESTONE_API_INDEX_TEMPLATE_DETAIL_FORMAT_VERSION: u16 = 1;
1131#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1132#[serde(deny_unknown_fields)]
1133pub struct IndexTemplateDetail {
1134    pub summary: IndexTemplateSummary,
1135    pub index_patterns: Vec<String>,
1136    pub components: Vec<ComponentTemplateBinding>,
1137    pub mapping: Mapping,
1138    pub settings: RawJson,
1139    #[serde(default, skip_serializing_if = "Option::is_none")]
1140    pub resource_spec: Option<IndexResourceSpec>,
1141}
1142
1143pub const LODESTONE_API_INGEST_PIPELINE_SUMMARY_FORMAT_VERSION: u16 = 1;
1144#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1145#[serde(deny_unknown_fields)]
1146pub struct IngestPipelineSummary {
1147    pub name: String,
1148    pub incarnation: Identity,
1149    pub revision: U64,
1150    pub digest: Digest,
1151}
1152
1153pub const LODESTONE_API_INGEST_PIPELINE_DETAIL_FORMAT_VERSION: u16 = 1;
1154#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1155#[serde(deny_unknown_fields)]
1156pub struct IngestPipelineDetail {
1157    pub summary: IngestPipelineSummary,
1158    pub definition: RawJson,
1159}
1160
1161pub const LODESTONE_API_INGEST_PIPELINE_SELECTION_FORMAT_VERSION: u16 = 1;
1162#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1163#[serde(deny_unknown_fields)]
1164pub struct IngestPipelineSelection {
1165    pub name: String,
1166    pub expected: ExpectedBinding,
1167}
1168
1169pub const LODESTONE_API_LIFECYCLE_POLICY_SUMMARY_FORMAT_VERSION: u16 = 1;
1170#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1171#[serde(deny_unknown_fields)]
1172pub struct LifecyclePolicySummary {
1173    pub name: String,
1174    pub incarnation: Identity,
1175    pub revision: U64,
1176}
1177
1178pub const LODESTONE_API_ROLLOVER_THRESHOLDS_FORMAT_VERSION: u16 = 1;
1179#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1180#[serde(deny_unknown_fields)]
1181pub struct RolloverThresholds {
1182    #[serde(default, skip_serializing_if = "Option::is_none")]
1183    pub max_primary_docs: Option<U64>,
1184    #[serde(default, skip_serializing_if = "Option::is_none")]
1185    pub max_primary_bytes: Option<U64>,
1186    #[serde(default, skip_serializing_if = "Option::is_none")]
1187    pub max_age_millis: Option<U64>,
1188}
1189
1190pub const LODESTONE_API_RETENTION_POLICY_FORMAT_VERSION: u16 = 1;
1191#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1192#[serde(deny_unknown_fields)]
1193pub struct RetentionPolicy {
1194    #[serde(default, skip_serializing_if = "Option::is_none")]
1195    pub document_max_age_millis: Option<U64>,
1196    #[serde(default, skip_serializing_if = "Option::is_none")]
1197    pub backing_index_max_age_millis: Option<U64>,
1198}
1199
1200pub const LODESTONE_API_LIFECYCLE_POLICY_DETAIL_FORMAT_VERSION: u16 = 1;
1201#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1202#[serde(deny_unknown_fields)]
1203pub struct LifecyclePolicyDetail {
1204    pub summary: LifecyclePolicySummary,
1205    pub rollover: RolloverThresholds,
1206    pub retention: RetentionPolicy,
1207    pub merge_hint: bool,
1208    pub freeze_hint: bool,
1209    pub delete_expired: bool,
1210}
1211
1212pub const LODESTONE_API_TEXT_QUERY_OPERATOR_FORMAT_VERSION: u16 = 1;
1213#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1214#[serde(rename_all = "snake_case")]
1215pub enum TextQueryOperator {
1216    Or,
1217    And,
1218}
1219
1220pub const LODESTONE_API_TEXT_QUERY_ANALYZER_FORMAT_VERSION: u16 = 1;
1221#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1222#[serde(rename_all = "snake_case")]
1223pub enum TextQueryAnalyzer {
1224    Mapping,
1225    Standard,
1226    Simple,
1227    Whitespace,
1228    Keyword,
1229}
1230
1231pub const LODESTONE_API_ZERO_TERMS_QUERY_FORMAT_VERSION: u16 = 1;
1232#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1233#[serde(rename_all = "snake_case")]
1234pub enum ZeroTermsQuery {
1235    None,
1236    All,
1237}
1238
1239pub const LODESTONE_API_TEXT_QUERY_OPTIONS_FORMAT_VERSION: u16 = 1;
1240#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1241#[serde(deny_unknown_fields)]
1242pub struct TextQueryOptions {
1243    pub operator: TextQueryOperator,
1244    #[serde(default, skip_serializing_if = "Option::is_none")]
1245    pub minimum_should_match: Option<u32>,
1246    pub analyzer: TextQueryAnalyzer,
1247    pub zero_terms_query: ZeroTermsQuery,
1248}
1249
1250pub const LODESTONE_API_MULTI_MATCH_MODE_FORMAT_VERSION: u16 = 1;
1251#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1252#[serde(rename_all = "snake_case")]
1253pub enum MultiMatchMode {
1254    BestFields,
1255    MostFields,
1256    Phrase,
1257    PhrasePrefix,
1258    CrossFields,
1259}
1260
1261pub const LODESTONE_API_MULTI_MATCH_FIELD_FORMAT_VERSION: u16 = 1;
1262#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1263#[serde(deny_unknown_fields)]
1264pub struct MultiMatchField {
1265    pub field: String,
1266    pub boost: ApproximateNumber,
1267}
1268
1269pub const LODESTONE_API_MULTI_MATCH_OPTIONS_FORMAT_VERSION: u16 = 1;
1270#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1271#[serde(deny_unknown_fields)]
1272pub struct MultiMatchOptions {
1273    pub mode: MultiMatchMode,
1274    pub operator: TextQueryOperator,
1275    #[serde(default, skip_serializing_if = "Option::is_none")]
1276    pub minimum_should_match: Option<u32>,
1277    pub analyzer: TextQueryAnalyzer,
1278    pub zero_terms_query: ZeroTermsQuery,
1279    pub slop: u32,
1280}
1281
1282pub const LODESTONE_API_SORT_ORDER_FORMAT_VERSION: u16 = 1;
1283#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1284#[serde(rename_all = "snake_case")]
1285pub enum SortOrder {
1286    Asc,
1287    Desc,
1288}
1289
1290pub const LODESTONE_API_SORT_MODE_FORMAT_VERSION: u16 = 1;
1291#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1292#[serde(rename_all = "snake_case")]
1293pub enum SortMode {
1294    Auto,
1295    Min,
1296    Max,
1297}
1298
1299pub const LODESTONE_API_MISSING_ORDER_FORMAT_VERSION: u16 = 1;
1300#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1301#[serde(rename_all = "snake_case")]
1302pub enum MissingOrder {
1303    First,
1304    Last,
1305}
1306
1307pub const LODESTONE_API_NESTED_SCORE_MODE_FORMAT_VERSION: u16 = 1;
1308#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1309#[serde(rename_all = "snake_case")]
1310pub enum NestedScoreMode {
1311    Avg,
1312    Max,
1313    Min,
1314    None,
1315    Sum,
1316}
1317
1318pub const LODESTONE_API_NESTED_INNER_HITS_FORMAT_VERSION: u16 = 1;
1319#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1320#[serde(deny_unknown_fields)]
1321pub struct NestedInnerHits {
1322    #[serde(default, skip_serializing_if = "Option::is_none")]
1323    pub name: Option<String>,
1324    pub from: u32,
1325    pub size: u32,
1326    pub sort: Vec<SortSpec>,
1327}
1328
1329pub const LODESTONE_API_SORT_SPEC_FORMAT_VERSION: u16 = 1;
1330#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1331#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
1332pub enum SortSpec {
1333    Score {
1334        order: SortOrder,
1335    },
1336    Field {
1337        field: String,
1338        order: SortOrder,
1339        #[serde(default, skip_serializing_if = "Option::is_none")]
1340        missing: Option<MissingOrder>,
1341        mode: SortMode,
1342    },
1343    NestedField {
1344        path: String,
1345        field: String,
1346        #[serde(default, skip_serializing_if = "Option::is_none")]
1347        filter: Option<Box<Query>>,
1348        order: SortOrder,
1349        #[serde(default, skip_serializing_if = "Option::is_none")]
1350        missing: Option<MissingOrder>,
1351        mode: SortMode,
1352    },
1353}
1354
1355pub const LODESTONE_API_QUERY_FORMAT_VERSION: u16 = 1;
1356#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1357#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
1358pub enum Query {
1359    MatchAll,
1360    Term {
1361        field: String,
1362        value: JsonValue,
1363    },
1364    Terms {
1365        field: String,
1366        values: Vec<JsonValue>,
1367    },
1368    Range {
1369        field: String,
1370        #[serde(default, skip_serializing_if = "Option::is_none")]
1371        lower: Option<JsonValue>,
1372        #[serde(default, skip_serializing_if = "Option::is_none")]
1373        upper: Option<JsonValue>,
1374        include_lower: bool,
1375        include_upper: bool,
1376    },
1377    Text {
1378        field: String,
1379        text: String,
1380        #[serde(default, skip_serializing_if = "Option::is_none")]
1381        options: Option<TextQueryOptions>,
1382    },
1383    MultiMatch {
1384        fields: Vec<MultiMatchField>,
1385        text: String,
1386        #[serde(default, skip_serializing_if = "Option::is_none")]
1387        options: Option<MultiMatchOptions>,
1388    },
1389    Exists {
1390        field: String,
1391    },
1392    Prefix {
1393        field: String,
1394        prefix: String,
1395        #[serde(default, skip_serializing_if = "Option::is_none")]
1396        analyzer: Option<TextQueryAnalyzer>,
1397        analyze_wildcard: bool,
1398    },
1399    Fuzzy {
1400        field: String,
1401        value: String,
1402        distance: u32,
1403        #[serde(default, skip_serializing_if = "Option::is_none")]
1404        analyzer: Option<TextQueryAnalyzer>,
1405    },
1406    Boost {
1407        query: Box<Query>,
1408        boost: ApproximateNumber,
1409    },
1410    Bool {
1411        must: Vec<Query>,
1412        filter: Vec<Query>,
1413        should: Vec<Query>,
1414        must_not: Vec<Query>,
1415        minimum_should_match: u32,
1416    },
1417    Nested {
1418        path: String,
1419        query: Box<Query>,
1420        score_mode: NestedScoreMode,
1421        ignore_unmapped: bool,
1422        #[serde(default, skip_serializing_if = "Option::is_none")]
1423        inner_hits: Option<NestedInnerHits>,
1424    },
1425    Vector {
1426        field: String,
1427        query_vector: Vec<ApproximateNumber>,
1428        k: u32,
1429        #[serde(default, skip_serializing_if = "Option::is_none")]
1430        num_candidates: Option<u32>,
1431        #[serde(default, skip_serializing_if = "Option::is_none")]
1432        filter: Option<Box<Query>>,
1433    },
1434    HybridRrf {
1435        lexical: Box<Query>,
1436        field: String,
1437        query_vector: Vec<ApproximateNumber>,
1438        k: u32,
1439        #[serde(default, skip_serializing_if = "Option::is_none")]
1440        num_candidates: Option<u32>,
1441        #[serde(default, skip_serializing_if = "Option::is_none")]
1442        filter: Option<Box<Query>>,
1443        rank_constant: u32,
1444        lexical_window: u32,
1445        vector_window: u32,
1446    },
1447}
1448
1449pub const LODESTONE_API_HISTOGRAM_BOUNDS_FORMAT_VERSION: u16 = 1;
1450#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1451#[serde(deny_unknown_fields)]
1452pub struct HistogramBounds {
1453    #[serde(default, skip_serializing_if = "Option::is_none")]
1454    pub min: Option<ApproximateNumber>,
1455    #[serde(default, skip_serializing_if = "Option::is_none")]
1456    pub max: Option<ApproximateNumber>,
1457}
1458
1459pub const LODESTONE_API_DATE_HISTOGRAM_BOUNDS_FORMAT_VERSION: u16 = 1;
1460#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1461#[serde(deny_unknown_fields)]
1462pub struct DateHistogramBounds {
1463    #[serde(default, skip_serializing_if = "Option::is_none")]
1464    pub min: Option<I64>,
1465    #[serde(default, skip_serializing_if = "Option::is_none")]
1466    pub max: Option<I64>,
1467}
1468
1469pub const LODESTONE_API_APPROXIMATION_ALGORITHM_FORMAT_VERSION: u16 = 1;
1470#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1471#[serde(rename_all = "snake_case")]
1472pub enum ApproximationAlgorithm {
1473    HyperloglogV1,
1474    FloatPrefixHistogramV1,
1475}
1476
1477pub const LODESTONE_API_APPROXIMATION_FORMAT_VERSION: u16 = 1;
1478#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1479#[serde(deny_unknown_fields)]
1480pub struct Approximation {
1481    pub algorithm: ApproximationAlgorithm,
1482    pub algorithm_version: u32,
1483    pub precision: u32,
1484    pub state_bytes: U64,
1485    #[serde(default, skip_serializing_if = "Option::is_none")]
1486    pub relative_standard_error: Option<ApproximateNumber>,
1487    #[serde(default, skip_serializing_if = "Option::is_none")]
1488    pub maximum_rank_error: Option<ApproximateNumber>,
1489}
1490
1491pub const LODESTONE_API_PERCENTILE_VALUE_FORMAT_VERSION: u16 = 1;
1492#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1493#[serde(deny_unknown_fields)]
1494pub struct PercentileValue {
1495    pub percent: ApproximateNumber,
1496    #[serde(default, skip_serializing_if = "Option::is_none")]
1497    pub value: Option<ApproximateNumber>,
1498}
1499
1500pub const LODESTONE_API_APPROXIMATE_PERCENTILE_VALUE_FORMAT_VERSION: u16 = 1;
1501#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1502#[serde(deny_unknown_fields)]
1503pub struct ApproximatePercentileValue {
1504    pub percent: ApproximateNumber,
1505    pub value: ApproximateNumber,
1506    pub lower_bound: ApproximateNumber,
1507    pub upper_bound: ApproximateNumber,
1508    pub maximum_rank_error: ApproximateNumber,
1509}
1510
1511pub const LODESTONE_API_AGGREGATION_FORMAT_VERSION: u16 = 1;
1512#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1513#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
1514pub enum Aggregation {
1515    Terms {
1516        name: String,
1517        field: String,
1518        size: u32,
1519        sub_aggregations: Vec<Aggregation>,
1520    },
1521    Histogram {
1522        name: String,
1523        field: String,
1524        interval: ApproximateNumber,
1525        min_doc_count: U64,
1526        #[serde(default, skip_serializing_if = "Option::is_none")]
1527        extended_bounds: Option<HistogramBounds>,
1528        #[serde(default, skip_serializing_if = "Option::is_none")]
1529        hard_bounds: Option<HistogramBounds>,
1530        offset: ApproximateNumber,
1531        #[serde(default, skip_serializing_if = "Option::is_none")]
1532        missing: Option<ApproximateNumber>,
1533        sub_aggregations: Vec<Aggregation>,
1534    },
1535    Cardinality {
1536        name: String,
1537        field: String,
1538    },
1539    Percentiles {
1540        name: String,
1541        field: String,
1542        percents: Vec<ApproximateNumber>,
1543    },
1544    ApproximateCardinality {
1545        name: String,
1546        field: String,
1547        precision: u32,
1548    },
1549    ApproximatePercentiles {
1550        name: String,
1551        field: String,
1552        percents: Vec<ApproximateNumber>,
1553        precision: u32,
1554    },
1555    Sum {
1556        name: String,
1557        field: String,
1558    },
1559    Avg {
1560        name: String,
1561        field: String,
1562    },
1563    Min {
1564        name: String,
1565        field: String,
1566    },
1567    Max {
1568        name: String,
1569        field: String,
1570    },
1571    Stats {
1572        name: String,
1573        field: String,
1574    },
1575    DateHistogram {
1576        name: String,
1577        field: String,
1578        #[serde(default, skip_serializing_if = "Option::is_none")]
1579        fixed_interval_millis: Option<U64>,
1580        #[serde(default, skip_serializing_if = "Option::is_none")]
1581        calendar_interval: Option<String>,
1582        #[serde(default, skip_serializing_if = "Option::is_none")]
1583        time_zone: Option<String>,
1584        min_doc_count: U64,
1585        #[serde(default, skip_serializing_if = "Option::is_none")]
1586        extended_bounds: Option<DateHistogramBounds>,
1587        #[serde(default, skip_serializing_if = "Option::is_none")]
1588        hard_bounds: Option<DateHistogramBounds>,
1589        offset_millis: I64,
1590        #[serde(default, skip_serializing_if = "Option::is_none")]
1591        missing: Option<I64>,
1592        sub_aggregations: Vec<Aggregation>,
1593    },
1594    Composite {
1595        name: String,
1596        size: u32,
1597        sources: Vec<String>,
1598        #[serde(default, skip_serializing_if = "Option::is_none")]
1599        after: Option<Cursor>,
1600        sub_aggregations: Vec<Aggregation>,
1601    },
1602    Filter {
1603        name: String,
1604        query: Box<Query>,
1605        sub_aggregations: Vec<Aggregation>,
1606    },
1607    Nested {
1608        name: String,
1609        path: String,
1610        sub_aggregations: Vec<Aggregation>,
1611    },
1612    ReverseNested {
1613        name: String,
1614        #[serde(default, skip_serializing_if = "Option::is_none")]
1615        path: Option<String>,
1616        sub_aggregations: Vec<Aggregation>,
1617    },
1618}
1619
1620pub const LODESTONE_API_NESTED_SEARCH_HIT_FORMAT_VERSION: u16 = 1;
1621#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1622#[serde(deny_unknown_fields)]
1623pub struct NestedSearchHit {
1624    pub path: String,
1625    pub ordinal: u32,
1626    #[serde(default, skip_serializing_if = "Option::is_none")]
1627    pub score: Option<ApproximateNumber>,
1628    pub source: RawJson,
1629    pub sort: Vec<JsonValue>,
1630}
1631
1632pub const LODESTONE_API_NAMED_NESTED_INNER_HITS_RESULT_FORMAT_VERSION: u16 = 1;
1633#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1634#[serde(deny_unknown_fields)]
1635pub struct NamedNestedInnerHitsResult {
1636    pub name: String,
1637    pub total: U64,
1638    pub hits: Vec<NestedSearchHit>,
1639}
1640
1641pub const LODESTONE_API_SEARCH_HIT_FORMAT_VERSION: u16 = 1;
1642#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1643#[serde(deny_unknown_fields)]
1644pub struct SearchHit {
1645    pub index: Resource,
1646    pub document_id: String,
1647    #[serde(default, skip_serializing_if = "Option::is_none")]
1648    pub score: Option<ApproximateNumber>,
1649    #[serde(default, skip_serializing_if = "Option::is_none")]
1650    pub source: Option<RawJson>,
1651    pub sort: Vec<JsonValue>,
1652    pub inner_hits: Vec<NamedNestedInnerHitsResult>,
1653}
1654
1655pub const LODESTONE_API_AGGREGATION_BUCKET_FORMAT_VERSION: u16 = 1;
1656#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1657#[serde(deny_unknown_fields)]
1658pub struct AggregationBucket {
1659    pub key: JsonValue,
1660    pub document_count: U64,
1661    pub sub_aggregations: Vec<AggregationResult>,
1662}
1663
1664pub const LODESTONE_API_AGGREGATION_RESULT_FORMAT_VERSION: u16 = 1;
1665#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1666#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
1667pub enum AggregationResult {
1668    Terms {
1669        name: String,
1670        buckets: Vec<AggregationBucket>,
1671        partial: bool,
1672    },
1673    Histogram {
1674        name: String,
1675        buckets: Vec<AggregationBucket>,
1676        partial: bool,
1677    },
1678    DateHistogram {
1679        name: String,
1680        buckets: Vec<AggregationBucket>,
1681        partial: bool,
1682    },
1683    Composite {
1684        name: String,
1685        buckets: Vec<AggregationBucket>,
1686        partial: bool,
1687    },
1688    Filter {
1689        name: String,
1690        buckets: Vec<AggregationBucket>,
1691        partial: bool,
1692    },
1693    SingleBucket {
1694        name: String,
1695        document_count: U64,
1696        sub_aggregations: Vec<AggregationResult>,
1697        partial: bool,
1698    },
1699    Cardinality {
1700        name: String,
1701        #[serde(default, skip_serializing_if = "Option::is_none")]
1702        value: Option<ApproximateNumber>,
1703        partial: bool,
1704    },
1705    Percentiles {
1706        name: String,
1707        values: Vec<PercentileValue>,
1708        partial: bool,
1709    },
1710    ApproximateCardinality {
1711        name: String,
1712        value: ApproximateNumber,
1713        approximation: Approximation,
1714        partial: bool,
1715    },
1716    ApproximatePercentiles {
1717        name: String,
1718        values: Vec<ApproximatePercentileValue>,
1719        approximation: Approximation,
1720        partial: bool,
1721    },
1722    Sum {
1723        name: String,
1724        #[serde(default, skip_serializing_if = "Option::is_none")]
1725        value: Option<ApproximateNumber>,
1726        partial: bool,
1727    },
1728    Avg {
1729        name: String,
1730        #[serde(default, skip_serializing_if = "Option::is_none")]
1731        value: Option<ApproximateNumber>,
1732        partial: bool,
1733    },
1734    Min {
1735        name: String,
1736        #[serde(default, skip_serializing_if = "Option::is_none")]
1737        value: Option<ApproximateNumber>,
1738        partial: bool,
1739    },
1740    Max {
1741        name: String,
1742        #[serde(default, skip_serializing_if = "Option::is_none")]
1743        value: Option<ApproximateNumber>,
1744        partial: bool,
1745    },
1746    Stats {
1747        name: String,
1748        count: U64,
1749        #[serde(default, skip_serializing_if = "Option::is_none")]
1750        min: Option<ApproximateNumber>,
1751        #[serde(default, skip_serializing_if = "Option::is_none")]
1752        max: Option<ApproximateNumber>,
1753        #[serde(default, skip_serializing_if = "Option::is_none")]
1754        avg: Option<ApproximateNumber>,
1755        sum: ApproximateNumber,
1756        partial: bool,
1757    },
1758}
1759
1760pub const LODESTONE_API_SHARD_COUNTS_FORMAT_VERSION: u16 = 1;
1761#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1762#[serde(deny_unknown_fields)]
1763pub struct ShardCounts {
1764    pub total: u32,
1765    pub successful: u32,
1766    pub skipped: u32,
1767    pub failed: u32,
1768}
1769
1770pub const LODESTONE_API_TOTAL_HITS_RELATION_FORMAT_VERSION: u16 = 1;
1771#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1772#[serde(rename_all = "snake_case")]
1773pub enum TotalHitsRelation {
1774    Exact,
1775    LowerBound,
1776    Incomplete,
1777}
1778
1779pub const LODESTONE_API_SEARCH_TOTAL_FORMAT_VERSION: u16 = 1;
1780#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1781#[serde(deny_unknown_fields)]
1782pub struct SearchTotal {
1783    pub value: U64,
1784    pub relation: TotalHitsRelation,
1785    pub partial: bool,
1786}
1787
1788pub const LODESTONE_API_ARTIFACT_FORMAT_VERSION: u16 = 1;
1789#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1790#[serde(deny_unknown_fields)]
1791pub struct Artifact {
1792    pub locator: Locator,
1793    pub bytes: U64,
1794    pub sha256: Digest,
1795    pub expires_at: U64,
1796}
1797
1798pub const LODESTONE_API_OPERATION_FORMAT_VERSION: u16 = 1;
1799#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1800#[serde(deny_unknown_fields)]
1801pub struct Operation {
1802    pub locator: Locator,
1803    pub authority: String,
1804    pub state: String,
1805    #[serde(default, skip_serializing_if = "Option::is_none")]
1806    pub progress: Option<ExactDecimal>,
1807    pub cancellable: bool,
1808    pub submitted_at: U64,
1809    #[serde(default, skip_serializing_if = "Option::is_none")]
1810    pub terminal_at: Option<U64>,
1811    #[serde(default, skip_serializing_if = "Option::is_none")]
1812    pub retire_after: Option<U64>,
1813    pub artifacts: Vec<Artifact>,
1814}
1815
1816pub const LODESTONE_API_SUBMISSION_STATE_FORMAT_VERSION: u16 = 1;
1817#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
1818#[serde(rename_all = "snake_case")]
1819pub enum SubmissionState {
1820    NotSubmitted,
1821    Submitted,
1822    Resolved,
1823    KnownRetired,
1824    Indeterminate,
1825}
1826
1827pub const LODESTONE_API_EXPECTED_BINDING_FORMAT_VERSION: u16 = 1;
1828#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1829#[serde(deny_unknown_fields)]
1830pub struct ExpectedBinding {
1831    pub incarnation: Identity,
1832    pub revision: U64,
1833}
1834
1835pub const LODESTONE_API_ADMINISTRATION_ALIAS_ACTION_FORMAT_VERSION: u16 = 1;
1836#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1837#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
1838pub enum AdministrationAliasAction {
1839    Put {
1840        name: String,
1841        #[serde(default, skip_serializing_if = "Option::is_none")]
1842        expected_revision: Option<U64>,
1843        targets: Vec<AliasTarget>,
1844        #[serde(default, skip_serializing_if = "Option::is_none")]
1845        filter: Option<RawJson>,
1846        #[serde(default, skip_serializing_if = "Option::is_none")]
1847        index_routing: Option<String>,
1848        #[serde(default, skip_serializing_if = "Option::is_none")]
1849        search_routing: Option<String>,
1850    },
1851    Delete {
1852        name: String,
1853        expected_revision: U64,
1854    },
1855}
1856
1857pub const LODESTONE_API_ADMINISTRATION_MUTATION_FORMAT_VERSION: u16 = 1;
1858#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1859#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
1860pub enum AdministrationMutation {
1861    ApplyAliasActions {
1862        actions: Vec<AdministrationAliasAction>,
1863    },
1864    PutComponentTemplate {
1865        name: String,
1866        #[serde(default, skip_serializing_if = "Option::is_none")]
1867        expected: Option<ExpectedBinding>,
1868        mapping: Mapping,
1869        settings: RawJson,
1870        #[serde(default, skip_serializing_if = "Option::is_none")]
1871        resource_spec: Option<IndexResourceSpec>,
1872    },
1873    DeleteComponentTemplate {
1874        name: String,
1875        expected: ExpectedBinding,
1876    },
1877    PutIndexTemplate {
1878        name: String,
1879        #[serde(default, skip_serializing_if = "Option::is_none")]
1880        expected: Option<ExpectedBinding>,
1881        priority: i32,
1882        data_stream: bool,
1883        index_patterns: Vec<String>,
1884        components: Vec<ExpectedBinding>,
1885        mapping: Mapping,
1886        settings: RawJson,
1887        #[serde(default, skip_serializing_if = "Option::is_none")]
1888        resource_spec: Option<IndexResourceSpec>,
1889    },
1890    DeleteIndexTemplate {
1891        name: String,
1892        expected: ExpectedBinding,
1893    },
1894    PutIngestPipeline {
1895        name: String,
1896        #[serde(default, skip_serializing_if = "Option::is_none")]
1897        expected: Option<ExpectedBinding>,
1898        definition: RawJson,
1899    },
1900    DeleteIngestPipeline {
1901        name: String,
1902        expected: ExpectedBinding,
1903    },
1904    PutLifecyclePolicy {
1905        name: String,
1906        #[serde(default, skip_serializing_if = "Option::is_none")]
1907        expected: Option<ExpectedBinding>,
1908        rollover: RolloverThresholds,
1909        retention: RetentionPolicy,
1910        merge_hint: bool,
1911        freeze_hint: bool,
1912        delete_expired: bool,
1913    },
1914    DeleteLifecyclePolicy {
1915        name: String,
1916        expected: ExpectedBinding,
1917    },
1918    CreateDataStream {
1919        name: String,
1920        timestamp_field: String,
1921        index_template: ExpectedBinding,
1922        #[serde(default, skip_serializing_if = "Option::is_none")]
1923        lifecycle_policy: Option<ExpectedBinding>,
1924    },
1925    DeleteDataStream {
1926        name: String,
1927        expected_revision: U64,
1928    },
1929    RolloverDataStream {
1930        name: String,
1931        expected_revision: U64,
1932    },
1933}
1934
1935pub const LODESTONE_API_ADMINISTRATION_OUTCOME_FORMAT_VERSION: u16 = 1;
1936#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1937#[serde(deny_unknown_fields)]
1938pub struct AdministrationOutcome {
1939    pub action_id: Digest,
1940    pub authority_revision: U64,
1941    pub state: String,
1942    #[serde(default, skip_serializing_if = "Option::is_none")]
1943    pub resource: Option<Resource>,
1944}
1945
1946pub const LODESTONE_API_INDEX_CHANGE_APPLY_RECEIPT_FORMAT_VERSION: u16 = 1;
1947#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1948#[serde(deny_unknown_fields)]
1949pub struct IndexChangeApplyReceipt {
1950    pub action_id: Digest,
1951    pub semantic_digest: Digest,
1952    pub index: Resource,
1953    pub revision: U64,
1954    pub schema_generation: U64,
1955    pub state: String,
1956}
1957
1958pub const LODESTONE_API_BACKUP_ENCRYPTION_POLICY_FORMAT_VERSION: u16 = 1;
1959#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1960#[serde(deny_unknown_fields)]
1961pub struct BackupEncryptionPolicy {
1962    pub backend_authority: String,
1963    pub policy_id: String,
1964    pub key_digest: Digest,
1965    pub encrypted: bool,
1966}
1967
1968pub const LODESTONE_API_BACKUP_CREATE_OUTCOME_FORMAT_VERSION: u16 = 1;
1969#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1970#[serde(deny_unknown_fields)]
1971pub struct BackupCreateOutcome {
1972    pub action_id: Digest,
1973    pub backup_id: Identity,
1974    pub operation: Operation,
1975    pub submitted: bool,
1976}
1977
1978pub const LODESTONE_API_BULK_DOCUMENT_ITEM_FORMAT_VERSION: u16 = 1;
1979#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1980#[serde(deny_unknown_fields)]
1981pub struct BulkDocumentItem {
1982    pub item_action_id: Digest,
1983    pub document_id: String,
1984    pub operation: String,
1985    #[serde(default, skip_serializing_if = "Option::is_none")]
1986    pub source: Option<RawJson>,
1987    #[serde(default, skip_serializing_if = "Option::is_none")]
1988    pub routing: Option<String>,
1989    #[serde(default, skip_serializing_if = "Option::is_none")]
1990    pub condition: Option<DocumentMutationCondition>,
1991    #[serde(default, skip_serializing_if = "Option::is_none")]
1992    pub pipeline: Option<IngestPipelineSelection>,
1993    pub semantic_digest: Digest,
1994}
1995
1996pub const LODESTONE_API_BULK_DOCUMENT_ITEM_OUTCOME_FORMAT_VERSION: u16 = 1;
1997#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
1998#[serde(deny_unknown_fields)]
1999pub struct BulkDocumentItemOutcome {
2000    pub item_action_id: Digest,
2001    #[serde(default, skip_serializing_if = "Option::is_none")]
2002    pub locator: Option<Locator>,
2003    pub state: SubmissionState,
2004    #[serde(default, skip_serializing_if = "Option::is_none")]
2005    pub sequence: Option<U64>,
2006    #[serde(default, skip_serializing_if = "Option::is_none")]
2007    pub mapping_generation: Option<U64>,
2008    pub mapping_adopted: bool,
2009    pub no_document_effect: bool,
2010    #[serde(default, skip_serializing_if = "Option::is_none")]
2011    pub error: Option<ErrorBody>,
2012}
2013
2014pub const LODESTONE_API_BULK_DOCUMENT_OUTCOME_FORMAT_VERSION: u16 = 1;
2015#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2016#[serde(deny_unknown_fields)]
2017pub struct BulkDocumentOutcome {
2018    pub batch_id: Digest,
2019    pub index: Resource,
2020    pub items: Vec<BulkDocumentItemOutcome>,
2021    pub complete: bool,
2022}
2023
2024pub const LODESTONE_API_RETAINED_APPEND_ITEM_FORMAT_VERSION: u16 = 1;
2025#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2026#[serde(deny_unknown_fields)]
2027pub struct RetainedAppendItem {
2028    pub item_action_id: Digest,
2029    pub document_id: String,
2030    pub source: RawJson,
2031}
2032
2033pub const LODESTONE_API_RETAINED_APPEND_STATE_FORMAT_VERSION: u16 = 1;
2034#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2035#[serde(rename_all = "snake_case")]
2036pub enum RetainedAppendState {
2037    Prepared,
2038    Committed,
2039    Replayed,
2040    Conflict,
2041    NotSubmittedRetryable,
2042    NotSubmittedTerminal,
2043    SubmittedIndeterminate,
2044    Retired,
2045}
2046
2047pub const LODESTONE_API_RETAINED_APPEND_RETRY_SAFETY_FORMAT_VERSION: u16 = 1;
2048#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2049#[serde(rename_all = "snake_case")]
2050pub enum RetainedAppendRetrySafety {
2051    Safe,
2052    ResolveOnly,
2053    Terminal,
2054}
2055
2056pub const LODESTONE_API_RETAINED_APPEND_ITEM_OUTCOME_FORMAT_VERSION: u16 = 1;
2057#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2058#[serde(deny_unknown_fields)]
2059pub struct RetainedAppendItemOutcome {
2060    pub item_action_id: Digest,
2061    #[serde(default, skip_serializing_if = "Option::is_none")]
2062    pub locator: Option<Locator>,
2063    #[serde(default, skip_serializing_if = "Option::is_none")]
2064    pub semantic_digest: Option<Digest>,
2065    pub state: RetainedAppendState,
2066    pub retry_safety: RetainedAppendRetrySafety,
2067    #[serde(default, skip_serializing_if = "Option::is_none")]
2068    pub sequence: Option<U64>,
2069    #[serde(default, skip_serializing_if = "Option::is_none")]
2070    pub primary_term: Option<U64>,
2071    #[serde(default, skip_serializing_if = "Option::is_none")]
2072    pub error: Option<ErrorBody>,
2073}
2074
2075pub const LODESTONE_API_RETAINED_APPEND_BULK_OUTCOME_FORMAT_VERSION: u16 = 1;
2076#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2077#[serde(deny_unknown_fields)]
2078pub struct RetainedAppendBulkOutcome {
2079    pub batch_id: Digest,
2080    pub index: Resource,
2081    pub items: Vec<RetainedAppendItemOutcome>,
2082    pub complete: bool,
2083}
2084
2085pub const LODESTONE_API_RETAINED_APPEND_OBSERVATION_STATE_FORMAT_VERSION: u16 = 1;
2086#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2087#[serde(rename_all = "snake_case")]
2088pub enum RetainedAppendObservationState {
2089    Visible,
2090    Pending,
2091    SubmittedIndeterminate,
2092    Conflict,
2093    Retired,
2094}
2095
2096pub const LODESTONE_API_RETAINED_APPEND_OBSERVATION_OUTCOME_FORMAT_VERSION: u16 = 1;
2097#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2098#[serde(deny_unknown_fields)]
2099pub struct RetainedAppendObservationOutcome {
2100    pub index: Resource,
2101    pub locator: Locator,
2102    pub state: RetainedAppendObservationState,
2103    #[serde(default, skip_serializing_if = "Option::is_none")]
2104    pub sequence: Option<U64>,
2105    #[serde(default, skip_serializing_if = "Option::is_none")]
2106    pub primary_term: Option<U64>,
2107}
2108
2109pub const LODESTONE_API_BINARY_VALUE_FORMAT_VERSION: u16 = 1;
2110#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2111#[serde(deny_unknown_fields)]
2112pub struct BinaryValue {
2113    pub bytes_base64: String,
2114}
2115
2116pub const LODESTONE_API_STATE_HASH_FIELD_FORMAT_VERSION: u16 = 1;
2117#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2118#[serde(deny_unknown_fields)]
2119pub struct StateHashField {
2120    pub field: BinaryValue,
2121    pub value: BinaryValue,
2122}
2123
2124pub const LODESTONE_API_STATE_SET_ENTRY_FORMAT_VERSION: u16 = 1;
2125#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2126#[serde(deny_unknown_fields)]
2127pub struct StateSetEntry {
2128    pub key: BinaryValue,
2129    pub value: BinaryValue,
2130}
2131
2132pub const LODESTONE_API_STATE_SET_CONDITION_FORMAT_VERSION: u16 = 1;
2133#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2134#[serde(rename_all = "snake_case")]
2135pub enum StateSetCondition {
2136    Always,
2137    IfAbsent,
2138    IfPresent,
2139}
2140
2141pub const LODESTONE_API_STATE_OPERATION_FORMAT_VERSION: u16 = 1;
2142#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2143#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2144pub enum StateOperation {
2145    Get {
2146        key: BinaryValue,
2147    },
2148    Set {
2149        key: BinaryValue,
2150        value: BinaryValue,
2151        condition: StateSetCondition,
2152        #[serde(default, skip_serializing_if = "Option::is_none")]
2153        expires_at_millis: Option<U64>,
2154    },
2155    Delete {
2156        keys: Vec<BinaryValue>,
2157    },
2158    Exists {
2159        keys: Vec<BinaryValue>,
2160    },
2161    ExpireAt {
2162        key: BinaryValue,
2163        absolute_millis: U64,
2164    },
2165    TtlStatus {
2166        key: BinaryValue,
2167    },
2168    Persist {
2169        key: BinaryValue,
2170    },
2171    MultiGet {
2172        keys: Vec<BinaryValue>,
2173    },
2174    MultiSet {
2175        entries: Vec<StateSetEntry>,
2176    },
2177    Increment {
2178        key: BinaryValue,
2179        delta: I64,
2180    },
2181    HashGet {
2182        key: BinaryValue,
2183        field: BinaryValue,
2184    },
2185    HashSet {
2186        key: BinaryValue,
2187        fields: Vec<StateHashField>,
2188    },
2189    HashGetAll {
2190        key: BinaryValue,
2191    },
2192}
2193
2194pub const LODESTONE_API_STATE_OPTIONAL_VALUE_FORMAT_VERSION: u16 = 1;
2195#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2196#[serde(tag = "state", rename_all = "snake_case", deny_unknown_fields)]
2197pub enum StateOptionalValue {
2198    Missing,
2199    Value { value: BinaryValue },
2200}
2201
2202pub const LODESTONE_API_STATE_COMMAND_RESULT_FORMAT_VERSION: u16 = 1;
2203#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2204#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2205pub enum StateCommandResult {
2206    Get {
2207        value: StateOptionalValue,
2208    },
2209    Set {
2210        applied: bool,
2211    },
2212    Delete {
2213        removed: u32,
2214    },
2215    Exists {
2216        count: u32,
2217    },
2218    Expire {
2219        changed: bool,
2220    },
2221    TtlStatus {
2222        state: String,
2223        #[serde(default, skip_serializing_if = "Option::is_none")]
2224        remaining_millis: Option<U64>,
2225    },
2226    Persist {
2227        changed: bool,
2228    },
2229    MultiGet {
2230        values: Vec<StateOptionalValue>,
2231    },
2232    MultiSet {
2233        written: u32,
2234    },
2235    Increment {
2236        value: I64,
2237    },
2238    HashGet {
2239        value: StateOptionalValue,
2240    },
2241    HashSet {
2242        fields_added: u32,
2243    },
2244    HashGetAll {
2245        fields: Vec<StateHashField>,
2246    },
2247}
2248
2249pub const LODESTONE_API_STATE_WRITE_RESOLUTION_FORMAT_VERSION: u16 = 1;
2250#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2251#[serde(tag = "state", rename_all = "snake_case", deny_unknown_fields)]
2252pub enum StateWriteResolution {
2253    NotSubmitted,
2254    Resolved {
2255        result: StateCommandResult,
2256        sequence: U64,
2257    },
2258    KnownRetired {
2259        retired_through: U64,
2260    },
2261    StateReset {
2262        submitted_reset_epoch: U64,
2263        current_reset_epoch: U64,
2264    },
2265    Indeterminate {
2266        #[serde(default, skip_serializing_if = "Option::is_none")]
2267        observed_high_water: Option<U64>,
2268        #[serde(default, skip_serializing_if = "Option::is_none")]
2269        current_high_water: Option<U64>,
2270        #[serde(default, skip_serializing_if = "Option::is_none")]
2271        retired_through: Option<U64>,
2272    },
2273}
2274
2275pub const LODESTONE_API_SERVICE_CREDENTIAL_RESERVATION_FORMAT_VERSION: u16 = 1;
2276#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2277#[serde(deny_unknown_fields)]
2278pub struct ServiceCredentialReservation {
2279    pub locator: Locator,
2280    pub reservation_action_id: Digest,
2281    pub activation_action_id: Digest,
2282    pub principal_id: Identity,
2283    pub api_key_id: Identity,
2284    pub generation: U64,
2285    pub reservation_expires_at: U64,
2286    pub credential_expires_at: U64,
2287    pub verifier_algorithm: String,
2288    pub verifier_algorithm_version: u32,
2289    pub required_secret_bytes: u32,
2290}
2291
2292pub const LODESTONE_API_SUBSCRIPTION_METADATA_FIELD_FORMAT_VERSION: u16 = 1;
2293#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2294#[serde(rename_all = "snake_case")]
2295pub enum SubscriptionMetadataField {
2296    Id,
2297    RoutingHash,
2298    Operation,
2299    Shard,
2300    Sequence,
2301}
2302
2303pub const LODESTONE_API_SUBSCRIPTION_FIELD_FORMAT_VERSION: u16 = 1;
2304#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2305#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2306pub enum SubscriptionField {
2307    Source { path: String },
2308    Metadata { field: SubscriptionMetadataField },
2309}
2310
2311pub const LODESTONE_API_SUBSCRIPTION_FILTER_FORMAT_VERSION: u16 = 1;
2312#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2313#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2314pub enum SubscriptionFilter {
2315    All,
2316    Bool {
2317        must: Vec<SubscriptionFilter>,
2318        should: Vec<SubscriptionFilter>,
2319        must_not: Vec<SubscriptionFilter>,
2320        minimum_should_match: u32,
2321    },
2322    Term {
2323        field: SubscriptionField,
2324        value: JsonValue,
2325    },
2326    Terms {
2327        field: SubscriptionField,
2328        values: Vec<JsonValue>,
2329    },
2330    Range {
2331        field: SubscriptionField,
2332        #[serde(default, skip_serializing_if = "Option::is_none")]
2333        gt: Option<JsonValue>,
2334        #[serde(default, skip_serializing_if = "Option::is_none")]
2335        gte: Option<JsonValue>,
2336        #[serde(default, skip_serializing_if = "Option::is_none")]
2337        lt: Option<JsonValue>,
2338        #[serde(default, skip_serializing_if = "Option::is_none")]
2339        lte: Option<JsonValue>,
2340    },
2341    Exists {
2342        field: SubscriptionField,
2343    },
2344    Prefix {
2345        field: SubscriptionField,
2346        value: String,
2347    },
2348}
2349
2350pub const LODESTONE_API_SUBSCRIPTION_CURSOR_ENTRY_FORMAT_VERSION: u16 = 1;
2351#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2352#[serde(deny_unknown_fields)]
2353pub struct SubscriptionCursorEntry {
2354    pub index: Resource,
2355    pub routing_revision: U64,
2356    pub recovery_era: Identity,
2357    pub shard_id: U64,
2358    pub sequence: U64,
2359}
2360
2361pub const LODESTONE_API_SUBSCRIPTION_ROUTE_FORMAT_VERSION: u16 = 1;
2362#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2363#[serde(deny_unknown_fields)]
2364pub struct SubscriptionRoute {
2365    pub index: Resource,
2366    pub routing_revision: U64,
2367    pub shard_ids: Vec<U64>,
2368}
2369
2370pub const LODESTONE_API_SUBSCRIPTION_START_POSITION_FORMAT_VERSION: u16 = 1;
2371#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2372#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2373pub enum SubscriptionStartPosition {
2374    FromNow,
2375    Resume {
2376        routes: Vec<SubscriptionRoute>,
2377        cut: Vec<SubscriptionCursorEntry>,
2378    },
2379}
2380
2381pub const LODESTONE_API_SUBSCRIPTION_START_FORMAT_VERSION: u16 = 1;
2382#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2383#[serde(deny_unknown_fields)]
2384pub struct SubscriptionStart {
2385    pub format_version: u32,
2386    pub request_id: String,
2387    pub index: Resource,
2388    #[serde(default, skip_serializing_if = "Option::is_none")]
2389    pub filter: Option<SubscriptionFilter>,
2390    pub include_deletes: bool,
2391    pub source_projection: Vec<String>,
2392    pub reconnect_attempt: u32,
2393    pub start: SubscriptionStartPosition,
2394    pub heartbeat_millis: U64,
2395    pub schema_digest: Digest,
2396}
2397
2398pub const LODESTONE_API_SUBSCRIPTION_ACCEPTED_FORMAT_VERSION: u16 = 1;
2399#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2400#[serde(deny_unknown_fields)]
2401pub struct SubscriptionAccepted {
2402    pub format_version: u32,
2403    pub routes: Vec<SubscriptionRoute>,
2404    pub accepted_cut: Vec<SubscriptionCursorEntry>,
2405    pub schema_digest: Digest,
2406}
2407
2408pub const LODESTONE_API_SUBSCRIPTION_WRITER_FENCE_FORMAT_VERSION: u16 = 1;
2409#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2410#[serde(deny_unknown_fields)]
2411pub struct SubscriptionWriterFence {
2412    pub recovery_era: Identity,
2413    pub epoch: u32,
2414}
2415
2416pub const LODESTONE_API_SUBSCRIPTION_EVENT_FORMAT_VERSION: u16 = 1;
2417#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2418#[serde(deny_unknown_fields)]
2419pub struct SubscriptionEvent {
2420    pub format_version: u32,
2421    pub event_id: Digest,
2422    pub index: Resource,
2423    pub shard_id: U64,
2424    pub recovery_era: Identity,
2425    pub writer_fence: SubscriptionWriterFence,
2426    pub routing_revision: U64,
2427    pub sequence: U64,
2428    pub operation: String,
2429    pub document_id: String,
2430    pub routing_hash: u32,
2431    #[serde(default, skip_serializing_if = "Option::is_none")]
2432    pub source: Option<RawJson>,
2433}
2434
2435pub const LODESTONE_API_SUBSCRIPTION_HEARTBEAT_FORMAT_VERSION: u16 = 1;
2436#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2437#[serde(deny_unknown_fields)]
2438pub struct SubscriptionHeartbeat {
2439    pub format_version: u32,
2440    pub confirmed_cut: Vec<SubscriptionCursorEntry>,
2441    pub route_revision: U64,
2442    pub authorization_revision: U64,
2443    pub authorization_valid_until_millis: U64,
2444}
2445
2446pub const LODESTONE_API_SUBSCRIPTION_GAP_FORMAT_VERSION: u16 = 1;
2447#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2448#[serde(deny_unknown_fields)]
2449pub struct SubscriptionGap {
2450    pub format_version: u32,
2451    pub affected: Vec<SubscriptionCursorEntry>,
2452    pub last_confirmed: Vec<SubscriptionCursorEntry>,
2453    pub earliest_available: Vec<SubscriptionCursorEntry>,
2454    pub reason: String,
2455    pub terminal: bool,
2456}
2457
2458pub const LODESTONE_API_SUBSCRIPTION_TERMINAL_FORMAT_VERSION: u16 = 1;
2459#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2460#[serde(deny_unknown_fields)]
2461pub struct SubscriptionTerminal {
2462    pub format_version: u32,
2463    pub reason: String,
2464    pub retry_safe: bool,
2465}
2466
2467pub const LODESTONE_API_SUBSCRIPTION_FRAME_FORMAT_VERSION: u16 = 1;
2468#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2469#[serde(tag = "frame", rename_all = "snake_case", deny_unknown_fields)]
2470pub enum SubscriptionFrame {
2471    Accepted { body: SubscriptionAccepted },
2472    Event { body: SubscriptionEvent },
2473    Heartbeat { body: SubscriptionHeartbeat },
2474    Gap { body: SubscriptionGap },
2475    Terminal { body: SubscriptionTerminal },
2476}
2477
2478pub const LODESTONE_API_STREAM_BINDING_FORMAT_VERSION: u16 = 1;
2479#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2480#[serde(deny_unknown_fields)]
2481pub struct StreamBinding {
2482    pub name: String,
2483    pub transport: String,
2484    pub service: String,
2485    pub method: String,
2486    pub endpoint: String,
2487    pub auth_metadata: String,
2488    pub auth_scheme: String,
2489    pub semantic_format_version: u32,
2490    pub schema_digest: Digest,
2491}
2492
2493pub const LODESTONE_API_CAPABILITY_GRANT_FORMAT_VERSION: u16 = 1;
2494#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2495#[serde(deny_unknown_fields)]
2496pub struct CapabilityGrant {
2497    pub command: String,
2498    pub action: String,
2499    pub state: String,
2500    pub reason: String,
2501    pub mutation_class: String,
2502    pub cancellable: bool,
2503    pub workload_classes: Vec<WorkloadClass>,
2504    pub possible_submission_states: Vec<String>,
2505    pub capability_family: String,
2506    pub effect_class: String,
2507    pub risk_flags: Vec<String>,
2508    pub admissible_errors: Vec<String>,
2509    pub referenced_limits: Vec<String>,
2510    pub retry_safety: String,
2511    pub identity_requirement: String,
2512    #[serde(default, skip_serializing_if = "Option::is_none")]
2513    pub resolver_command: Option<String>,
2514    pub cancellation: String,
2515    pub side_effects: Vec<String>,
2516    pub recovery: String,
2517    pub index_patterns: Vec<String>,
2518    pub exact_index_incarnations: Vec<Identity>,
2519}
2520
2521pub const LODESTONE_API_PROTOCOL_LIMIT_FORMAT_VERSION: u16 = 1;
2522#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2523#[serde(deny_unknown_fields)]
2524pub struct ProtocolLimit {
2525    pub id: String,
2526    pub default: U64,
2527    pub maximum: U64,
2528    pub unit: String,
2529}
2530
2531pub const LODESTONE_API_DOCUMENT_MUTATION_CONDITION_FORMAT_VERSION: u16 = 1;
2532#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2533#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2534pub enum DocumentMutationCondition {
2535    Any,
2536    MustNotExist,
2537    IfSeqNo { seq_no: U64 },
2538    IfSeqNoAndPrimaryTerm { seq_no: U64, primary_term: U64 },
2539}
2540
2541pub const LODESTONE_API_AUDIT_EVENT_FORMAT_VERSION: u16 = 1;
2542#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2543#[serde(deny_unknown_fields)]
2544pub struct AuditEvent {
2545    pub sequence: U64,
2546    pub server_time: U64,
2547    #[serde(default, skip_serializing_if = "Option::is_none")]
2548    pub principal_id: Option<Identity>,
2549    #[serde(default, skip_serializing_if = "Option::is_none")]
2550    pub api_key_id: Option<Identity>,
2551    pub policy_revision: U64,
2552    pub action: String,
2553    pub outcome: String,
2554    pub detail: String,
2555}
2556
2557pub const LODESTONE_API_AUDIT_GAP_FORMAT_VERSION: u16 = 1;
2558#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2559#[serde(deny_unknown_fields)]
2560pub struct AuditGap {
2561    pub first_sequence: U64,
2562    pub last_sequence: U64,
2563    pub reason: String,
2564}
2565
2566pub const LODESTONE_API_SERVICE_CREDENTIAL_GRANT_FORMAT_VERSION: u16 = 1;
2567#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2568#[serde(deny_unknown_fields)]
2569pub struct ServiceCredentialGrant {
2570    pub role_name: String,
2571    pub role_version: U64,
2572}
2573
2574pub const LODESTONE_API_SERVICE_CREDENTIAL_SUMMARY_FORMAT_VERSION: u16 = 1;
2575#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2576#[serde(deny_unknown_fields)]
2577pub struct ServiceCredentialSummary {
2578    pub principal_id: Identity,
2579    pub api_key_id: Identity,
2580    pub generation: U64,
2581    pub state: String,
2582    #[serde(default, skip_serializing_if = "Option::is_none")]
2583    pub expires_at: Option<U64>,
2584    pub grants: Vec<ServiceCredentialGrant>,
2585}
2586
2587pub const LODESTONE_API_SECURITY_ROLE_FORMAT_VERSION: u16 = 1;
2588#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2589#[serde(deny_unknown_fields)]
2590pub struct SecurityRole {
2591    pub role_name: String,
2592    pub version: U64,
2593    pub permissions: Vec<String>,
2594    pub delegable_permissions: Vec<String>,
2595    pub allowed_workload_classes: Vec<WorkloadClass>,
2596    pub index_patterns: Vec<String>,
2597    pub append_index_incarnations: Vec<Identity>,
2598}
2599
2600pub const LODESTONE_API_ROLE_APPEND_SCOPE_CHANGE_FORMAT_VERSION: u16 = 1;
2601#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2602#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2603pub enum RoleAppendScopeChange {
2604    Add { index: Resource },
2605    Remove { index_incarnation: Identity },
2606}
2607
2608pub const LODESTONE_API_ROLE_APPEND_ACCESS_PREPARATION_FORMAT_VERSION: u16 = 1;
2609#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2610#[serde(tag = "state", rename_all = "snake_case", deny_unknown_fields)]
2611pub enum RoleAppendAccessPreparation {
2612    Prepared {
2613        locator: Locator,
2614        semantic_digest: Digest,
2615        expires_at: U64,
2616        predecessor_role_version: U64,
2617        successor_role_version: U64,
2618    },
2619    AlreadySatisfied {
2620        role: SecurityRole,
2621    },
2622}
2623
2624pub const LODESTONE_API_SECURITY_ACTION_OUTCOME_FORMAT_VERSION: u16 = 1;
2625#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2626#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2627pub enum SecurityActionOutcome {
2628    Reserved {
2629        principal_id: Identity,
2630        api_key_id: Identity,
2631        generation: U64,
2632    },
2633    Activated {
2634        principal_id: Identity,
2635        api_key_id: Identity,
2636        generation: U64,
2637    },
2638    Revoked {
2639        principal_id: Identity,
2640        api_key_id: Identity,
2641        generation: U64,
2642    },
2643    Retired {
2644        principal_id: Identity,
2645        api_key_id: Identity,
2646        generation: U64,
2647    },
2648}
2649
2650pub const LODESTONE_API_MAINTENANCE_WORK_STATE_FORMAT_VERSION: u16 = 1;
2651#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2652#[serde(rename_all = "snake_case")]
2653pub enum MaintenanceWorkState {
2654    ParkedOperatorRequired,
2655    RetryWait,
2656    RetryReady,
2657    Leased,
2658    Deferred,
2659    Runnable,
2660}
2661
2662pub const LODESTONE_API_MAINTENANCE_ATTEMPT_STATE_FORMAT_VERSION: u16 = 1;
2663#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2664#[serde(rename_all = "snake_case")]
2665pub enum MaintenanceAttemptState {
2666    Running,
2667    DeadlineExceededDraining,
2668    DeadlineExceededReclaimPending,
2669    CancellationDraining,
2670    ClaimRecoveryPending,
2671}
2672
2673pub const LODESTONE_API_MAINTENANCE_FAILURE_CLASS_FORMAT_VERSION: u16 = 1;
2674#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2675#[serde(rename_all = "snake_case")]
2676pub enum MaintenanceFailureClass {
2677    Corruption,
2678    AttemptBudget,
2679    StructuralLimit,
2680    Execution,
2681    Other,
2682}
2683
2684pub const LODESTONE_API_MAINTENANCE_FAILURE_CLASS_COUNT_FORMAT_VERSION: u16 = 1;
2685#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2686#[serde(deny_unknown_fields)]
2687pub struct MaintenanceFailureClassCount {
2688    pub class: MaintenanceFailureClass,
2689    pub count: U64,
2690}
2691
2692pub const LODESTONE_API_MAINTENANCE_ATTEMPT_OBSERVATION_FORMAT_VERSION: u16 = 1;
2693#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2694#[serde(deny_unknown_fields)]
2695pub struct MaintenanceAttemptObservation {
2696    pub state: MaintenanceAttemptState,
2697    pub lease_epoch: U64,
2698    pub lease_expires_at: U64,
2699    pub observed_at_millis: U64,
2700}
2701
2702pub const LODESTONE_API_MAINTENANCE_TASK_SCOPE_FORMAT_VERSION: u16 = 1;
2703#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2704#[serde(deny_unknown_fields)]
2705pub struct MaintenanceTaskScope {
2706    pub kind: String,
2707    #[serde(default, skip_serializing_if = "Option::is_none")]
2708    pub index: Option<Resource>,
2709    #[serde(default, skip_serializing_if = "Option::is_none")]
2710    pub shard_id: Option<u32>,
2711}
2712
2713pub const LODESTONE_API_MAINTENANCE_TASK_STATUS_FORMAT_VERSION: u16 = 1;
2714#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2715#[serde(deny_unknown_fields)]
2716pub struct MaintenanceTaskStatus {
2717    pub task_id: Identity,
2718    pub kind: String,
2719    pub scope: MaintenanceTaskScope,
2720    pub checkpoint_generation: U64,
2721    pub attempt_count: u32,
2722    pub admitted_at: U64,
2723    pub last_transition_at: U64,
2724    pub last_progress_at: U64,
2725    pub work_state: MaintenanceWorkState,
2726    pub state_since: U64,
2727    #[serde(default, skip_serializing_if = "Option::is_none")]
2728    pub defer_reason: Option<String>,
2729    pub cancellation_requested: bool,
2730    #[serde(default, skip_serializing_if = "Option::is_none")]
2731    pub retry_not_before: Option<U64>,
2732    #[serde(default, skip_serializing_if = "Option::is_none")]
2733    pub failure_at: Option<U64>,
2734    #[serde(default, skip_serializing_if = "Option::is_none")]
2735    pub lease_acquired_at: Option<U64>,
2736    #[serde(default, skip_serializing_if = "Option::is_none")]
2737    pub lease_expires_at: Option<U64>,
2738    #[serde(default, skip_serializing_if = "Option::is_none")]
2739    pub failure_class: Option<MaintenanceFailureClass>,
2740    #[serde(default, skip_serializing_if = "Option::is_none")]
2741    pub failure_code: Option<String>,
2742    pub operator_action_required: bool,
2743    #[serde(default, skip_serializing_if = "Option::is_none")]
2744    pub local_attempt: Option<MaintenanceAttemptObservation>,
2745}
2746
2747pub const LODESTONE_API_MAINTENANCE_STATUS_AGGREGATE_FORMAT_VERSION: u16 = 1;
2748#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2749#[serde(deny_unknown_fields)]
2750pub struct MaintenanceStatusAggregate {
2751    pub format_version: u32,
2752    pub recovery_era: Identity,
2753    pub source_revision: U64,
2754    pub root_revision: U64,
2755    pub logical_observation_time: U64,
2756    #[serde(default, skip_serializing_if = "Option::is_none")]
2757    pub local_observation_millis: Option<U64>,
2758    pub total_incomplete: U64,
2759    pub parked_operator_required: U64,
2760    pub retry_wait: U64,
2761    pub retry_ready: U64,
2762    pub leased: U64,
2763    pub deferred: U64,
2764    pub runnable: U64,
2765    pub eligible_backlog: U64,
2766    pub cancellation_requested: U64,
2767    #[serde(default, skip_serializing_if = "Option::is_none")]
2768    pub oldest_backlog_age: Option<U64>,
2769    #[serde(default, skip_serializing_if = "Option::is_none")]
2770    pub oldest_runnable_age: Option<U64>,
2771    #[serde(default, skip_serializing_if = "Option::is_none")]
2772    pub oldest_retry_wait_age: Option<U64>,
2773    #[serde(default, skip_serializing_if = "Option::is_none")]
2774    pub oldest_parked_age: Option<U64>,
2775    #[serde(default, skip_serializing_if = "Option::is_none")]
2776    pub oldest_no_progress_age: Option<U64>,
2777    pub current_action_capacity: u32,
2778    pub maximum_action_capacity: u32,
2779    pub active_passes: U64,
2780    pub local_in_flight: U64,
2781    pub deadline_draining: U64,
2782    pub cancellation_draining: U64,
2783    pub claim_recovery_pending: U64,
2784    pub projection_refresh_pending: bool,
2785    #[serde(default, skip_serializing_if = "Option::is_none")]
2786    pub durable_last_progress_at: Option<U64>,
2787    pub tasks_claimed_total: U64,
2788    pub tasks_progressed_total: U64,
2789    pub tasks_completed_total: U64,
2790    pub task_retries_total: U64,
2791    pub task_failures_total: U64,
2792    pub deadline_failures_total: U64,
2793    pub cancellations_total: U64,
2794    pub overlay_capacity_exhaustions_total: U64,
2795    pub failure_classes: Vec<MaintenanceFailureClassCount>,
2796}
2797
2798pub const LODESTONE_API_RUNTIME_STATUS_DETAIL_FORMAT_VERSION: u16 = 1;
2799#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2800#[serde(deny_unknown_fields)]
2801pub struct RuntimeStatusDetail {
2802    pub metastore_revision: U64,
2803    pub root_revision: U64,
2804    pub logical_time: U64,
2805    pub degraded_dependencies: Vec<String>,
2806}
2807
2808pub const LODESTONE_API_RESULT_CACHE_STATUS_FORMAT_VERSION: u16 = 2;
2809#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2810#[serde(deny_unknown_fields)]
2811pub struct ResultCacheStatus {
2812    pub format_version: u32,
2813    pub hits: U64,
2814    pub misses: U64,
2815    pub admissions: U64,
2816    pub bypasses: U64,
2817    pub evictions: U64,
2818    pub collection_bytes: U64,
2819    pub collection_entries: u32,
2820}
2821
2822pub const LODESTONE_API_FIELD_PROMOTION_STATUS_FORMAT_VERSION: u16 = 1;
2823#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2824#[serde(deny_unknown_fields)]
2825pub struct FieldPromotionStatus {
2826    pub format_version: u32,
2827    pub index: Resource,
2828    pub mapping_generation: U64,
2829    pub policy_generation: U64,
2830    #[serde(default, skip_serializing_if = "Option::is_none")]
2831    pub last_decision_generation: Option<U64>,
2832    pub heat_records: u32,
2833    pub promoted_fields: u32,
2834    pub extra_bytes: U64,
2835    pub enabled: bool,
2836}
2837
2838pub const LODESTONE_API_OVERLOAD_SHARD_STATUS_FORMAT_VERSION: u16 = 2;
2839#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2840#[serde(deny_unknown_fields)]
2841pub struct OverloadShardStatus {
2842    pub format_version: u32,
2843    pub shard_id: u32,
2844    pub writer_epoch: U64,
2845    pub configured_mode: String,
2846    pub effective_disposition: String,
2847    pub registered_through: U64,
2848    pub indexed_through: U64,
2849    pub lag_operations: U64,
2850    pub backlog_bytes: U64,
2851    pub oldest_age_millis: U64,
2852    pub collection_share_bytes: U64,
2853    pub recovery_ops_this_pass: u32,
2854    pub pending_overlay_documents: U64,
2855    #[serde(default, skip_serializing_if = "Option::is_none")]
2856    pub shed_reason: Option<String>,
2857}
2858
2859pub const LODESTONE_API_EXTERNAL_KEY_BINDING_FORMAT_VERSION: u16 = 1;
2860#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2861#[serde(deny_unknown_fields)]
2862pub struct ExternalKeyBinding {
2863    pub content_key_id: Identity,
2864    pub content_key_generation: U64,
2865    pub binding_id: Identity,
2866    pub binding_generation: U64,
2867    pub access_generation: U64,
2868    pub opaque_binding_base64: String,
2869    pub object_context_digest: Digest,
2870}
2871
2872pub const LODESTONE_API_ROLLUP_MEASURE_FORMAT_VERSION: u16 = 1;
2873#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2874#[serde(tag = "kind", rename_all = "snake_case", deny_unknown_fields)]
2875pub enum RollupMeasure {
2876    Count,
2877    Sum { field_path_digest: Digest },
2878    Min { field_path_digest: Digest },
2879    Max { field_path_digest: Digest },
2880}
2881
2882pub const LODESTONE_API_AGGREGATE_THEN_DELETE_POLICY_FORMAT_VERSION: u16 = 1;
2883#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2884#[serde(deny_unknown_fields)]
2885pub struct AggregateThenDeletePolicy {
2886    pub policy_id: Identity,
2887    pub policy_generation: U64,
2888    pub detail_retirement_acknowledged: bool,
2889    #[serde(default, skip_serializing_if = "Option::is_none")]
2890    pub expected_policy_generation: Option<U64>,
2891    pub timestamp_field_digest: Digest,
2892    pub bucket_width_millis: U64,
2893    pub bucket_alignment_millis: U64,
2894    pub dimensions: Vec<Digest>,
2895    pub measures: Vec<RollupMeasure>,
2896}
2897
2898pub const LODESTONE_API_LIFECYCLE_BINDING_STATUS_FORMAT_VERSION: u16 = 1;
2899#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2900#[serde(deny_unknown_fields)]
2901pub struct LifecycleBindingStatus {
2902    pub content_key_id: Identity,
2903    pub content_key_generation: U64,
2904    pub binding_id: Identity,
2905    pub binding_generation: U64,
2906    pub access_generation: U64,
2907}
2908
2909pub const LODESTONE_API_LIFECYCLE_ROLLUP_STATUS_FORMAT_VERSION: u16 = 1;
2910#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2911#[serde(deny_unknown_fields)]
2912pub struct LifecycleRollupStatus {
2913    pub policy_id: Identity,
2914    pub policy_generation: U64,
2915    pub ledger_revision: U64,
2916    pub coverages: u32,
2917    pub raw_retired_coverages: u32,
2918    pub detail_retirement_acknowledged: bool,
2919    pub query_contract_version: u32,
2920    pub timestamp_field_digest: Digest,
2921    pub bucket_width_millis: U64,
2922    pub bucket_alignment_millis: U64,
2923    pub dimensions: Vec<Digest>,
2924    pub measures: Vec<RollupMeasure>,
2925}
2926
2927pub const LODESTONE_API_LIFECYCLE_STATUS_FORMAT_VERSION: u16 = 2;
2928#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2929#[serde(deny_unknown_fields)]
2930pub struct LifecycleStatus {
2931    pub format_version: u32,
2932    pub index: Resource,
2933    pub authority_revision: U64,
2934    pub active_bindings: Vec<LifecycleBindingStatus>,
2935    #[serde(default, skip_serializing_if = "Option::is_none")]
2936    pub rollup: Option<LifecycleRollupStatus>,
2937}
2938
2939pub const LODESTONE_API_QUOTA_LIMIT_FORMAT_VERSION: u16 = 1;
2940#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2941#[serde(deny_unknown_fields)]
2942pub struct QuotaLimit {
2943    pub dimension: String,
2944    pub maximum: U64,
2945    pub window_millis: U64,
2946}
2947
2948pub const LODESTONE_API_QUOTA_CONSUMPTION_FORMAT_VERSION: u16 = 1;
2949#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2950#[serde(deny_unknown_fields)]
2951pub struct QuotaConsumption {
2952    pub dimension: String,
2953    pub consumed: U64,
2954    pub window_millis: U64,
2955}
2956
2957pub const LODESTONE_API_QUOTA_UPDATE_FORMAT_VERSION: u16 = 1;
2958#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2959#[serde(deny_unknown_fields)]
2960pub struct QuotaUpdate {
2961    pub revision: U64,
2962    pub state: String,
2963}
2964
2965pub const LODESTONE_API_CORE_BINDING_FORMAT_VERSION: u16 = 2;
2966#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2967#[serde(deny_unknown_fields)]
2968pub struct CoreBinding {
2969    pub cluster_id: Identity,
2970    pub collection_id: Identity,
2971    pub configuration_generation: U64,
2972    pub native_endpoints: Vec<String>,
2973    pub selected_stream_endpoint: String,
2974    pub schema_id: String,
2975    pub schema_digest: Digest,
2976}
2977
2978pub const LODESTONE_API_READINESS_OBSERVATION_FORMAT_VERSION: u16 = 1;
2979#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2980#[serde(deny_unknown_fields)]
2981pub struct ReadinessObservation {
2982    pub subject: String,
2983    pub state: String,
2984    #[serde(default, skip_serializing_if = "Option::is_none")]
2985    pub reason: Option<String>,
2986    pub revision: U64,
2987    pub observed_cut: U64,
2988}
2989
2990pub const LODESTONE_API_USAGE_DIMENSION_FORMAT_VERSION: u16 = 1;
2991#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
2992#[serde(deny_unknown_fields)]
2993pub struct UsageDimension {
2994    pub name: String,
2995    pub value: String,
2996}
2997
2998pub const LODESTONE_API_PHYSICAL_USAGE_VALUE_FORMAT_VERSION: u16 = 2;
2999#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
3000#[serde(deny_unknown_fields)]
3001pub struct PhysicalUsageValue {
3002    pub meter: String,
3003    pub unit: String,
3004    pub value: ExactDecimal,
3005}
3006
3007pub const LODESTONE_API_CORE_USAGE_UNITS_FORMAT_VERSION: u16 = 2;
3008#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
3009#[serde(deny_unknown_fields)]
3010pub struct CoreUsageUnits {
3011    pub sequence: U64,
3012    pub record_identity: Digest,
3013    pub index_id: Identity,
3014    pub workload_class: WorkloadClass,
3015    pub window_start: U64,
3016    pub window_end: U64,
3017    pub meter_set_version: u32,
3018    pub dimensions: Vec<UsageDimension>,
3019    pub values: Vec<PhysicalUsageValue>,
3020    pub authority_revision: U64,
3021    pub source_digest: Digest,
3022}
3023
3024pub const LODESTONE_API_CORE_USAGE_CORRECTION_FORMAT_VERSION: u16 = 2;
3025#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
3026#[serde(deny_unknown_fields)]
3027pub struct CoreUsageCorrection {
3028    pub sequence: U64,
3029    pub correction_sequence: U64,
3030    pub correction_identity: Digest,
3031    pub target_record_identity: Digest,
3032    pub index_id: Identity,
3033    pub workload_class: WorkloadClass,
3034    pub window_start: U64,
3035    pub window_end: U64,
3036    pub meter_set_version: u32,
3037    pub dimensions: Vec<UsageDimension>,
3038    pub values: Vec<PhysicalUsageValue>,
3039    pub reason_digest: Digest,
3040    pub authority_revision: U64,
3041    pub source_digest: Digest,
3042}
3043
3044pub const LODESTONE_API_ERROR_DETAIL_FORMAT_VERSION: u16 = 1;
3045#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
3046#[serde(tag = "code", rename_all = "snake_case", deny_unknown_fields)]
3047pub enum ErrorDetail {
3048    Aborted {
3049        reason: String,
3050    },
3051    DeadlineExceeded {
3052        submitted: bool,
3053    },
3054    InvalidRequest {
3055        #[serde(default, skip_serializing_if = "Option::is_none")]
3056        field: Option<String>,
3057        reason: String,
3058    },
3059    UnsupportedVersion {
3060        observed: u32,
3061        maximum_supported: u32,
3062    },
3063    Unauthenticated,
3064    PermissionDenied {
3065        #[serde(default, skip_serializing_if = "Option::is_none")]
3066        action: Option<String>,
3067        #[serde(default, skip_serializing_if = "Option::is_none")]
3068        workload_class: Option<WorkloadClass>,
3069    },
3070    NotFound {
3071        #[serde(default, skip_serializing_if = "Option::is_none")]
3072        resource: Option<String>,
3073    },
3074    Conflict {
3075        #[serde(default, skip_serializing_if = "Option::is_none")]
3076        expected_revision: Option<U64>,
3077        #[serde(default, skip_serializing_if = "Option::is_none")]
3078        observed_revision: Option<U64>,
3079    },
3080    StaleCursor {
3081        restart_count: u32,
3082    },
3083    RestartBudgetExhausted {
3084        maximum_restarts: u32,
3085    },
3086    LimitExceeded {
3087        limit_id: String,
3088        maximum: U64,
3089    },
3090    CapabilityUnavailable {
3091        #[serde(default, skip_serializing_if = "Option::is_none")]
3092        capability: Option<String>,
3093    },
3094    NotSubmitted {
3095        #[serde(default, skip_serializing_if = "Option::is_none")]
3096        retry_after_millis: Option<U64>,
3097    },
3098    SubmittedIndeterminate {
3099        #[serde(default, skip_serializing_if = "Option::is_none")]
3100        locator: Option<Locator>,
3101    },
3102    ExpiredUnknown {
3103        #[serde(default, skip_serializing_if = "Option::is_none")]
3104        locator: Option<Locator>,
3105    },
3106    SecretNotEscrowed,
3107    RetentionGap {
3108        retired_through: U64,
3109    },
3110    ArtifactRangeInvalid {
3111        maximum_bytes: U64,
3112    },
3113    ChecksumMismatch {
3114        expected: Digest,
3115        observed: Digest,
3116    },
3117    TemporarilyUnavailable {
3118        #[serde(default, skip_serializing_if = "Option::is_none")]
3119        retry_after_millis: Option<U64>,
3120    },
3121    Internal,
3122}
3123
3124pub const LODESTONE_API_CONNECTION_PROFILE_FORMAT_VERSION: u16 = 3;
3125#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
3126#[serde(deny_unknown_fields)]
3127pub struct ConnectionProfile {
3128    pub format_version: u32,
3129    pub profile_generation: U64,
3130    pub native_endpoints: Vec<String>,
3131    pub selected_stream_endpoint: String,
3132    pub tls_server_name: String,
3133    pub tls_trust_sha256: Digest,
3134    pub expected_cluster_id: Identity,
3135    pub expected_collection_id: Identity,
3136    pub expected_principal_id: Identity,
3137    pub schema_id: String,
3138    pub schema_digest: Digest,
3139    pub credential_id: Identity,
3140    pub credential_generation: U64,
3141    #[serde(default, skip_serializing_if = "Option::is_none")]
3142    pub credential_expires_at: Option<U64>,
3143    pub secret_reference: String,
3144}
3145
3146#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3147pub enum TypeKind {
3148    Enum,
3149    Struct,
3150    TaggedUnion,
3151}
3152#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3153pub struct TypeContract {
3154    pub name: &'static str,
3155    pub format_version: u16,
3156    pub kind: TypeKind,
3157    pub wire: bool,
3158}
3159pub const LODESTONE_API_TYPE_CONTRACTS: &[TypeContract] = &[
3160    TypeContract {
3161        name: "cursor",
3162        format_version: 1,
3163        kind: TypeKind::Struct,
3164        wire: true,
3165    },
3166    TypeContract {
3167        name: "locator",
3168        format_version: 1,
3169        kind: TypeKind::Struct,
3170        wire: true,
3171    },
3172    TypeContract {
3173        name: "resource",
3174        format_version: 1,
3175        kind: TypeKind::Struct,
3176        wire: true,
3177    },
3178    TypeContract {
3179        name: "field_promotion_configuration",
3180        format_version: 1,
3181        kind: TypeKind::Struct,
3182        wire: true,
3183    },
3184    TypeContract {
3185        name: "overload_configuration",
3186        format_version: 2,
3187        kind: TypeKind::Struct,
3188        wire: true,
3189    },
3190    TypeContract {
3191        name: "index_policies",
3192        format_version: 1,
3193        kind: TypeKind::Struct,
3194        wire: true,
3195    },
3196    TypeContract {
3197        name: "maintenance_budgets",
3198        format_version: 1,
3199        kind: TypeKind::Struct,
3200        wire: true,
3201    },
3202    TypeContract {
3203        name: "resource_durability_class",
3204        format_version: 1,
3205        kind: TypeKind::Enum,
3206        wire: true,
3207    },
3208    TypeContract {
3209        name: "resource_storage_class",
3210        format_version: 1,
3211        kind: TypeKind::Enum,
3212        wire: true,
3213    },
3214    TypeContract {
3215        name: "workload_class",
3216        format_version: 1,
3217        kind: TypeKind::Enum,
3218        wire: true,
3219    },
3220    TypeContract {
3221        name: "index_resource_spec",
3222        format_version: 1,
3223        kind: TypeKind::Struct,
3224        wire: true,
3225    },
3226    TypeContract {
3227        name: "index_summary",
3228        format_version: 1,
3229        kind: TypeKind::Struct,
3230        wire: true,
3231    },
3232    TypeContract {
3233        name: "mapping_mode",
3234        format_version: 1,
3235        kind: TypeKind::Enum,
3236        wire: true,
3237    },
3238    TypeContract {
3239        name: "dynamic_mapping_policy",
3240        format_version: 1,
3241        kind: TypeKind::Enum,
3242        wire: true,
3243    },
3244    TypeContract {
3245        name: "mapping_analyzer",
3246        format_version: 1,
3247        kind: TypeKind::Enum,
3248        wire: true,
3249    },
3250    TypeContract {
3251        name: "keyword_normalizer",
3252        format_version: 1,
3253        kind: TypeKind::Enum,
3254        wire: true,
3255    },
3256    TypeContract {
3257        name: "vector_metric",
3258        format_version: 1,
3259        kind: TypeKind::Enum,
3260        wire: true,
3261    },
3262    TypeContract {
3263        name: "mapping_scalar",
3264        format_version: 1,
3265        kind: TypeKind::TaggedUnion,
3266        wire: true,
3267    },
3268    TypeContract {
3269        name: "mapping_field_type",
3270        format_version: 1,
3271        kind: TypeKind::TaggedUnion,
3272        wire: true,
3273    },
3274    TypeContract {
3275        name: "mapping_field",
3276        format_version: 1,
3277        kind: TypeKind::Struct,
3278        wire: true,
3279    },
3280    TypeContract {
3281        name: "multi_field_projection",
3282        format_version: 1,
3283        kind: TypeKind::Struct,
3284        wire: true,
3285    },
3286    TypeContract {
3287        name: "analyzer_identity",
3288        format_version: 1,
3289        kind: TypeKind::Struct,
3290        wire: true,
3291    },
3292    TypeContract {
3293        name: "keyword_limit",
3294        format_version: 1,
3295        kind: TypeKind::Struct,
3296        wire: true,
3297    },
3298    TypeContract {
3299        name: "mapping",
3300        format_version: 1,
3301        kind: TypeKind::Struct,
3302        wire: true,
3303    },
3304    TypeContract {
3305        name: "index_detail",
3306        format_version: 1,
3307        kind: TypeKind::Struct,
3308        wire: true,
3309    },
3310    TypeContract {
3311        name: "source_provider",
3312        format_version: 1,
3313        kind: TypeKind::Enum,
3314        wire: true,
3315    },
3316    TypeContract {
3317        name: "source_decoder",
3318        format_version: 1,
3319        kind: TypeKind::Enum,
3320        wire: true,
3321    },
3322    TypeContract {
3323        name: "source_replay_guarantees",
3324        format_version: 1,
3325        kind: TypeKind::Struct,
3326        wire: true,
3327    },
3328    TypeContract {
3329        name: "source_partition_configuration",
3330        format_version: 1,
3331        kind: TypeKind::Struct,
3332        wire: true,
3333    },
3334    TypeContract {
3335        name: "replayable_source_configuration",
3336        format_version: 1,
3337        kind: TypeKind::Struct,
3338        wire: true,
3339    },
3340    TypeContract {
3341        name: "source_partition_status",
3342        format_version: 1,
3343        kind: TypeKind::Struct,
3344        wire: true,
3345    },
3346    TypeContract {
3347        name: "replayable_source_status",
3348        format_version: 1,
3349        kind: TypeKind::Struct,
3350        wire: true,
3351    },
3352    TypeContract {
3353        name: "source_control_transition",
3354        format_version: 1,
3355        kind: TypeKind::Enum,
3356        wire: true,
3357    },
3358    TypeContract {
3359        name: "history_ledger_precondition",
3360        format_version: 1,
3361        kind: TypeKind::TaggedUnion,
3362        wire: true,
3363    },
3364    TypeContract {
3365        name: "history_retention_policy",
3366        format_version: 1,
3367        kind: TypeKind::Struct,
3368        wire: true,
3369    },
3370    TypeContract {
3371        name: "history_selector",
3372        format_version: 1,
3373        kind: TypeKind::TaggedUnion,
3374        wire: true,
3375    },
3376    TypeContract {
3377        name: "history_hold",
3378        format_version: 1,
3379        kind: TypeKind::Struct,
3380        wire: true,
3381    },
3382    TypeContract {
3383        name: "history_status",
3384        format_version: 1,
3385        kind: TypeKind::Struct,
3386        wire: true,
3387    },
3388    TypeContract {
3389        name: "history_resolution",
3390        format_version: 1,
3391        kind: TypeKind::Struct,
3392        wire: true,
3393    },
3394    TypeContract {
3395        name: "index_reference",
3396        format_version: 1,
3397        kind: TypeKind::Struct,
3398        wire: true,
3399    },
3400    TypeContract {
3401        name: "alias_target",
3402        format_version: 1,
3403        kind: TypeKind::Struct,
3404        wire: true,
3405    },
3406    TypeContract {
3407        name: "alias_summary",
3408        format_version: 1,
3409        kind: TypeKind::Struct,
3410        wire: true,
3411    },
3412    TypeContract {
3413        name: "alias_detail",
3414        format_version: 1,
3415        kind: TypeKind::Struct,
3416        wire: true,
3417    },
3418    TypeContract {
3419        name: "data_stream_summary",
3420        format_version: 1,
3421        kind: TypeKind::Struct,
3422        wire: true,
3423    },
3424    TypeContract {
3425        name: "component_template_binding",
3426        format_version: 1,
3427        kind: TypeKind::Struct,
3428        wire: true,
3429    },
3430    TypeContract {
3431        name: "index_template_binding",
3432        format_version: 1,
3433        kind: TypeKind::Struct,
3434        wire: true,
3435    },
3436    TypeContract {
3437        name: "lifecycle_policy_binding",
3438        format_version: 1,
3439        kind: TypeKind::Struct,
3440        wire: true,
3441    },
3442    TypeContract {
3443        name: "data_stream_detail",
3444        format_version: 1,
3445        kind: TypeKind::Struct,
3446        wire: true,
3447    },
3448    TypeContract {
3449        name: "component_template_summary",
3450        format_version: 1,
3451        kind: TypeKind::Struct,
3452        wire: true,
3453    },
3454    TypeContract {
3455        name: "component_template_detail",
3456        format_version: 1,
3457        kind: TypeKind::Struct,
3458        wire: true,
3459    },
3460    TypeContract {
3461        name: "index_template_summary",
3462        format_version: 1,
3463        kind: TypeKind::Struct,
3464        wire: true,
3465    },
3466    TypeContract {
3467        name: "index_template_detail",
3468        format_version: 1,
3469        kind: TypeKind::Struct,
3470        wire: true,
3471    },
3472    TypeContract {
3473        name: "ingest_pipeline_summary",
3474        format_version: 1,
3475        kind: TypeKind::Struct,
3476        wire: true,
3477    },
3478    TypeContract {
3479        name: "ingest_pipeline_detail",
3480        format_version: 1,
3481        kind: TypeKind::Struct,
3482        wire: true,
3483    },
3484    TypeContract {
3485        name: "ingest_pipeline_selection",
3486        format_version: 1,
3487        kind: TypeKind::Struct,
3488        wire: true,
3489    },
3490    TypeContract {
3491        name: "lifecycle_policy_summary",
3492        format_version: 1,
3493        kind: TypeKind::Struct,
3494        wire: true,
3495    },
3496    TypeContract {
3497        name: "rollover_thresholds",
3498        format_version: 1,
3499        kind: TypeKind::Struct,
3500        wire: true,
3501    },
3502    TypeContract {
3503        name: "retention_policy",
3504        format_version: 1,
3505        kind: TypeKind::Struct,
3506        wire: true,
3507    },
3508    TypeContract {
3509        name: "lifecycle_policy_detail",
3510        format_version: 1,
3511        kind: TypeKind::Struct,
3512        wire: true,
3513    },
3514    TypeContract {
3515        name: "text_query_operator",
3516        format_version: 1,
3517        kind: TypeKind::Enum,
3518        wire: true,
3519    },
3520    TypeContract {
3521        name: "text_query_analyzer",
3522        format_version: 1,
3523        kind: TypeKind::Enum,
3524        wire: true,
3525    },
3526    TypeContract {
3527        name: "zero_terms_query",
3528        format_version: 1,
3529        kind: TypeKind::Enum,
3530        wire: true,
3531    },
3532    TypeContract {
3533        name: "text_query_options",
3534        format_version: 1,
3535        kind: TypeKind::Struct,
3536        wire: true,
3537    },
3538    TypeContract {
3539        name: "multi_match_mode",
3540        format_version: 1,
3541        kind: TypeKind::Enum,
3542        wire: true,
3543    },
3544    TypeContract {
3545        name: "multi_match_field",
3546        format_version: 1,
3547        kind: TypeKind::Struct,
3548        wire: true,
3549    },
3550    TypeContract {
3551        name: "multi_match_options",
3552        format_version: 1,
3553        kind: TypeKind::Struct,
3554        wire: true,
3555    },
3556    TypeContract {
3557        name: "sort_order",
3558        format_version: 1,
3559        kind: TypeKind::Enum,
3560        wire: true,
3561    },
3562    TypeContract {
3563        name: "sort_mode",
3564        format_version: 1,
3565        kind: TypeKind::Enum,
3566        wire: true,
3567    },
3568    TypeContract {
3569        name: "missing_order",
3570        format_version: 1,
3571        kind: TypeKind::Enum,
3572        wire: true,
3573    },
3574    TypeContract {
3575        name: "nested_score_mode",
3576        format_version: 1,
3577        kind: TypeKind::Enum,
3578        wire: true,
3579    },
3580    TypeContract {
3581        name: "nested_inner_hits",
3582        format_version: 1,
3583        kind: TypeKind::Struct,
3584        wire: true,
3585    },
3586    TypeContract {
3587        name: "sort_spec",
3588        format_version: 1,
3589        kind: TypeKind::TaggedUnion,
3590        wire: true,
3591    },
3592    TypeContract {
3593        name: "query",
3594        format_version: 1,
3595        kind: TypeKind::TaggedUnion,
3596        wire: true,
3597    },
3598    TypeContract {
3599        name: "histogram_bounds",
3600        format_version: 1,
3601        kind: TypeKind::Struct,
3602        wire: true,
3603    },
3604    TypeContract {
3605        name: "date_histogram_bounds",
3606        format_version: 1,
3607        kind: TypeKind::Struct,
3608        wire: true,
3609    },
3610    TypeContract {
3611        name: "approximation_algorithm",
3612        format_version: 1,
3613        kind: TypeKind::Enum,
3614        wire: true,
3615    },
3616    TypeContract {
3617        name: "approximation",
3618        format_version: 1,
3619        kind: TypeKind::Struct,
3620        wire: true,
3621    },
3622    TypeContract {
3623        name: "percentile_value",
3624        format_version: 1,
3625        kind: TypeKind::Struct,
3626        wire: true,
3627    },
3628    TypeContract {
3629        name: "approximate_percentile_value",
3630        format_version: 1,
3631        kind: TypeKind::Struct,
3632        wire: true,
3633    },
3634    TypeContract {
3635        name: "aggregation",
3636        format_version: 1,
3637        kind: TypeKind::TaggedUnion,
3638        wire: true,
3639    },
3640    TypeContract {
3641        name: "nested_search_hit",
3642        format_version: 1,
3643        kind: TypeKind::Struct,
3644        wire: true,
3645    },
3646    TypeContract {
3647        name: "named_nested_inner_hits_result",
3648        format_version: 1,
3649        kind: TypeKind::Struct,
3650        wire: true,
3651    },
3652    TypeContract {
3653        name: "search_hit",
3654        format_version: 1,
3655        kind: TypeKind::Struct,
3656        wire: true,
3657    },
3658    TypeContract {
3659        name: "aggregation_bucket",
3660        format_version: 1,
3661        kind: TypeKind::Struct,
3662        wire: true,
3663    },
3664    TypeContract {
3665        name: "aggregation_result",
3666        format_version: 1,
3667        kind: TypeKind::TaggedUnion,
3668        wire: true,
3669    },
3670    TypeContract {
3671        name: "shard_counts",
3672        format_version: 1,
3673        kind: TypeKind::Struct,
3674        wire: true,
3675    },
3676    TypeContract {
3677        name: "total_hits_relation",
3678        format_version: 1,
3679        kind: TypeKind::Enum,
3680        wire: true,
3681    },
3682    TypeContract {
3683        name: "search_total",
3684        format_version: 1,
3685        kind: TypeKind::Struct,
3686        wire: true,
3687    },
3688    TypeContract {
3689        name: "artifact",
3690        format_version: 1,
3691        kind: TypeKind::Struct,
3692        wire: true,
3693    },
3694    TypeContract {
3695        name: "operation",
3696        format_version: 1,
3697        kind: TypeKind::Struct,
3698        wire: true,
3699    },
3700    TypeContract {
3701        name: "submission_state",
3702        format_version: 1,
3703        kind: TypeKind::Enum,
3704        wire: true,
3705    },
3706    TypeContract {
3707        name: "expected_binding",
3708        format_version: 1,
3709        kind: TypeKind::Struct,
3710        wire: true,
3711    },
3712    TypeContract {
3713        name: "administration_alias_action",
3714        format_version: 1,
3715        kind: TypeKind::TaggedUnion,
3716        wire: true,
3717    },
3718    TypeContract {
3719        name: "administration_mutation",
3720        format_version: 1,
3721        kind: TypeKind::TaggedUnion,
3722        wire: true,
3723    },
3724    TypeContract {
3725        name: "administration_outcome",
3726        format_version: 1,
3727        kind: TypeKind::Struct,
3728        wire: true,
3729    },
3730    TypeContract {
3731        name: "index_change_apply_receipt",
3732        format_version: 1,
3733        kind: TypeKind::Struct,
3734        wire: true,
3735    },
3736    TypeContract {
3737        name: "backup_encryption_policy",
3738        format_version: 1,
3739        kind: TypeKind::Struct,
3740        wire: true,
3741    },
3742    TypeContract {
3743        name: "backup_create_outcome",
3744        format_version: 1,
3745        kind: TypeKind::Struct,
3746        wire: true,
3747    },
3748    TypeContract {
3749        name: "bulk_document_item",
3750        format_version: 1,
3751        kind: TypeKind::Struct,
3752        wire: true,
3753    },
3754    TypeContract {
3755        name: "bulk_document_item_outcome",
3756        format_version: 1,
3757        kind: TypeKind::Struct,
3758        wire: true,
3759    },
3760    TypeContract {
3761        name: "bulk_document_outcome",
3762        format_version: 1,
3763        kind: TypeKind::Struct,
3764        wire: true,
3765    },
3766    TypeContract {
3767        name: "retained_append_item",
3768        format_version: 1,
3769        kind: TypeKind::Struct,
3770        wire: true,
3771    },
3772    TypeContract {
3773        name: "retained_append_state",
3774        format_version: 1,
3775        kind: TypeKind::Enum,
3776        wire: true,
3777    },
3778    TypeContract {
3779        name: "retained_append_retry_safety",
3780        format_version: 1,
3781        kind: TypeKind::Enum,
3782        wire: true,
3783    },
3784    TypeContract {
3785        name: "retained_append_item_outcome",
3786        format_version: 1,
3787        kind: TypeKind::Struct,
3788        wire: true,
3789    },
3790    TypeContract {
3791        name: "retained_append_bulk_outcome",
3792        format_version: 1,
3793        kind: TypeKind::Struct,
3794        wire: true,
3795    },
3796    TypeContract {
3797        name: "retained_append_observation_state",
3798        format_version: 1,
3799        kind: TypeKind::Enum,
3800        wire: true,
3801    },
3802    TypeContract {
3803        name: "retained_append_observation_outcome",
3804        format_version: 1,
3805        kind: TypeKind::Struct,
3806        wire: true,
3807    },
3808    TypeContract {
3809        name: "binary_value",
3810        format_version: 1,
3811        kind: TypeKind::Struct,
3812        wire: true,
3813    },
3814    TypeContract {
3815        name: "state_hash_field",
3816        format_version: 1,
3817        kind: TypeKind::Struct,
3818        wire: true,
3819    },
3820    TypeContract {
3821        name: "state_set_entry",
3822        format_version: 1,
3823        kind: TypeKind::Struct,
3824        wire: true,
3825    },
3826    TypeContract {
3827        name: "state_set_condition",
3828        format_version: 1,
3829        kind: TypeKind::Enum,
3830        wire: true,
3831    },
3832    TypeContract {
3833        name: "state_operation",
3834        format_version: 1,
3835        kind: TypeKind::TaggedUnion,
3836        wire: true,
3837    },
3838    TypeContract {
3839        name: "state_optional_value",
3840        format_version: 1,
3841        kind: TypeKind::TaggedUnion,
3842        wire: true,
3843    },
3844    TypeContract {
3845        name: "state_command_result",
3846        format_version: 1,
3847        kind: TypeKind::TaggedUnion,
3848        wire: true,
3849    },
3850    TypeContract {
3851        name: "state_write_resolution",
3852        format_version: 1,
3853        kind: TypeKind::TaggedUnion,
3854        wire: true,
3855    },
3856    TypeContract {
3857        name: "service_credential_reservation",
3858        format_version: 1,
3859        kind: TypeKind::Struct,
3860        wire: true,
3861    },
3862    TypeContract {
3863        name: "subscription_metadata_field",
3864        format_version: 1,
3865        kind: TypeKind::Enum,
3866        wire: true,
3867    },
3868    TypeContract {
3869        name: "subscription_field",
3870        format_version: 1,
3871        kind: TypeKind::TaggedUnion,
3872        wire: true,
3873    },
3874    TypeContract {
3875        name: "subscription_filter",
3876        format_version: 1,
3877        kind: TypeKind::TaggedUnion,
3878        wire: true,
3879    },
3880    TypeContract {
3881        name: "subscription_cursor_entry",
3882        format_version: 1,
3883        kind: TypeKind::Struct,
3884        wire: true,
3885    },
3886    TypeContract {
3887        name: "subscription_route",
3888        format_version: 1,
3889        kind: TypeKind::Struct,
3890        wire: true,
3891    },
3892    TypeContract {
3893        name: "subscription_start_position",
3894        format_version: 1,
3895        kind: TypeKind::TaggedUnion,
3896        wire: true,
3897    },
3898    TypeContract {
3899        name: "subscription_start",
3900        format_version: 1,
3901        kind: TypeKind::Struct,
3902        wire: true,
3903    },
3904    TypeContract {
3905        name: "subscription_accepted",
3906        format_version: 1,
3907        kind: TypeKind::Struct,
3908        wire: true,
3909    },
3910    TypeContract {
3911        name: "subscription_writer_fence",
3912        format_version: 1,
3913        kind: TypeKind::Struct,
3914        wire: true,
3915    },
3916    TypeContract {
3917        name: "subscription_event",
3918        format_version: 1,
3919        kind: TypeKind::Struct,
3920        wire: true,
3921    },
3922    TypeContract {
3923        name: "subscription_heartbeat",
3924        format_version: 1,
3925        kind: TypeKind::Struct,
3926        wire: true,
3927    },
3928    TypeContract {
3929        name: "subscription_gap",
3930        format_version: 1,
3931        kind: TypeKind::Struct,
3932        wire: true,
3933    },
3934    TypeContract {
3935        name: "subscription_terminal",
3936        format_version: 1,
3937        kind: TypeKind::Struct,
3938        wire: true,
3939    },
3940    TypeContract {
3941        name: "subscription_frame",
3942        format_version: 1,
3943        kind: TypeKind::TaggedUnion,
3944        wire: true,
3945    },
3946    TypeContract {
3947        name: "stream_binding",
3948        format_version: 1,
3949        kind: TypeKind::Struct,
3950        wire: true,
3951    },
3952    TypeContract {
3953        name: "capability_grant",
3954        format_version: 1,
3955        kind: TypeKind::Struct,
3956        wire: true,
3957    },
3958    TypeContract {
3959        name: "protocol_limit",
3960        format_version: 1,
3961        kind: TypeKind::Struct,
3962        wire: true,
3963    },
3964    TypeContract {
3965        name: "document_mutation_condition",
3966        format_version: 1,
3967        kind: TypeKind::TaggedUnion,
3968        wire: true,
3969    },
3970    TypeContract {
3971        name: "audit_event",
3972        format_version: 1,
3973        kind: TypeKind::Struct,
3974        wire: true,
3975    },
3976    TypeContract {
3977        name: "audit_gap",
3978        format_version: 1,
3979        kind: TypeKind::Struct,
3980        wire: true,
3981    },
3982    TypeContract {
3983        name: "service_credential_grant",
3984        format_version: 1,
3985        kind: TypeKind::Struct,
3986        wire: true,
3987    },
3988    TypeContract {
3989        name: "service_credential_summary",
3990        format_version: 1,
3991        kind: TypeKind::Struct,
3992        wire: true,
3993    },
3994    TypeContract {
3995        name: "security_role",
3996        format_version: 1,
3997        kind: TypeKind::Struct,
3998        wire: true,
3999    },
4000    TypeContract {
4001        name: "role_append_scope_change",
4002        format_version: 1,
4003        kind: TypeKind::TaggedUnion,
4004        wire: true,
4005    },
4006    TypeContract {
4007        name: "role_append_access_preparation",
4008        format_version: 1,
4009        kind: TypeKind::TaggedUnion,
4010        wire: true,
4011    },
4012    TypeContract {
4013        name: "security_action_outcome",
4014        format_version: 1,
4015        kind: TypeKind::TaggedUnion,
4016        wire: true,
4017    },
4018    TypeContract {
4019        name: "maintenance_work_state",
4020        format_version: 1,
4021        kind: TypeKind::Enum,
4022        wire: true,
4023    },
4024    TypeContract {
4025        name: "maintenance_attempt_state",
4026        format_version: 1,
4027        kind: TypeKind::Enum,
4028        wire: true,
4029    },
4030    TypeContract {
4031        name: "maintenance_failure_class",
4032        format_version: 1,
4033        kind: TypeKind::Enum,
4034        wire: true,
4035    },
4036    TypeContract {
4037        name: "maintenance_failure_class_count",
4038        format_version: 1,
4039        kind: TypeKind::Struct,
4040        wire: true,
4041    },
4042    TypeContract {
4043        name: "maintenance_attempt_observation",
4044        format_version: 1,
4045        kind: TypeKind::Struct,
4046        wire: true,
4047    },
4048    TypeContract {
4049        name: "maintenance_task_scope",
4050        format_version: 1,
4051        kind: TypeKind::Struct,
4052        wire: true,
4053    },
4054    TypeContract {
4055        name: "maintenance_task_status",
4056        format_version: 1,
4057        kind: TypeKind::Struct,
4058        wire: true,
4059    },
4060    TypeContract {
4061        name: "maintenance_status_aggregate",
4062        format_version: 1,
4063        kind: TypeKind::Struct,
4064        wire: true,
4065    },
4066    TypeContract {
4067        name: "runtime_status_detail",
4068        format_version: 1,
4069        kind: TypeKind::Struct,
4070        wire: true,
4071    },
4072    TypeContract {
4073        name: "result_cache_status",
4074        format_version: 2,
4075        kind: TypeKind::Struct,
4076        wire: true,
4077    },
4078    TypeContract {
4079        name: "field_promotion_status",
4080        format_version: 1,
4081        kind: TypeKind::Struct,
4082        wire: true,
4083    },
4084    TypeContract {
4085        name: "overload_shard_status",
4086        format_version: 2,
4087        kind: TypeKind::Struct,
4088        wire: true,
4089    },
4090    TypeContract {
4091        name: "external_key_binding",
4092        format_version: 1,
4093        kind: TypeKind::Struct,
4094        wire: true,
4095    },
4096    TypeContract {
4097        name: "rollup_measure",
4098        format_version: 1,
4099        kind: TypeKind::TaggedUnion,
4100        wire: true,
4101    },
4102    TypeContract {
4103        name: "aggregate_then_delete_policy",
4104        format_version: 1,
4105        kind: TypeKind::Struct,
4106        wire: true,
4107    },
4108    TypeContract {
4109        name: "lifecycle_binding_status",
4110        format_version: 1,
4111        kind: TypeKind::Struct,
4112        wire: true,
4113    },
4114    TypeContract {
4115        name: "lifecycle_rollup_status",
4116        format_version: 1,
4117        kind: TypeKind::Struct,
4118        wire: true,
4119    },
4120    TypeContract {
4121        name: "lifecycle_status",
4122        format_version: 2,
4123        kind: TypeKind::Struct,
4124        wire: true,
4125    },
4126    TypeContract {
4127        name: "quota_limit",
4128        format_version: 1,
4129        kind: TypeKind::Struct,
4130        wire: true,
4131    },
4132    TypeContract {
4133        name: "quota_consumption",
4134        format_version: 1,
4135        kind: TypeKind::Struct,
4136        wire: true,
4137    },
4138    TypeContract {
4139        name: "quota_update",
4140        format_version: 1,
4141        kind: TypeKind::Struct,
4142        wire: true,
4143    },
4144    TypeContract {
4145        name: "core_binding",
4146        format_version: 2,
4147        kind: TypeKind::Struct,
4148        wire: true,
4149    },
4150    TypeContract {
4151        name: "readiness_observation",
4152        format_version: 1,
4153        kind: TypeKind::Struct,
4154        wire: true,
4155    },
4156    TypeContract {
4157        name: "usage_dimension",
4158        format_version: 1,
4159        kind: TypeKind::Struct,
4160        wire: true,
4161    },
4162    TypeContract {
4163        name: "physical_usage_value",
4164        format_version: 2,
4165        kind: TypeKind::Struct,
4166        wire: true,
4167    },
4168    TypeContract {
4169        name: "core_usage_units",
4170        format_version: 2,
4171        kind: TypeKind::Struct,
4172        wire: true,
4173    },
4174    TypeContract {
4175        name: "core_usage_correction",
4176        format_version: 2,
4177        kind: TypeKind::Struct,
4178        wire: true,
4179    },
4180    TypeContract {
4181        name: "error_detail",
4182        format_version: 1,
4183        kind: TypeKind::TaggedUnion,
4184        wire: true,
4185    },
4186    TypeContract {
4187        name: "connection_profile",
4188        format_version: 3,
4189        kind: TypeKind::Struct,
4190        wire: false,
4191    },
4192];
4193#[derive(Clone, Copy, Debug, Eq, PartialEq)]
4194pub struct StreamContract {
4195    pub name: &'static str,
4196    pub action: Action,
4197    pub transport: &'static str,
4198    pub service: &'static str,
4199    pub method: &'static str,
4200    pub auth_metadata: &'static str,
4201    pub auth_scheme: &'static str,
4202    pub semantic_format_version: u16,
4203    pub start_type: &'static str,
4204    pub frame_type: &'static str,
4205}
4206pub const LODESTONE_API_STREAM_CONTRACTS: &[StreamContract] = &[StreamContract {
4207    name: "subscription",
4208    action: Action::SubscriptionRead,
4209    transport: "grpc_tls",
4210    service: "lodestone.api.FilterSubscription",
4211    method: "/lodestone.api.FilterSubscription/Subscribe",
4212    auth_metadata: "authorization",
4213    auth_scheme: "ApiKey",
4214    semantic_format_version: 1,
4215    start_type: "subscription_start",
4216    frame_type: "subscription_frame",
4217}];
4218#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4219#[serde(deny_unknown_fields)]
4220pub struct ErrorBody {
4221    pub code: ErrorCode,
4222    pub message: String,
4223    pub retry_safe: bool,
4224    pub submitted: bool,
4225    pub details: Option<ErrorDetail>,
4226}
4227#[derive(Clone, Copy, Debug, Eq, PartialEq)]
4228pub enum ErrorShapeError {
4229    DetailCodeMismatch,
4230    RetryAfterOutOfRange,
4231}
4232pub fn validate_error_body(body: &ErrorBody) -> Result<(), ErrorShapeError> {
4233    let detail_matches = matches!(
4234        (&body.code, &body.details),
4235        (_, None)
4236            | (ErrorCode::Aborted, Some(ErrorDetail::Aborted { .. }))
4237            | (ErrorCode::DeadlineExceeded, Some(ErrorDetail::DeadlineExceeded { .. }))
4238            | (ErrorCode::InvalidRequest, Some(ErrorDetail::InvalidRequest { .. }))
4239            | (
4240                ErrorCode::UnsupportedVersion,
4241                Some(ErrorDetail::UnsupportedVersion { .. })
4242            )
4243            | (ErrorCode::Unauthenticated, Some(ErrorDetail::Unauthenticated))
4244            | (ErrorCode::PermissionDenied, Some(ErrorDetail::PermissionDenied { .. }))
4245            | (ErrorCode::NotFound, Some(ErrorDetail::NotFound { .. }))
4246            | (ErrorCode::Conflict, Some(ErrorDetail::Conflict { .. }))
4247            | (ErrorCode::StaleCursor, Some(ErrorDetail::StaleCursor { .. }))
4248            | (
4249                ErrorCode::RestartBudgetExhausted,
4250                Some(ErrorDetail::RestartBudgetExhausted { .. })
4251            )
4252            | (ErrorCode::LimitExceeded, Some(ErrorDetail::LimitExceeded { .. }))
4253            | (
4254                ErrorCode::CapabilityUnavailable,
4255                Some(ErrorDetail::CapabilityUnavailable { .. })
4256            )
4257            | (ErrorCode::NotSubmitted, Some(ErrorDetail::NotSubmitted { .. }))
4258            | (
4259                ErrorCode::SubmittedIndeterminate,
4260                Some(ErrorDetail::SubmittedIndeterminate { .. })
4261            )
4262            | (ErrorCode::ExpiredUnknown, Some(ErrorDetail::ExpiredUnknown { .. }))
4263            | (ErrorCode::SecretNotEscrowed, Some(ErrorDetail::SecretNotEscrowed))
4264            | (ErrorCode::RetentionGap, Some(ErrorDetail::RetentionGap { .. }))
4265            | (
4266                ErrorCode::ArtifactRangeInvalid,
4267                Some(ErrorDetail::ArtifactRangeInvalid { .. })
4268            )
4269            | (ErrorCode::ChecksumMismatch, Some(ErrorDetail::ChecksumMismatch { .. }))
4270            | (
4271                ErrorCode::TemporarilyUnavailable,
4272                Some(ErrorDetail::TemporarilyUnavailable { .. })
4273            )
4274            | (ErrorCode::Internal, Some(ErrorDetail::Internal))
4275    );
4276    if !detail_matches {
4277        return Err(ErrorShapeError::DetailCodeMismatch);
4278    }
4279    let retry_after = match &body.details {
4280        Some(ErrorDetail::NotSubmitted { retry_after_millis })
4281        | Some(ErrorDetail::TemporarilyUnavailable { retry_after_millis }) => retry_after_millis.as_ref(),
4282        _ => None,
4283    };
4284    if retry_after
4285        .and_then(|value| value.value.parse::<u64>().ok())
4286        .is_some_and(|value| value > 60000)
4287    {
4288        return Err(ErrorShapeError::RetryAfterOutOfRange);
4289    }
4290    Ok(())
4291}
4292#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
4293#[serde(deny_unknown_fields)]
4294pub struct RequestMeta {
4295    pub format_version: u16,
4296    pub request_id: String,
4297    pub correlation_id: Identity,
4298    pub absolute_deadline_unix_millis: U64,
4299    pub workload_class: WorkloadClass,
4300}
4301
4302#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4303#[serde(deny_unknown_fields)]
4304pub struct DiscoverRequest {}
4305
4306#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4307#[serde(deny_unknown_fields)]
4308pub struct DiscoverResult {
4309    pub principal_id: Identity,
4310    pub collection_id: Identity,
4311    pub policy_revision: U64,
4312    pub artifact_version: String,
4313    pub schema_id: String,
4314    pub schema_digest: Digest,
4315    pub streams: Vec<StreamBinding>,
4316    pub capabilities: Vec<CapabilityGrant>,
4317    pub limits: Vec<ProtocolLimit>,
4318}
4319
4320#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4321#[serde(deny_unknown_fields)]
4322pub struct ListIndexesRequest {
4323    pub page_size: u32,
4324    #[serde(default, skip_serializing_if = "Option::is_none")]
4325    pub cursor: Option<Cursor>,
4326    #[serde(default, skip_serializing_if = "Option::is_none")]
4327    pub name_prefix: Option<String>,
4328    #[serde(default, skip_serializing_if = "Option::is_none")]
4329    pub mode: Option<String>,
4330    #[serde(default, skip_serializing_if = "Option::is_none")]
4331    pub state: Option<String>,
4332    pub restart_count: u32,
4333}
4334
4335#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4336#[serde(deny_unknown_fields)]
4337pub struct ListIndexesResult {
4338    pub items: Vec<IndexSummary>,
4339    #[serde(default, skip_serializing_if = "Option::is_none")]
4340    pub next_cursor: Option<Cursor>,
4341    pub restart_count: u32,
4342}
4343
4344#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4345#[serde(deny_unknown_fields)]
4346pub struct GetIndexRequest {
4347    pub name: String,
4348    #[serde(default, skip_serializing_if = "Option::is_none")]
4349    pub expected_incarnation: Option<Identity>,
4350}
4351
4352#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4353#[serde(deny_unknown_fields)]
4354pub struct GetIndexResult {
4355    pub resource: IndexDetail,
4356}
4357
4358#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4359#[serde(deny_unknown_fields)]
4360pub struct ValidateIndexChangeRequest {
4361    pub action_kind: String,
4362    pub name: String,
4363    #[serde(default, skip_serializing_if = "Option::is_none")]
4364    pub expected_incarnation: Option<Identity>,
4365    #[serde(default, skip_serializing_if = "Option::is_none")]
4366    pub expected_revision: Option<U64>,
4367    #[serde(default, skip_serializing_if = "Option::is_none")]
4368    pub mode: Option<String>,
4369    #[serde(default, skip_serializing_if = "Option::is_none")]
4370    pub mapping: Option<Mapping>,
4371    #[serde(default, skip_serializing_if = "Option::is_none")]
4372    pub policies: Option<IndexPolicies>,
4373}
4374
4375#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4376#[serde(deny_unknown_fields)]
4377pub struct ValidateIndexChangeResult {
4378    pub change_kind: String,
4379    pub fields_added: Vec<String>,
4380    pub policy_axes_changed: Vec<String>,
4381    pub required_capabilities: Vec<String>,
4382    pub catalog_revision: U64,
4383    pub policy_revision: U64,
4384}
4385
4386#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4387#[serde(deny_unknown_fields)]
4388pub struct ApplyIndexChangeRequest {
4389    pub action_id: Digest,
4390    pub index: Resource,
4391    pub expected_revision: U64,
4392    #[serde(default, skip_serializing_if = "Option::is_none")]
4393    pub mapping: Option<Mapping>,
4394    #[serde(default, skip_serializing_if = "Option::is_none")]
4395    pub policies: Option<IndexPolicies>,
4396}
4397
4398#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4399#[serde(deny_unknown_fields)]
4400pub struct ApplyIndexChangeResult {
4401    pub receipt: IndexChangeApplyReceipt,
4402}
4403
4404#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4405#[serde(deny_unknown_fields)]
4406pub struct ApplyAdministrationMutationRequest {
4407    pub action_id: Digest,
4408    pub expected_revision: U64,
4409    pub mutation: AdministrationMutation,
4410}
4411
4412#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4413#[serde(deny_unknown_fields)]
4414pub struct ApplyAdministrationMutationResult {
4415    pub outcome: AdministrationOutcome,
4416}
4417
4418#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4419#[serde(deny_unknown_fields)]
4420pub struct ListAliasesRequest {
4421    pub page_size: u32,
4422    #[serde(default, skip_serializing_if = "Option::is_none")]
4423    pub cursor: Option<Cursor>,
4424    #[serde(default, skip_serializing_if = "Option::is_none")]
4425    pub name_prefix: Option<String>,
4426    pub restart_count: u32,
4427}
4428
4429#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4430#[serde(deny_unknown_fields)]
4431pub struct ListAliasesResult {
4432    pub items: Vec<AliasSummary>,
4433    #[serde(default, skip_serializing_if = "Option::is_none")]
4434    pub next_cursor: Option<Cursor>,
4435    pub restart_count: u32,
4436}
4437
4438#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4439#[serde(deny_unknown_fields)]
4440pub struct GetAliasRequest {
4441    pub name: String,
4442}
4443
4444#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4445#[serde(deny_unknown_fields)]
4446pub struct GetAliasResult {
4447    pub resource: AliasDetail,
4448}
4449
4450#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4451#[serde(deny_unknown_fields)]
4452pub struct ListDataStreamsRequest {
4453    pub page_size: u32,
4454    #[serde(default, skip_serializing_if = "Option::is_none")]
4455    pub cursor: Option<Cursor>,
4456    #[serde(default, skip_serializing_if = "Option::is_none")]
4457    pub name_prefix: Option<String>,
4458    pub restart_count: u32,
4459}
4460
4461#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4462#[serde(deny_unknown_fields)]
4463pub struct ListDataStreamsResult {
4464    pub items: Vec<DataStreamSummary>,
4465    #[serde(default, skip_serializing_if = "Option::is_none")]
4466    pub next_cursor: Option<Cursor>,
4467    pub restart_count: u32,
4468}
4469
4470#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4471#[serde(deny_unknown_fields)]
4472pub struct GetDataStreamRequest {
4473    pub name: String,
4474}
4475
4476#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4477#[serde(deny_unknown_fields)]
4478pub struct GetDataStreamResult {
4479    pub resource: DataStreamDetail,
4480}
4481
4482#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4483#[serde(deny_unknown_fields)]
4484pub struct ListComponentTemplatesRequest {
4485    pub page_size: u32,
4486    #[serde(default, skip_serializing_if = "Option::is_none")]
4487    pub cursor: Option<Cursor>,
4488    #[serde(default, skip_serializing_if = "Option::is_none")]
4489    pub name_prefix: Option<String>,
4490    pub restart_count: u32,
4491}
4492
4493#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4494#[serde(deny_unknown_fields)]
4495pub struct ListComponentTemplatesResult {
4496    pub items: Vec<ComponentTemplateSummary>,
4497    #[serde(default, skip_serializing_if = "Option::is_none")]
4498    pub next_cursor: Option<Cursor>,
4499    pub restart_count: u32,
4500}
4501
4502#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4503#[serde(deny_unknown_fields)]
4504pub struct GetComponentTemplateRequest {
4505    pub name: String,
4506    #[serde(default, skip_serializing_if = "Option::is_none")]
4507    pub expected_incarnation: Option<Identity>,
4508}
4509
4510#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4511#[serde(deny_unknown_fields)]
4512pub struct GetComponentTemplateResult {
4513    pub resource: ComponentTemplateDetail,
4514}
4515
4516#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4517#[serde(deny_unknown_fields)]
4518pub struct ListIndexTemplatesRequest {
4519    pub page_size: u32,
4520    #[serde(default, skip_serializing_if = "Option::is_none")]
4521    pub cursor: Option<Cursor>,
4522    #[serde(default, skip_serializing_if = "Option::is_none")]
4523    pub name_prefix: Option<String>,
4524    pub restart_count: u32,
4525}
4526
4527#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4528#[serde(deny_unknown_fields)]
4529pub struct ListIndexTemplatesResult {
4530    pub items: Vec<IndexTemplateSummary>,
4531    #[serde(default, skip_serializing_if = "Option::is_none")]
4532    pub next_cursor: Option<Cursor>,
4533    pub restart_count: u32,
4534}
4535
4536#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4537#[serde(deny_unknown_fields)]
4538pub struct GetIndexTemplateRequest {
4539    pub name: String,
4540    #[serde(default, skip_serializing_if = "Option::is_none")]
4541    pub expected_incarnation: Option<Identity>,
4542}
4543
4544#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4545#[serde(deny_unknown_fields)]
4546pub struct GetIndexTemplateResult {
4547    pub resource: IndexTemplateDetail,
4548}
4549
4550#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4551#[serde(deny_unknown_fields)]
4552pub struct ListIngestPipelinesRequest {
4553    pub page_size: u32,
4554    #[serde(default, skip_serializing_if = "Option::is_none")]
4555    pub cursor: Option<Cursor>,
4556    #[serde(default, skip_serializing_if = "Option::is_none")]
4557    pub name_prefix: Option<String>,
4558    pub restart_count: u32,
4559}
4560
4561#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4562#[serde(deny_unknown_fields)]
4563pub struct ListIngestPipelinesResult {
4564    pub items: Vec<IngestPipelineSummary>,
4565    #[serde(default, skip_serializing_if = "Option::is_none")]
4566    pub next_cursor: Option<Cursor>,
4567    pub restart_count: u32,
4568}
4569
4570#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4571#[serde(deny_unknown_fields)]
4572pub struct GetIngestPipelineRequest {
4573    pub name: String,
4574    #[serde(default, skip_serializing_if = "Option::is_none")]
4575    pub expected_incarnation: Option<Identity>,
4576}
4577
4578#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4579#[serde(deny_unknown_fields)]
4580pub struct GetIngestPipelineResult {
4581    pub resource: IngestPipelineDetail,
4582}
4583
4584#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4585#[serde(deny_unknown_fields)]
4586pub struct SimulateIngestPipelineRequest {
4587    #[serde(default, skip_serializing_if = "Option::is_none")]
4588    pub name: Option<String>,
4589    #[serde(default, skip_serializing_if = "Option::is_none")]
4590    pub expected: Option<ExpectedBinding>,
4591    #[serde(default, skip_serializing_if = "Option::is_none")]
4592    pub definition: Option<RawJson>,
4593    pub source: RawJson,
4594}
4595
4596#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4597#[serde(deny_unknown_fields)]
4598pub struct SimulateIngestPipelineResult {
4599    #[serde(default, skip_serializing_if = "Option::is_none")]
4600    pub source: Option<RawJson>,
4601    pub dropped: bool,
4602    pub changed: bool,
4603}
4604
4605#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4606#[serde(deny_unknown_fields)]
4607pub struct ReprocessByQueryRequest {
4608    pub action_id: Digest,
4609    pub index: Resource,
4610    pub query: Query,
4611    #[serde(default, skip_serializing_if = "Option::is_none")]
4612    pub pipeline: Option<IngestPipelineSelection>,
4613    pub batch_size: u32,
4614    pub max_docs: U64,
4615    pub proceed_on_conflict: bool,
4616    pub slices: u32,
4617    pub requests_per_second: u32,
4618    pub wait_for_completion: bool,
4619}
4620
4621#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4622#[serde(deny_unknown_fields)]
4623pub struct ReprocessByQueryResult {
4624    pub task_id: Identity,
4625    pub scanned: U64,
4626    pub updated: U64,
4627    pub noops: U64,
4628    pub version_conflicts: U64,
4629    pub batches: U64,
4630    pub completed: bool,
4631}
4632
4633#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4634#[serde(deny_unknown_fields)]
4635pub struct ListLifecyclePoliciesRequest {
4636    pub page_size: u32,
4637    #[serde(default, skip_serializing_if = "Option::is_none")]
4638    pub cursor: Option<Cursor>,
4639    #[serde(default, skip_serializing_if = "Option::is_none")]
4640    pub name_prefix: Option<String>,
4641    pub restart_count: u32,
4642}
4643
4644#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4645#[serde(deny_unknown_fields)]
4646pub struct ListLifecyclePoliciesResult {
4647    pub items: Vec<LifecyclePolicySummary>,
4648    #[serde(default, skip_serializing_if = "Option::is_none")]
4649    pub next_cursor: Option<Cursor>,
4650    pub restart_count: u32,
4651}
4652
4653#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4654#[serde(deny_unknown_fields)]
4655pub struct GetLifecyclePolicyRequest {
4656    pub name: String,
4657}
4658
4659#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4660#[serde(deny_unknown_fields)]
4661pub struct GetLifecyclePolicyResult {
4662    pub resource: LifecyclePolicyDetail,
4663}
4664
4665#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4666#[serde(deny_unknown_fields)]
4667pub struct PrepareCreateIndexRequest {
4668    pub name: String,
4669    pub mapping: Mapping,
4670    #[serde(default, skip_serializing_if = "Option::is_none")]
4671    pub resource_spec: Option<IndexResourceSpec>,
4672    #[serde(default, skip_serializing_if = "Option::is_none")]
4673    pub retained_event_identity: Option<bool>,
4674}
4675
4676#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4677#[serde(deny_unknown_fields)]
4678pub struct PrepareCreateIndexResult {
4679    pub locator: Locator,
4680    pub expires_at: U64,
4681    pub semantic_digest: Digest,
4682    pub resource_spec: IndexResourceSpec,
4683}
4684
4685#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4686#[serde(deny_unknown_fields)]
4687pub struct PrepareDeleteIndexRequest {
4688    pub name: String,
4689    pub expected_incarnation: Identity,
4690}
4691
4692#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4693#[serde(deny_unknown_fields)]
4694pub struct PrepareDeleteIndexResult {
4695    #[serde(default, skip_serializing_if = "Option::is_none")]
4696    pub locator: Option<Locator>,
4697    #[serde(default, skip_serializing_if = "Option::is_none")]
4698    pub expires_at: Option<U64>,
4699    #[serde(default, skip_serializing_if = "Option::is_none")]
4700    pub semantic_digest: Option<Digest>,
4701    pub impact_digest: Digest,
4702    pub blockers: Vec<String>,
4703    pub scheduled_effects: Vec<String>,
4704    #[serde(default, skip_serializing_if = "Option::is_none")]
4705    pub estimated_documents: Option<U64>,
4706    #[serde(default, skip_serializing_if = "Option::is_none")]
4707    pub estimated_logical_bytes: Option<U64>,
4708}
4709
4710#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4711#[serde(deny_unknown_fields)]
4712pub struct SubmitCatalogActionRequest {
4713    pub locator: Locator,
4714    pub semantic_digest: Digest,
4715    pub action_kind: String,
4716    pub name: String,
4717    #[serde(default, skip_serializing_if = "Option::is_none")]
4718    pub mapping: Option<Mapping>,
4719    #[serde(default, skip_serializing_if = "Option::is_none")]
4720    pub resource_spec: Option<IndexResourceSpec>,
4721    #[serde(default, skip_serializing_if = "Option::is_none")]
4722    pub expected_incarnation: Option<Identity>,
4723}
4724
4725#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4726#[serde(deny_unknown_fields)]
4727pub struct SubmitCatalogActionResult {
4728    pub locator: Locator,
4729    pub state: String,
4730    pub submitted: bool,
4731}
4732
4733#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4734#[serde(deny_unknown_fields)]
4735pub struct ResolveCatalogActionRequest {
4736    pub locator: Locator,
4737}
4738
4739#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4740#[serde(deny_unknown_fields)]
4741pub struct ResolveCatalogActionResult {
4742    pub locator: Locator,
4743    pub state: String,
4744    #[serde(default, skip_serializing_if = "Option::is_none")]
4745    pub resource: Option<Resource>,
4746}
4747
4748#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4749#[serde(deny_unknown_fields)]
4750pub struct PrepareReplayableSourceIndexRequest {
4751    pub name: String,
4752    pub mapping: Mapping,
4753    #[serde(default, skip_serializing_if = "Option::is_none")]
4754    pub resource_spec: Option<IndexResourceSpec>,
4755    pub source: ReplayableSourceConfiguration,
4756}
4757
4758#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4759#[serde(deny_unknown_fields)]
4760pub struct PrepareReplayableSourceIndexResult {
4761    pub locator: Locator,
4762    pub expires_at: U64,
4763    pub semantic_digest: Digest,
4764    pub resource_spec: IndexResourceSpec,
4765}
4766
4767#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4768#[serde(deny_unknown_fields)]
4769pub struct SubmitReplayableSourceIndexRequest {
4770    pub locator: Locator,
4771    pub semantic_digest: Digest,
4772    pub name: String,
4773    pub mapping: Mapping,
4774    pub resource_spec: IndexResourceSpec,
4775    pub source: ReplayableSourceConfiguration,
4776}
4777
4778#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4779#[serde(deny_unknown_fields)]
4780pub struct SubmitReplayableSourceIndexResult {
4781    pub locator: Locator,
4782    pub state: String,
4783    pub submitted: bool,
4784}
4785
4786#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4787#[serde(deny_unknown_fields)]
4788pub struct GetReplayableSourceRequest {
4789    pub index: Resource,
4790}
4791
4792#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4793#[serde(deny_unknown_fields)]
4794pub struct GetReplayableSourceResult {
4795    pub status: ReplayableSourceStatus,
4796}
4797
4798#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4799#[serde(deny_unknown_fields)]
4800pub struct ControlReplayableSourceRequest {
4801    pub index: Resource,
4802    pub expected_generation: U64,
4803    pub transition: SourceControlTransition,
4804}
4805
4806#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4807#[serde(deny_unknown_fields)]
4808pub struct ControlReplayableSourceResult {
4809    pub status: ReplayableSourceStatus,
4810    pub submitted: bool,
4811}
4812
4813#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4814#[serde(deny_unknown_fields)]
4815pub struct CloneIndexRequest {
4816    pub source: Resource,
4817    pub destination_name: String,
4818    pub operation_id: Identity,
4819    pub source_cut_id: Identity,
4820}
4821
4822#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4823#[serde(deny_unknown_fields)]
4824pub struct CloneIndexResult {
4825    pub destination: Resource,
4826    pub source_cut_id: Identity,
4827    pub submitted: bool,
4828}
4829
4830#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4831#[serde(deny_unknown_fields)]
4832pub struct ConfigureHistoryRequest {
4833    pub index: Resource,
4834    pub precondition: HistoryLedgerPrecondition,
4835    pub policy: HistoryRetentionPolicy,
4836}
4837
4838#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4839#[serde(deny_unknown_fields)]
4840pub struct ConfigureHistoryResult {
4841    pub status: HistoryStatus,
4842    pub submitted: bool,
4843}
4844
4845#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4846#[serde(deny_unknown_fields)]
4847pub struct GetHistoryRequest {
4848    pub index: Resource,
4849}
4850
4851#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4852#[serde(deny_unknown_fields)]
4853pub struct GetHistoryResult {
4854    pub status: HistoryStatus,
4855}
4856
4857#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4858#[serde(deny_unknown_fields)]
4859pub struct ResolveHistoryRequest {
4860    pub index: Resource,
4861    pub selector: HistorySelector,
4862}
4863
4864#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4865#[serde(deny_unknown_fields)]
4866pub struct ResolveHistoryResult {
4867    pub resolution: HistoryResolution,
4868}
4869
4870#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4871#[serde(deny_unknown_fields)]
4872pub struct PlaceHistoryHoldRequest {
4873    pub index: Resource,
4874    pub expected_ledger_revision: U64,
4875    pub hold: HistoryHold,
4876}
4877
4878#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4879#[serde(deny_unknown_fields)]
4880pub struct PlaceHistoryHoldResult {
4881    pub status: HistoryStatus,
4882    pub submitted: bool,
4883}
4884
4885#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4886#[serde(deny_unknown_fields)]
4887pub struct ReleaseHistoryHoldRequest {
4888    pub index: Resource,
4889    pub expected_ledger_revision: U64,
4890    pub hold_id: Identity,
4891}
4892
4893#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4894#[serde(deny_unknown_fields)]
4895pub struct ReleaseHistoryHoldResult {
4896    pub status: HistoryStatus,
4897    pub submitted: bool,
4898}
4899
4900#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4901#[serde(deny_unknown_fields)]
4902pub struct PrepareDocumentMutationRequest {
4903    pub index: Resource,
4904    pub document_id: String,
4905    pub operation: String,
4906    #[serde(default, skip_serializing_if = "Option::is_none")]
4907    pub source: Option<RawJson>,
4908    #[serde(default, skip_serializing_if = "Option::is_none")]
4909    pub routing: Option<String>,
4910    #[serde(default, skip_serializing_if = "Option::is_none")]
4911    pub condition: Option<DocumentMutationCondition>,
4912    #[serde(default, skip_serializing_if = "Option::is_none")]
4913    pub pipeline: Option<IngestPipelineSelection>,
4914}
4915
4916#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4917#[serde(deny_unknown_fields)]
4918pub struct PrepareDocumentMutationResult {
4919    pub locator: Locator,
4920    pub semantic_digest: Digest,
4921    pub retention_max_entries: U64,
4922    pub retention_sequence_window: U64,
4923}
4924
4925#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4926#[serde(deny_unknown_fields)]
4927pub struct SubmitDocumentMutationRequest {
4928    pub locator: Locator,
4929    pub semantic_digest: Digest,
4930    pub index: Resource,
4931    pub document_id: String,
4932    pub operation: String,
4933    #[serde(default, skip_serializing_if = "Option::is_none")]
4934    pub source: Option<RawJson>,
4935    #[serde(default, skip_serializing_if = "Option::is_none")]
4936    pub routing: Option<String>,
4937    #[serde(default, skip_serializing_if = "Option::is_none")]
4938    pub condition: Option<DocumentMutationCondition>,
4939    #[serde(default, skip_serializing_if = "Option::is_none")]
4940    pub pipeline: Option<IngestPipelineSelection>,
4941}
4942
4943#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4944#[serde(deny_unknown_fields)]
4945pub struct SubmitDocumentMutationResult {
4946    pub locator: Locator,
4947    pub state: String,
4948    pub submitted: bool,
4949    #[serde(default, skip_serializing_if = "Option::is_none")]
4950    pub sequence: Option<U64>,
4951    #[serde(default, skip_serializing_if = "Option::is_none")]
4952    pub mapping_generation: Option<U64>,
4953    pub mapping_adopted: bool,
4954}
4955
4956#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4957#[serde(deny_unknown_fields)]
4958pub struct PrepareDocumentBulkRequest {
4959    pub batch_id: Digest,
4960    pub index: Resource,
4961    pub items: Vec<BulkDocumentItem>,
4962}
4963
4964#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4965#[serde(deny_unknown_fields)]
4966pub struct PrepareDocumentBulkResult {
4967    pub outcome: BulkDocumentOutcome,
4968}
4969
4970#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4971#[serde(deny_unknown_fields)]
4972pub struct SubmitDocumentBulkRequest {
4973    pub batch_id: Digest,
4974    pub index: Resource,
4975    pub items: Vec<BulkDocumentItem>,
4976    pub preparations: Vec<BulkDocumentItemOutcome>,
4977}
4978
4979#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4980#[serde(deny_unknown_fields)]
4981pub struct SubmitDocumentBulkResult {
4982    pub outcome: BulkDocumentOutcome,
4983}
4984
4985#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4986#[serde(deny_unknown_fields)]
4987pub struct ResolveDocumentBulkRequest {
4988    pub batch_id: Digest,
4989    pub index: Resource,
4990    pub items: Vec<BulkDocumentItemOutcome>,
4991}
4992
4993#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
4994#[serde(deny_unknown_fields)]
4995pub struct ResolveDocumentBulkResult {
4996    pub outcome: BulkDocumentOutcome,
4997}
4998
4999#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5000#[serde(deny_unknown_fields)]
5001pub struct PrepareAppendBulkRequest {
5002    pub batch_id: Digest,
5003    pub index: Resource,
5004    pub items: Vec<RetainedAppendItem>,
5005}
5006
5007#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5008#[serde(deny_unknown_fields)]
5009pub struct PrepareAppendBulkResult {
5010    pub outcome: RetainedAppendBulkOutcome,
5011}
5012
5013#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5014#[serde(deny_unknown_fields)]
5015pub struct SubmitAppendBulkRequest {
5016    pub batch_id: Digest,
5017    pub index: Resource,
5018    pub items: Vec<RetainedAppendItem>,
5019    pub preparations: Vec<RetainedAppendItemOutcome>,
5020}
5021
5022#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5023#[serde(deny_unknown_fields)]
5024pub struct SubmitAppendBulkResult {
5025    pub outcome: RetainedAppendBulkOutcome,
5026}
5027
5028#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5029#[serde(deny_unknown_fields)]
5030pub struct ResolveAppendBulkRequest {
5031    pub batch_id: Digest,
5032    pub index: Resource,
5033    pub items: Vec<RetainedAppendItemOutcome>,
5034}
5035
5036#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5037#[serde(deny_unknown_fields)]
5038pub struct ResolveAppendBulkResult {
5039    pub outcome: RetainedAppendBulkOutcome,
5040}
5041
5042#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5043#[serde(deny_unknown_fields)]
5044pub struct ObserveAppendCommittedRequest {
5045    pub index: Resource,
5046    pub locator: Locator,
5047}
5048
5049#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5050#[serde(deny_unknown_fields)]
5051pub struct ObserveAppendCommittedResult {
5052    pub outcome: RetainedAppendObservationOutcome,
5053}
5054
5055#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5056#[serde(deny_unknown_fields)]
5057pub struct ResolveDocumentMutationRequest {
5058    pub locator: Locator,
5059}
5060
5061#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5062#[serde(deny_unknown_fields)]
5063pub struct ResolveDocumentMutationResult {
5064    pub locator: Locator,
5065    pub state: String,
5066    #[serde(default, skip_serializing_if = "Option::is_none")]
5067    pub sequence: Option<U64>,
5068    #[serde(default, skip_serializing_if = "Option::is_none")]
5069    pub mapping_generation: Option<U64>,
5070    pub mapping_adopted: bool,
5071    #[serde(default, skip_serializing_if = "Option::is_none")]
5072    pub source: Option<RawJson>,
5073}
5074
5075#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5076#[serde(deny_unknown_fields)]
5077pub struct GetDocumentRequest {
5078    pub index: Resource,
5079    pub document_id: String,
5080    #[serde(default, skip_serializing_if = "Option::is_none")]
5081    pub routing: Option<String>,
5082}
5083
5084#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5085#[serde(deny_unknown_fields)]
5086pub struct GetDocumentResult {
5087    pub found: bool,
5088    #[serde(default, skip_serializing_if = "Option::is_none")]
5089    pub source: Option<RawJson>,
5090    #[serde(default, skip_serializing_if = "Option::is_none")]
5091    pub sequence: Option<U64>,
5092    #[serde(default, skip_serializing_if = "Option::is_none")]
5093    pub primary_term: Option<U64>,
5094}
5095
5096#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5097#[serde(deny_unknown_fields)]
5098pub struct SearchRequest {
5099    #[serde(default, skip_serializing_if = "Option::is_none")]
5100    pub indexes: Option<Vec<Resource>>,
5101    #[serde(default, skip_serializing_if = "Option::is_none")]
5102    pub query: Option<Query>,
5103    #[serde(default, skip_serializing_if = "Option::is_none")]
5104    pub aggregations: Option<Vec<Aggregation>>,
5105    pub sort: Vec<SortSpec>,
5106    #[serde(default, skip_serializing_if = "Option::is_none")]
5107    pub routing: Option<Vec<String>>,
5108    pub freshness: String,
5109    pub page_size: u32,
5110    #[serde(default, skip_serializing_if = "Option::is_none")]
5111    pub cursor: Option<Cursor>,
5112    #[serde(default, skip_serializing_if = "Option::is_none")]
5113    pub pit: Option<Cursor>,
5114    pub allow_partial: bool,
5115    #[serde(default, skip_serializing_if = "Option::is_none")]
5116    pub total_hits_threshold: Option<U64>,
5117}
5118
5119#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5120#[serde(deny_unknown_fields)]
5121pub struct SearchResult {
5122    pub hits: Vec<SearchHit>,
5123    pub aggregations: Vec<AggregationResult>,
5124    #[serde(default, skip_serializing_if = "Option::is_none")]
5125    pub next_cursor: Option<Cursor>,
5126    pub timed_out: bool,
5127    pub partial: bool,
5128    pub shards: ShardCounts,
5129    pub total: SearchTotal,
5130    pub failures: Vec<ErrorBody>,
5131}
5132
5133#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5134#[serde(deny_unknown_fields)]
5135pub struct OpenPitRequest {
5136    pub indexes: Vec<Resource>,
5137    pub keep_alive_millis: U64,
5138}
5139
5140#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5141#[serde(deny_unknown_fields)]
5142pub struct OpenPitResult {
5143    pub pit: Cursor,
5144    pub expires_at: U64,
5145    pub shard_count: u32,
5146}
5147
5148#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5149#[serde(deny_unknown_fields)]
5150pub struct RenewPitRequest {
5151    pub pit: Cursor,
5152    pub keep_alive_millis: U64,
5153}
5154
5155#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5156#[serde(deny_unknown_fields)]
5157pub struct RenewPitResult {
5158    pub pit: Cursor,
5159    pub expires_at: U64,
5160    pub shard_count: u32,
5161}
5162
5163#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5164#[serde(deny_unknown_fields)]
5165pub struct ClosePitRequest {
5166    pub pit: Cursor,
5167}
5168
5169#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5170#[serde(deny_unknown_fields)]
5171pub struct ClosePitResult {
5172    pub removed: bool,
5173}
5174
5175#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5176#[serde(deny_unknown_fields)]
5177pub struct ListOperationsRequest {
5178    pub page_size: u32,
5179    #[serde(default, skip_serializing_if = "Option::is_none")]
5180    pub cursor: Option<Cursor>,
5181}
5182
5183#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5184#[serde(deny_unknown_fields)]
5185pub struct ListOperationsResult {
5186    pub items: Vec<Operation>,
5187    #[serde(default, skip_serializing_if = "Option::is_none")]
5188    pub next_cursor: Option<Cursor>,
5189}
5190
5191#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5192#[serde(deny_unknown_fields)]
5193pub struct GetOperationRequest {
5194    pub locator: Locator,
5195}
5196
5197#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5198#[serde(deny_unknown_fields)]
5199pub struct GetOperationResult {
5200    pub operation: Operation,
5201}
5202
5203#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5204#[serde(deny_unknown_fields)]
5205pub struct CancelOperationRequest {
5206    pub locator: Locator,
5207    pub expected_authority_revision: U64,
5208    pub cancel_action: Identity,
5209}
5210
5211#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5212#[serde(deny_unknown_fields)]
5213pub struct CancelOperationResult {
5214    pub locator: Locator,
5215    pub cancel_generation: U64,
5216    pub submitted: bool,
5217}
5218
5219#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5220#[serde(deny_unknown_fields)]
5221pub struct ListAuditEventsRequest {
5222    pub start_time: U64,
5223    pub end_time: U64,
5224    pub actions: Vec<String>,
5225    pub page_size: u32,
5226    #[serde(default, skip_serializing_if = "Option::is_none")]
5227    pub cursor: Option<Cursor>,
5228}
5229
5230#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5231#[serde(deny_unknown_fields)]
5232pub struct ListAuditEventsResult {
5233    pub events: Vec<AuditEvent>,
5234    #[serde(default, skip_serializing_if = "Option::is_none")]
5235    pub next_cursor: Option<Cursor>,
5236    pub gaps: Vec<AuditGap>,
5237    pub object_reads: u32,
5238}
5239
5240#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5241#[serde(deny_unknown_fields)]
5242pub struct ExportAuditEventsRequest {
5243    pub start_time: U64,
5244    pub end_time: U64,
5245    pub actions: Vec<String>,
5246    pub page_size: u32,
5247    #[serde(default, skip_serializing_if = "Option::is_none")]
5248    pub cursor: Option<Cursor>,
5249}
5250
5251#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5252#[serde(deny_unknown_fields)]
5253pub struct ExportAuditEventsResult {
5254    pub events: Vec<AuditEvent>,
5255    #[serde(default, skip_serializing_if = "Option::is_none")]
5256    pub next_cursor: Option<Cursor>,
5257    pub gaps: Vec<AuditGap>,
5258    pub object_reads: u32,
5259}
5260
5261#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5262#[serde(deny_unknown_fields)]
5263pub struct ReserveServiceCredentialRequest {
5264    pub reservation_action_id: Digest,
5265    pub activation_action_id: Digest,
5266    pub role_grants: Vec<ServiceCredentialGrant>,
5267    pub credential_expires_at: U64,
5268    pub reservation_expires_at: U64,
5269}
5270
5271#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5272#[serde(deny_unknown_fields)]
5273pub struct ReserveServiceCredentialResult {
5274    pub reservation: ServiceCredentialReservation,
5275}
5276
5277#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5278#[serde(deny_unknown_fields)]
5279pub struct ReserveServiceCredentialRotationRequest {
5280    pub reservation_action_id: Digest,
5281    pub activation_action_id: Digest,
5282    pub current_api_key_id: Identity,
5283    pub expected_generation: U64,
5284    pub credential_expires_at: U64,
5285    pub overlap_until: U64,
5286    pub reservation_expires_at: U64,
5287}
5288
5289#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5290#[serde(deny_unknown_fields)]
5291pub struct ReserveServiceCredentialRotationResult {
5292    pub reservation: ServiceCredentialReservation,
5293}
5294
5295#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5296#[serde(deny_unknown_fields)]
5297pub struct ActivateServiceCredentialRequest {
5298    pub reservation: ServiceCredentialReservation,
5299    pub verifier: Digest,
5300}
5301
5302#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5303#[serde(deny_unknown_fields)]
5304pub struct ActivateServiceCredentialResult {
5305    pub locator: Locator,
5306    pub outcome: SecurityActionOutcome,
5307    pub secret_escrowed: bool,
5308}
5309
5310#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5311#[serde(deny_unknown_fields)]
5312pub struct ResolveServiceCredentialReservationRequest {
5313    pub reservation_action_id: Digest,
5314}
5315
5316#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5317#[serde(deny_unknown_fields)]
5318pub struct ResolveServiceCredentialReservationResult {
5319    pub state: String,
5320    #[serde(default, skip_serializing_if = "Option::is_none")]
5321    pub reservation: Option<ServiceCredentialReservation>,
5322    #[serde(default, skip_serializing_if = "Option::is_none")]
5323    pub outcome: Option<SecurityActionOutcome>,
5324}
5325
5326#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5327#[serde(deny_unknown_fields)]
5328pub struct PrepareRevokeServiceCredentialRequest {
5329    pub api_key_id: Identity,
5330    pub expected_generation: U64,
5331}
5332
5333#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5334#[serde(deny_unknown_fields)]
5335pub struct PrepareRevokeServiceCredentialResult {
5336    pub locator: Locator,
5337    pub semantic_digest: Digest,
5338    pub expires_at: U64,
5339}
5340
5341#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5342#[serde(deny_unknown_fields)]
5343pub struct RevokeServiceCredentialRequest {
5344    pub locator: Locator,
5345    pub api_key_id: Identity,
5346    pub expected_generation: U64,
5347}
5348
5349#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5350#[serde(deny_unknown_fields)]
5351pub struct RevokeServiceCredentialResult {
5352    pub locator: Locator,
5353    pub principal_id: Identity,
5354    pub api_key_id: Identity,
5355    pub state: String,
5356}
5357
5358#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5359#[serde(deny_unknown_fields)]
5360pub struct ResolveSecurityActionRequest {
5361    pub locator: Locator,
5362}
5363
5364#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5365#[serde(deny_unknown_fields)]
5366pub struct ResolveSecurityActionResult {
5367    pub locator: Locator,
5368    pub state: String,
5369    #[serde(default, skip_serializing_if = "Option::is_none")]
5370    pub result: Option<SecurityActionOutcome>,
5371    pub secret_escrowed: bool,
5372}
5373
5374#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5375#[serde(deny_unknown_fields)]
5376pub struct GetSecurityRoleRequest {
5377    pub role_name: String,
5378}
5379
5380#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5381#[serde(deny_unknown_fields)]
5382pub struct GetSecurityRoleResult {
5383    pub role: SecurityRole,
5384}
5385
5386#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5387#[serde(deny_unknown_fields)]
5388pub struct PrepareRoleAppendAccessChangeRequest {
5389    pub role_name: String,
5390    pub expected_role_version: U64,
5391    pub changes: Vec<RoleAppendScopeChange>,
5392}
5393
5394#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5395#[serde(deny_unknown_fields)]
5396pub struct PrepareRoleAppendAccessChangeResult {
5397    pub preparation: RoleAppendAccessPreparation,
5398}
5399
5400#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5401#[serde(deny_unknown_fields)]
5402pub struct SubmitRoleAppendAccessChangeRequest {
5403    pub locator: Locator,
5404    pub semantic_digest: Digest,
5405    pub role_name: String,
5406    pub expected_role_version: U64,
5407    pub changes: Vec<RoleAppendScopeChange>,
5408}
5409
5410#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5411#[serde(deny_unknown_fields)]
5412pub struct SubmitRoleAppendAccessChangeResult {
5413    pub locator: Locator,
5414    pub state: String,
5415    pub target_policy_revision: U64,
5416    pub role: SecurityRole,
5417}
5418
5419#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5420#[serde(deny_unknown_fields)]
5421pub struct ListServiceCredentialsRequest {
5422    pub page_size: u32,
5423    #[serde(default, skip_serializing_if = "Option::is_none")]
5424    pub cursor: Option<Cursor>,
5425}
5426
5427#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5428#[serde(deny_unknown_fields)]
5429pub struct ListServiceCredentialsResult {
5430    pub items: Vec<ServiceCredentialSummary>,
5431    #[serde(default, skip_serializing_if = "Option::is_none")]
5432    pub next_cursor: Option<Cursor>,
5433}
5434
5435#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5436#[serde(deny_unknown_fields)]
5437pub struct ListBackupsRequest {
5438    pub page_size: u32,
5439    #[serde(default, skip_serializing_if = "Option::is_none")]
5440    pub cursor: Option<Cursor>,
5441}
5442
5443#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5444#[serde(deny_unknown_fields)]
5445pub struct ListBackupsResult {
5446    pub items: Vec<Operation>,
5447    #[serde(default, skip_serializing_if = "Option::is_none")]
5448    pub next_cursor: Option<Cursor>,
5449}
5450
5451#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5452#[serde(deny_unknown_fields)]
5453pub struct GetBackupRequest {
5454    pub locator: Locator,
5455}
5456
5457#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5458#[serde(deny_unknown_fields)]
5459pub struct GetBackupResult {
5460    pub operation: Operation,
5461    pub artifacts: Vec<Artifact>,
5462}
5463
5464#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5465#[serde(deny_unknown_fields)]
5466pub struct CreateBackupRequest {
5467    pub action_id: Digest,
5468    pub encryption_policies: Vec<BackupEncryptionPolicy>,
5469}
5470
5471#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5472#[serde(deny_unknown_fields)]
5473pub struct CreateBackupResult {
5474    pub outcome: BackupCreateOutcome,
5475}
5476
5477#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5478#[serde(deny_unknown_fields)]
5479pub struct ResolveBackupActionRequest {
5480    pub action_id: Digest,
5481}
5482
5483#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5484#[serde(deny_unknown_fields)]
5485pub struct ResolveBackupActionResult {
5486    pub operation: Operation,
5487}
5488
5489#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5490#[serde(deny_unknown_fields)]
5491pub struct GetRuntimeStatusRequest {}
5492
5493#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5494#[serde(deny_unknown_fields)]
5495pub struct GetRuntimeStatusResult {
5496    pub ready: bool,
5497    pub recovery_era: Identity,
5498    pub catalog_revision: U64,
5499    pub policy_revision: U64,
5500    pub redacted: RuntimeStatusDetail,
5501}
5502
5503#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5504#[serde(deny_unknown_fields)]
5505pub struct GetResultCacheStatusRequest {}
5506
5507#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5508#[serde(deny_unknown_fields)]
5509pub struct GetResultCacheStatusResult {
5510    pub status: ResultCacheStatus,
5511}
5512
5513#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5514#[serde(deny_unknown_fields)]
5515pub struct GetFieldPromotionStatusRequest {
5516    pub index: Resource,
5517}
5518
5519#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5520#[serde(deny_unknown_fields)]
5521pub struct GetFieldPromotionStatusResult {
5522    pub status: FieldPromotionStatus,
5523}
5524
5525#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5526#[serde(deny_unknown_fields)]
5527pub struct GetOverloadStatusRequest {
5528    pub index: Resource,
5529}
5530
5531#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5532#[serde(deny_unknown_fields)]
5533pub struct GetOverloadStatusResult {
5534    pub runtime_observed: bool,
5535    pub shards: Vec<OverloadShardStatus>,
5536}
5537
5538#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5539#[serde(deny_unknown_fields)]
5540pub struct ConfigureExternalKeyRequest {
5541    pub index: Resource,
5542    pub expected_authority_revision: U64,
5543    pub binding: ExternalKeyBinding,
5544}
5545
5546#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5547#[serde(deny_unknown_fields)]
5548pub struct ConfigureExternalKeyResult {
5549    pub status: LifecycleStatus,
5550    pub submitted: bool,
5551}
5552
5553#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5554#[serde(deny_unknown_fields)]
5555pub struct RotateExternalKeyBindingRequest {
5556    pub index: Resource,
5557    pub expected_authority_revision: U64,
5558    pub predecessor_binding_id: Identity,
5559    pub binding: ExternalKeyBinding,
5560}
5561
5562#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5563#[serde(deny_unknown_fields)]
5564pub struct RotateExternalKeyBindingResult {
5565    pub status: LifecycleStatus,
5566    pub submitted: bool,
5567}
5568
5569#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5570#[serde(deny_unknown_fields)]
5571pub struct ConfigureAggregateThenDeleteRequest {
5572    pub index: Resource,
5573    pub expected_authority_revision: U64,
5574    pub policy: AggregateThenDeletePolicy,
5575}
5576
5577#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5578#[serde(deny_unknown_fields)]
5579pub struct ConfigureAggregateThenDeleteResult {
5580    pub status: LifecycleStatus,
5581    pub submitted: bool,
5582}
5583
5584#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5585#[serde(deny_unknown_fields)]
5586pub struct GetLifecycleStatusRequest {
5587    pub index: Resource,
5588}
5589
5590#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5591#[serde(deny_unknown_fields)]
5592pub struct GetLifecycleStatusResult {
5593    pub status: LifecycleStatus,
5594}
5595
5596#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5597#[serde(deny_unknown_fields)]
5598pub struct GetQuotaRequest {}
5599
5600#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5601#[serde(deny_unknown_fields)]
5602pub struct GetQuotaResult {
5603    pub revision: U64,
5604    pub limits: Vec<QuotaLimit>,
5605    pub usage: Vec<QuotaConsumption>,
5606}
5607
5608#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5609#[serde(deny_unknown_fields)]
5610pub struct UpdateQuotaRequest {
5611    pub expected_revision: U64,
5612    pub limits: Vec<QuotaLimit>,
5613}
5614
5615#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5616#[serde(deny_unknown_fields)]
5617pub struct UpdateQuotaResult {
5618    pub update: QuotaUpdate,
5619}
5620
5621#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5622#[serde(deny_unknown_fields)]
5623pub struct GetBindingRequest {}
5624
5625#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5626#[serde(deny_unknown_fields)]
5627pub struct GetBindingResult {
5628    pub binding: CoreBinding,
5629    pub derived: bool,
5630    pub revision: U64,
5631}
5632
5633#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5634#[serde(deny_unknown_fields)]
5635pub struct GetAdmissionStatusRequest {}
5636
5637#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5638#[serde(deny_unknown_fields)]
5639pub struct GetAdmissionStatusResult {
5640    pub state: String,
5641    pub revision: U64,
5642    pub converged: bool,
5643}
5644
5645#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5646#[serde(deny_unknown_fields)]
5647pub struct SetAdmissionRequest {
5648    pub expected_revision: U64,
5649    pub state: String,
5650}
5651
5652#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5653#[serde(deny_unknown_fields)]
5654pub struct SetAdmissionResult {
5655    pub state: String,
5656    pub revision: U64,
5657    pub converged: bool,
5658}
5659
5660#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5661#[serde(deny_unknown_fields)]
5662pub struct GetQuiesceStatusRequest {}
5663
5664#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5665#[serde(deny_unknown_fields)]
5666pub struct GetQuiesceStatusResult {
5667    pub ready: bool,
5668    pub blockers: Vec<String>,
5669    pub observations: Vec<ReadinessObservation>,
5670    pub recovery_era: Identity,
5671    pub observed_at: U64,
5672    pub expires_at: U64,
5673}
5674
5675#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5676#[serde(deny_unknown_fields)]
5677pub struct GetDecommissionReadinessRequest {}
5678
5679#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5680#[serde(deny_unknown_fields)]
5681pub struct GetDecommissionReadinessResult {
5682    pub ready: bool,
5683    pub blockers: Vec<String>,
5684    pub observations: Vec<ReadinessObservation>,
5685    pub recovery_era: Identity,
5686    pub observed_at: U64,
5687    pub expires_at: U64,
5688}
5689
5690#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5691#[serde(deny_unknown_fields)]
5692pub struct GetUpgradeReadinessRequest {}
5693
5694#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5695#[serde(deny_unknown_fields)]
5696pub struct GetUpgradeReadinessResult {
5697    pub ready: bool,
5698    pub blockers: Vec<String>,
5699    pub observations: Vec<ReadinessObservation>,
5700    pub recovery_era: Identity,
5701    pub observed_at: U64,
5702    pub expires_at: U64,
5703}
5704
5705#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5706#[serde(deny_unknown_fields)]
5707pub struct GetMaintenanceStatusRequest {
5708    pub page_size: u32,
5709    #[serde(default, skip_serializing_if = "Option::is_none")]
5710    pub cursor: Option<Cursor>,
5711    #[serde(default, skip_serializing_if = "Option::is_none")]
5712    pub index: Option<Resource>,
5713}
5714
5715#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5716#[serde(deny_unknown_fields)]
5717pub struct GetMaintenanceStatusResult {
5718    pub aggregate: MaintenanceStatusAggregate,
5719    pub items: Vec<MaintenanceTaskStatus>,
5720    #[serde(default, skip_serializing_if = "Option::is_none")]
5721    pub next_cursor: Option<Cursor>,
5722}
5723
5724#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5725#[serde(deny_unknown_fields)]
5726pub struct GetRestoreReadinessRequest {}
5727
5728#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5729#[serde(deny_unknown_fields)]
5730pub struct GetRestoreReadinessResult {
5731    pub ready: bool,
5732    pub blockers: Vec<String>,
5733    pub observations: Vec<ReadinessObservation>,
5734    pub recovery_era: Identity,
5735    pub observed_at: U64,
5736    pub expires_at: U64,
5737}
5738
5739#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5740#[serde(deny_unknown_fields)]
5741pub struct CreateDiagnosticRequest {
5742    pub scope: String,
5743    pub maximum_bytes: U64,
5744}
5745
5746#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5747#[serde(deny_unknown_fields)]
5748pub struct CreateDiagnosticResult {
5749    pub operation: Operation,
5750}
5751
5752#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5753#[serde(deny_unknown_fields)]
5754pub struct GetDiagnosticRequest {
5755    pub locator: Locator,
5756}
5757
5758#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5759#[serde(deny_unknown_fields)]
5760pub struct GetDiagnosticResult {
5761    pub operation: Operation,
5762    pub artifacts: Vec<Artifact>,
5763}
5764
5765#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5766#[serde(deny_unknown_fields)]
5767pub struct ReadArtifactChunkRequest {
5768    pub artifact: Artifact,
5769    pub offset: U64,
5770    pub length: u32,
5771}
5772
5773#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5774#[serde(deny_unknown_fields)]
5775pub struct ReadArtifactChunkResult {
5776    pub offset: U64,
5777    pub bytes_base64: String,
5778    pub chunk_sha256: String,
5779    pub artifact_sha256: String,
5780    pub complete: bool,
5781}
5782
5783#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5784#[serde(deny_unknown_fields)]
5785pub struct ExportUsageRequest {
5786    pub window_start: U64,
5787    pub window_end: U64,
5788    pub page_size: u32,
5789    #[serde(default, skip_serializing_if = "Option::is_none")]
5790    pub cursor: Option<Cursor>,
5791}
5792
5793#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5794#[serde(deny_unknown_fields)]
5795pub struct ExportUsageResult {
5796    pub units: Vec<CoreUsageUnits>,
5797    pub corrections: Vec<CoreUsageCorrection>,
5798    #[serde(default, skip_serializing_if = "Option::is_none")]
5799    pub next_cursor: Option<Cursor>,
5800    pub cumulative_through: U64,
5801}
5802
5803#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5804#[serde(deny_unknown_fields)]
5805pub struct ExecuteStateReadRequest {
5806    pub index: Resource,
5807    pub operation: StateOperation,
5808}
5809
5810#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5811#[serde(deny_unknown_fields)]
5812pub struct ExecuteStateReadResult {
5813    pub result: StateCommandResult,
5814}
5815
5816#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5817#[serde(deny_unknown_fields)]
5818pub struct PrepareStateWriteRequest {
5819    pub index: Resource,
5820    pub action_id: Digest,
5821    pub operation: StateOperation,
5822}
5823
5824#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5825#[serde(deny_unknown_fields)]
5826pub struct PrepareStateWriteResult {
5827    pub locator: Locator,
5828    pub semantic_digest: Digest,
5829    pub retention_max_entries: U64,
5830    pub retention_sequence_window: U64,
5831}
5832
5833#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5834#[serde(deny_unknown_fields)]
5835pub struct SubmitStateWriteRequest {
5836    pub index: Resource,
5837    pub action_id: Digest,
5838    pub operation: StateOperation,
5839    pub locator: Locator,
5840    pub semantic_digest: Digest,
5841}
5842
5843#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5844#[serde(deny_unknown_fields)]
5845pub struct SubmitStateWriteResult {
5846    #[serde(default, skip_serializing_if = "Option::is_none")]
5847    pub result: Option<StateCommandResult>,
5848    #[serde(default, skip_serializing_if = "Option::is_none")]
5849    pub resolution: Option<StateWriteResolution>,
5850    pub submitted: bool,
5851}
5852
5853#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5854#[serde(deny_unknown_fields)]
5855pub struct ResolveStateWriteRequest {
5856    pub index: Resource,
5857    pub action_id: Digest,
5858    pub operation: StateOperation,
5859    pub locator: Locator,
5860    pub semantic_digest: Digest,
5861}
5862
5863#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5864#[serde(deny_unknown_fields)]
5865pub struct ResolveStateWriteResult {
5866    pub resolution: StateWriteResolution,
5867}
5868
5869#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5870#[serde(tag = "command", content = "body", rename_all = "snake_case")]
5871pub enum RequestBody {
5872    Discover(DiscoverRequest),
5873    ListIndexes(ListIndexesRequest),
5874    GetIndex(GetIndexRequest),
5875    ValidateIndexChange(ValidateIndexChangeRequest),
5876    ApplyIndexChange(ApplyIndexChangeRequest),
5877    ApplyAdministrationMutation(ApplyAdministrationMutationRequest),
5878    ListAliases(ListAliasesRequest),
5879    GetAlias(GetAliasRequest),
5880    ListDataStreams(ListDataStreamsRequest),
5881    GetDataStream(GetDataStreamRequest),
5882    ListComponentTemplates(ListComponentTemplatesRequest),
5883    GetComponentTemplate(GetComponentTemplateRequest),
5884    ListIndexTemplates(ListIndexTemplatesRequest),
5885    GetIndexTemplate(GetIndexTemplateRequest),
5886    ListIngestPipelines(ListIngestPipelinesRequest),
5887    GetIngestPipeline(GetIngestPipelineRequest),
5888    SimulateIngestPipeline(SimulateIngestPipelineRequest),
5889    ReprocessByQuery(ReprocessByQueryRequest),
5890    ListLifecyclePolicies(ListLifecyclePoliciesRequest),
5891    GetLifecyclePolicy(GetLifecyclePolicyRequest),
5892    PrepareCreateIndex(PrepareCreateIndexRequest),
5893    PrepareDeleteIndex(PrepareDeleteIndexRequest),
5894    SubmitCatalogAction(SubmitCatalogActionRequest),
5895    ResolveCatalogAction(ResolveCatalogActionRequest),
5896    PrepareReplayableSourceIndex(PrepareReplayableSourceIndexRequest),
5897    SubmitReplayableSourceIndex(SubmitReplayableSourceIndexRequest),
5898    GetReplayableSource(GetReplayableSourceRequest),
5899    ControlReplayableSource(ControlReplayableSourceRequest),
5900    CloneIndex(CloneIndexRequest),
5901    ConfigureHistory(ConfigureHistoryRequest),
5902    GetHistory(GetHistoryRequest),
5903    ResolveHistory(ResolveHistoryRequest),
5904    PlaceHistoryHold(PlaceHistoryHoldRequest),
5905    ReleaseHistoryHold(ReleaseHistoryHoldRequest),
5906    PrepareDocumentMutation(PrepareDocumentMutationRequest),
5907    SubmitDocumentMutation(SubmitDocumentMutationRequest),
5908    PrepareDocumentBulk(PrepareDocumentBulkRequest),
5909    SubmitDocumentBulk(SubmitDocumentBulkRequest),
5910    ResolveDocumentBulk(ResolveDocumentBulkRequest),
5911    PrepareAppendBulk(PrepareAppendBulkRequest),
5912    SubmitAppendBulk(SubmitAppendBulkRequest),
5913    ResolveAppendBulk(ResolveAppendBulkRequest),
5914    ObserveAppendCommitted(ObserveAppendCommittedRequest),
5915    ResolveDocumentMutation(ResolveDocumentMutationRequest),
5916    GetDocument(GetDocumentRequest),
5917    Search(SearchRequest),
5918    OpenPit(OpenPitRequest),
5919    RenewPit(RenewPitRequest),
5920    ClosePit(ClosePitRequest),
5921    ListOperations(ListOperationsRequest),
5922    GetOperation(GetOperationRequest),
5923    CancelOperation(CancelOperationRequest),
5924    ListAuditEvents(ListAuditEventsRequest),
5925    ExportAuditEvents(ExportAuditEventsRequest),
5926    ReserveServiceCredential(ReserveServiceCredentialRequest),
5927    ReserveServiceCredentialRotation(ReserveServiceCredentialRotationRequest),
5928    ActivateServiceCredential(ActivateServiceCredentialRequest),
5929    ResolveServiceCredentialReservation(ResolveServiceCredentialReservationRequest),
5930    PrepareRevokeServiceCredential(PrepareRevokeServiceCredentialRequest),
5931    RevokeServiceCredential(RevokeServiceCredentialRequest),
5932    ResolveSecurityAction(ResolveSecurityActionRequest),
5933    GetSecurityRole(GetSecurityRoleRequest),
5934    PrepareRoleAppendAccessChange(PrepareRoleAppendAccessChangeRequest),
5935    SubmitRoleAppendAccessChange(SubmitRoleAppendAccessChangeRequest),
5936    ListServiceCredentials(ListServiceCredentialsRequest),
5937    ListBackups(ListBackupsRequest),
5938    GetBackup(GetBackupRequest),
5939    CreateBackup(CreateBackupRequest),
5940    ResolveBackupAction(ResolveBackupActionRequest),
5941    GetRuntimeStatus(GetRuntimeStatusRequest),
5942    GetResultCacheStatus(GetResultCacheStatusRequest),
5943    GetFieldPromotionStatus(GetFieldPromotionStatusRequest),
5944    GetOverloadStatus(GetOverloadStatusRequest),
5945    ConfigureExternalKey(ConfigureExternalKeyRequest),
5946    RotateExternalKeyBinding(RotateExternalKeyBindingRequest),
5947    ConfigureAggregateThenDelete(ConfigureAggregateThenDeleteRequest),
5948    GetLifecycleStatus(GetLifecycleStatusRequest),
5949    GetQuota(GetQuotaRequest),
5950    UpdateQuota(UpdateQuotaRequest),
5951    GetBinding(GetBindingRequest),
5952    GetAdmissionStatus(GetAdmissionStatusRequest),
5953    SetAdmission(SetAdmissionRequest),
5954    GetQuiesceStatus(GetQuiesceStatusRequest),
5955    GetDecommissionReadiness(GetDecommissionReadinessRequest),
5956    GetUpgradeReadiness(GetUpgradeReadinessRequest),
5957    GetMaintenanceStatus(GetMaintenanceStatusRequest),
5958    GetRestoreReadiness(GetRestoreReadinessRequest),
5959    CreateDiagnostic(CreateDiagnosticRequest),
5960    GetDiagnostic(GetDiagnosticRequest),
5961    ReadArtifactChunk(ReadArtifactChunkRequest),
5962    ExportUsage(ExportUsageRequest),
5963    ExecuteStateRead(ExecuteStateReadRequest),
5964    PrepareStateWrite(PrepareStateWriteRequest),
5965    SubmitStateWrite(SubmitStateWriteRequest),
5966    ResolveStateWrite(ResolveStateWriteRequest),
5967}
5968
5969// INVARIANT: the response envelope already boxes this closed wire union; boxing
5970// individual variants would add a second allocation without changing the wire.
5971#[allow(clippy::large_enum_variant)]
5972#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
5973#[serde(tag = "command", content = "body", rename_all = "snake_case")]
5974pub enum ResultBody {
5975    Discover(DiscoverResult),
5976    ListIndexes(ListIndexesResult),
5977    GetIndex(GetIndexResult),
5978    ValidateIndexChange(ValidateIndexChangeResult),
5979    ApplyIndexChange(ApplyIndexChangeResult),
5980    ApplyAdministrationMutation(ApplyAdministrationMutationResult),
5981    ListAliases(ListAliasesResult),
5982    GetAlias(GetAliasResult),
5983    ListDataStreams(ListDataStreamsResult),
5984    GetDataStream(GetDataStreamResult),
5985    ListComponentTemplates(ListComponentTemplatesResult),
5986    GetComponentTemplate(GetComponentTemplateResult),
5987    ListIndexTemplates(ListIndexTemplatesResult),
5988    GetIndexTemplate(GetIndexTemplateResult),
5989    ListIngestPipelines(ListIngestPipelinesResult),
5990    GetIngestPipeline(GetIngestPipelineResult),
5991    SimulateIngestPipeline(SimulateIngestPipelineResult),
5992    ReprocessByQuery(ReprocessByQueryResult),
5993    ListLifecyclePolicies(ListLifecyclePoliciesResult),
5994    GetLifecyclePolicy(GetLifecyclePolicyResult),
5995    PrepareCreateIndex(PrepareCreateIndexResult),
5996    PrepareDeleteIndex(PrepareDeleteIndexResult),
5997    SubmitCatalogAction(SubmitCatalogActionResult),
5998    ResolveCatalogAction(ResolveCatalogActionResult),
5999    PrepareReplayableSourceIndex(PrepareReplayableSourceIndexResult),
6000    SubmitReplayableSourceIndex(SubmitReplayableSourceIndexResult),
6001    GetReplayableSource(GetReplayableSourceResult),
6002    ControlReplayableSource(ControlReplayableSourceResult),
6003    CloneIndex(CloneIndexResult),
6004    ConfigureHistory(ConfigureHistoryResult),
6005    GetHistory(GetHistoryResult),
6006    ResolveHistory(ResolveHistoryResult),
6007    PlaceHistoryHold(PlaceHistoryHoldResult),
6008    ReleaseHistoryHold(ReleaseHistoryHoldResult),
6009    PrepareDocumentMutation(PrepareDocumentMutationResult),
6010    SubmitDocumentMutation(SubmitDocumentMutationResult),
6011    PrepareDocumentBulk(PrepareDocumentBulkResult),
6012    SubmitDocumentBulk(SubmitDocumentBulkResult),
6013    ResolveDocumentBulk(ResolveDocumentBulkResult),
6014    PrepareAppendBulk(PrepareAppendBulkResult),
6015    SubmitAppendBulk(SubmitAppendBulkResult),
6016    ResolveAppendBulk(ResolveAppendBulkResult),
6017    ObserveAppendCommitted(ObserveAppendCommittedResult),
6018    ResolveDocumentMutation(ResolveDocumentMutationResult),
6019    GetDocument(GetDocumentResult),
6020    Search(SearchResult),
6021    OpenPit(OpenPitResult),
6022    RenewPit(RenewPitResult),
6023    ClosePit(ClosePitResult),
6024    ListOperations(ListOperationsResult),
6025    GetOperation(GetOperationResult),
6026    CancelOperation(CancelOperationResult),
6027    ListAuditEvents(ListAuditEventsResult),
6028    ExportAuditEvents(ExportAuditEventsResult),
6029    ReserveServiceCredential(ReserveServiceCredentialResult),
6030    ReserveServiceCredentialRotation(ReserveServiceCredentialRotationResult),
6031    ActivateServiceCredential(ActivateServiceCredentialResult),
6032    ResolveServiceCredentialReservation(ResolveServiceCredentialReservationResult),
6033    PrepareRevokeServiceCredential(PrepareRevokeServiceCredentialResult),
6034    RevokeServiceCredential(RevokeServiceCredentialResult),
6035    ResolveSecurityAction(ResolveSecurityActionResult),
6036    GetSecurityRole(GetSecurityRoleResult),
6037    PrepareRoleAppendAccessChange(PrepareRoleAppendAccessChangeResult),
6038    SubmitRoleAppendAccessChange(SubmitRoleAppendAccessChangeResult),
6039    ListServiceCredentials(ListServiceCredentialsResult),
6040    ListBackups(ListBackupsResult),
6041    GetBackup(GetBackupResult),
6042    CreateBackup(CreateBackupResult),
6043    ResolveBackupAction(ResolveBackupActionResult),
6044    GetRuntimeStatus(GetRuntimeStatusResult),
6045    GetResultCacheStatus(GetResultCacheStatusResult),
6046    GetFieldPromotionStatus(GetFieldPromotionStatusResult),
6047    GetOverloadStatus(GetOverloadStatusResult),
6048    ConfigureExternalKey(ConfigureExternalKeyResult),
6049    RotateExternalKeyBinding(RotateExternalKeyBindingResult),
6050    ConfigureAggregateThenDelete(ConfigureAggregateThenDeleteResult),
6051    GetLifecycleStatus(GetLifecycleStatusResult),
6052    GetQuota(GetQuotaResult),
6053    UpdateQuota(UpdateQuotaResult),
6054    GetBinding(GetBindingResult),
6055    GetAdmissionStatus(GetAdmissionStatusResult),
6056    SetAdmission(SetAdmissionResult),
6057    GetQuiesceStatus(GetQuiesceStatusResult),
6058    GetDecommissionReadiness(GetDecommissionReadinessResult),
6059    GetUpgradeReadiness(GetUpgradeReadinessResult),
6060    GetMaintenanceStatus(GetMaintenanceStatusResult),
6061    GetRestoreReadiness(GetRestoreReadinessResult),
6062    CreateDiagnostic(CreateDiagnosticResult),
6063    GetDiagnostic(GetDiagnosticResult),
6064    ReadArtifactChunk(ReadArtifactChunkResult),
6065    ExportUsage(ExportUsageResult),
6066    ExecuteStateRead(ExecuteStateReadResult),
6067    PrepareStateWrite(PrepareStateWriteResult),
6068    SubmitStateWrite(SubmitStateWriteResult),
6069    ResolveStateWrite(ResolveStateWriteResult),
6070}
6071
6072pub const fn command_for_request(value: &RequestBody) -> Command {
6073    match value {
6074        RequestBody::Discover(_) => Command::Discover,
6075        RequestBody::ListIndexes(_) => Command::ListIndexes,
6076        RequestBody::GetIndex(_) => Command::GetIndex,
6077        RequestBody::ValidateIndexChange(_) => Command::ValidateIndexChange,
6078        RequestBody::ApplyIndexChange(_) => Command::ApplyIndexChange,
6079        RequestBody::ApplyAdministrationMutation(_) => Command::ApplyAdministrationMutation,
6080        RequestBody::ListAliases(_) => Command::ListAliases,
6081        RequestBody::GetAlias(_) => Command::GetAlias,
6082        RequestBody::ListDataStreams(_) => Command::ListDataStreams,
6083        RequestBody::GetDataStream(_) => Command::GetDataStream,
6084        RequestBody::ListComponentTemplates(_) => Command::ListComponentTemplates,
6085        RequestBody::GetComponentTemplate(_) => Command::GetComponentTemplate,
6086        RequestBody::ListIndexTemplates(_) => Command::ListIndexTemplates,
6087        RequestBody::GetIndexTemplate(_) => Command::GetIndexTemplate,
6088        RequestBody::ListIngestPipelines(_) => Command::ListIngestPipelines,
6089        RequestBody::GetIngestPipeline(_) => Command::GetIngestPipeline,
6090        RequestBody::SimulateIngestPipeline(_) => Command::SimulateIngestPipeline,
6091        RequestBody::ReprocessByQuery(_) => Command::ReprocessByQuery,
6092        RequestBody::ListLifecyclePolicies(_) => Command::ListLifecyclePolicies,
6093        RequestBody::GetLifecyclePolicy(_) => Command::GetLifecyclePolicy,
6094        RequestBody::PrepareCreateIndex(_) => Command::PrepareCreateIndex,
6095        RequestBody::PrepareDeleteIndex(_) => Command::PrepareDeleteIndex,
6096        RequestBody::SubmitCatalogAction(_) => Command::SubmitCatalogAction,
6097        RequestBody::ResolveCatalogAction(_) => Command::ResolveCatalogAction,
6098        RequestBody::PrepareReplayableSourceIndex(_) => Command::PrepareReplayableSourceIndex,
6099        RequestBody::SubmitReplayableSourceIndex(_) => Command::SubmitReplayableSourceIndex,
6100        RequestBody::GetReplayableSource(_) => Command::GetReplayableSource,
6101        RequestBody::ControlReplayableSource(_) => Command::ControlReplayableSource,
6102        RequestBody::CloneIndex(_) => Command::CloneIndex,
6103        RequestBody::ConfigureHistory(_) => Command::ConfigureHistory,
6104        RequestBody::GetHistory(_) => Command::GetHistory,
6105        RequestBody::ResolveHistory(_) => Command::ResolveHistory,
6106        RequestBody::PlaceHistoryHold(_) => Command::PlaceHistoryHold,
6107        RequestBody::ReleaseHistoryHold(_) => Command::ReleaseHistoryHold,
6108        RequestBody::PrepareDocumentMutation(_) => Command::PrepareDocumentMutation,
6109        RequestBody::SubmitDocumentMutation(_) => Command::SubmitDocumentMutation,
6110        RequestBody::PrepareDocumentBulk(_) => Command::PrepareDocumentBulk,
6111        RequestBody::SubmitDocumentBulk(_) => Command::SubmitDocumentBulk,
6112        RequestBody::ResolveDocumentBulk(_) => Command::ResolveDocumentBulk,
6113        RequestBody::PrepareAppendBulk(_) => Command::PrepareAppendBulk,
6114        RequestBody::SubmitAppendBulk(_) => Command::SubmitAppendBulk,
6115        RequestBody::ResolveAppendBulk(_) => Command::ResolveAppendBulk,
6116        RequestBody::ObserveAppendCommitted(_) => Command::ObserveAppendCommitted,
6117        RequestBody::ResolveDocumentMutation(_) => Command::ResolveDocumentMutation,
6118        RequestBody::GetDocument(_) => Command::GetDocument,
6119        RequestBody::Search(_) => Command::Search,
6120        RequestBody::OpenPit(_) => Command::OpenPit,
6121        RequestBody::RenewPit(_) => Command::RenewPit,
6122        RequestBody::ClosePit(_) => Command::ClosePit,
6123        RequestBody::ListOperations(_) => Command::ListOperations,
6124        RequestBody::GetOperation(_) => Command::GetOperation,
6125        RequestBody::CancelOperation(_) => Command::CancelOperation,
6126        RequestBody::ListAuditEvents(_) => Command::ListAuditEvents,
6127        RequestBody::ExportAuditEvents(_) => Command::ExportAuditEvents,
6128        RequestBody::ReserveServiceCredential(_) => Command::ReserveServiceCredential,
6129        RequestBody::ReserveServiceCredentialRotation(_) => Command::ReserveServiceCredentialRotation,
6130        RequestBody::ActivateServiceCredential(_) => Command::ActivateServiceCredential,
6131        RequestBody::ResolveServiceCredentialReservation(_) => Command::ResolveServiceCredentialReservation,
6132        RequestBody::PrepareRevokeServiceCredential(_) => Command::PrepareRevokeServiceCredential,
6133        RequestBody::RevokeServiceCredential(_) => Command::RevokeServiceCredential,
6134        RequestBody::ResolveSecurityAction(_) => Command::ResolveSecurityAction,
6135        RequestBody::GetSecurityRole(_) => Command::GetSecurityRole,
6136        RequestBody::PrepareRoleAppendAccessChange(_) => Command::PrepareRoleAppendAccessChange,
6137        RequestBody::SubmitRoleAppendAccessChange(_) => Command::SubmitRoleAppendAccessChange,
6138        RequestBody::ListServiceCredentials(_) => Command::ListServiceCredentials,
6139        RequestBody::ListBackups(_) => Command::ListBackups,
6140        RequestBody::GetBackup(_) => Command::GetBackup,
6141        RequestBody::CreateBackup(_) => Command::CreateBackup,
6142        RequestBody::ResolveBackupAction(_) => Command::ResolveBackupAction,
6143        RequestBody::GetRuntimeStatus(_) => Command::GetRuntimeStatus,
6144        RequestBody::GetResultCacheStatus(_) => Command::GetResultCacheStatus,
6145        RequestBody::GetFieldPromotionStatus(_) => Command::GetFieldPromotionStatus,
6146        RequestBody::GetOverloadStatus(_) => Command::GetOverloadStatus,
6147        RequestBody::ConfigureExternalKey(_) => Command::ConfigureExternalKey,
6148        RequestBody::RotateExternalKeyBinding(_) => Command::RotateExternalKeyBinding,
6149        RequestBody::ConfigureAggregateThenDelete(_) => Command::ConfigureAggregateThenDelete,
6150        RequestBody::GetLifecycleStatus(_) => Command::GetLifecycleStatus,
6151        RequestBody::GetQuota(_) => Command::GetQuota,
6152        RequestBody::UpdateQuota(_) => Command::UpdateQuota,
6153        RequestBody::GetBinding(_) => Command::GetBinding,
6154        RequestBody::GetAdmissionStatus(_) => Command::GetAdmissionStatus,
6155        RequestBody::SetAdmission(_) => Command::SetAdmission,
6156        RequestBody::GetQuiesceStatus(_) => Command::GetQuiesceStatus,
6157        RequestBody::GetDecommissionReadiness(_) => Command::GetDecommissionReadiness,
6158        RequestBody::GetUpgradeReadiness(_) => Command::GetUpgradeReadiness,
6159        RequestBody::GetMaintenanceStatus(_) => Command::GetMaintenanceStatus,
6160        RequestBody::GetRestoreReadiness(_) => Command::GetRestoreReadiness,
6161        RequestBody::CreateDiagnostic(_) => Command::CreateDiagnostic,
6162        RequestBody::GetDiagnostic(_) => Command::GetDiagnostic,
6163        RequestBody::ReadArtifactChunk(_) => Command::ReadArtifactChunk,
6164        RequestBody::ExportUsage(_) => Command::ExportUsage,
6165        RequestBody::ExecuteStateRead(_) => Command::ExecuteStateRead,
6166        RequestBody::PrepareStateWrite(_) => Command::PrepareStateWrite,
6167        RequestBody::SubmitStateWrite(_) => Command::SubmitStateWrite,
6168        RequestBody::ResolveStateWrite(_) => Command::ResolveStateWrite,
6169    }
6170}
6171
6172pub const fn command_for_result(value: &ResultBody) -> Command {
6173    match value {
6174        ResultBody::Discover(_) => Command::Discover,
6175        ResultBody::ListIndexes(_) => Command::ListIndexes,
6176        ResultBody::GetIndex(_) => Command::GetIndex,
6177        ResultBody::ValidateIndexChange(_) => Command::ValidateIndexChange,
6178        ResultBody::ApplyIndexChange(_) => Command::ApplyIndexChange,
6179        ResultBody::ApplyAdministrationMutation(_) => Command::ApplyAdministrationMutation,
6180        ResultBody::ListAliases(_) => Command::ListAliases,
6181        ResultBody::GetAlias(_) => Command::GetAlias,
6182        ResultBody::ListDataStreams(_) => Command::ListDataStreams,
6183        ResultBody::GetDataStream(_) => Command::GetDataStream,
6184        ResultBody::ListComponentTemplates(_) => Command::ListComponentTemplates,
6185        ResultBody::GetComponentTemplate(_) => Command::GetComponentTemplate,
6186        ResultBody::ListIndexTemplates(_) => Command::ListIndexTemplates,
6187        ResultBody::GetIndexTemplate(_) => Command::GetIndexTemplate,
6188        ResultBody::ListIngestPipelines(_) => Command::ListIngestPipelines,
6189        ResultBody::GetIngestPipeline(_) => Command::GetIngestPipeline,
6190        ResultBody::SimulateIngestPipeline(_) => Command::SimulateIngestPipeline,
6191        ResultBody::ReprocessByQuery(_) => Command::ReprocessByQuery,
6192        ResultBody::ListLifecyclePolicies(_) => Command::ListLifecyclePolicies,
6193        ResultBody::GetLifecyclePolicy(_) => Command::GetLifecyclePolicy,
6194        ResultBody::PrepareCreateIndex(_) => Command::PrepareCreateIndex,
6195        ResultBody::PrepareDeleteIndex(_) => Command::PrepareDeleteIndex,
6196        ResultBody::SubmitCatalogAction(_) => Command::SubmitCatalogAction,
6197        ResultBody::ResolveCatalogAction(_) => Command::ResolveCatalogAction,
6198        ResultBody::PrepareReplayableSourceIndex(_) => Command::PrepareReplayableSourceIndex,
6199        ResultBody::SubmitReplayableSourceIndex(_) => Command::SubmitReplayableSourceIndex,
6200        ResultBody::GetReplayableSource(_) => Command::GetReplayableSource,
6201        ResultBody::ControlReplayableSource(_) => Command::ControlReplayableSource,
6202        ResultBody::CloneIndex(_) => Command::CloneIndex,
6203        ResultBody::ConfigureHistory(_) => Command::ConfigureHistory,
6204        ResultBody::GetHistory(_) => Command::GetHistory,
6205        ResultBody::ResolveHistory(_) => Command::ResolveHistory,
6206        ResultBody::PlaceHistoryHold(_) => Command::PlaceHistoryHold,
6207        ResultBody::ReleaseHistoryHold(_) => Command::ReleaseHistoryHold,
6208        ResultBody::PrepareDocumentMutation(_) => Command::PrepareDocumentMutation,
6209        ResultBody::SubmitDocumentMutation(_) => Command::SubmitDocumentMutation,
6210        ResultBody::PrepareDocumentBulk(_) => Command::PrepareDocumentBulk,
6211        ResultBody::SubmitDocumentBulk(_) => Command::SubmitDocumentBulk,
6212        ResultBody::ResolveDocumentBulk(_) => Command::ResolveDocumentBulk,
6213        ResultBody::PrepareAppendBulk(_) => Command::PrepareAppendBulk,
6214        ResultBody::SubmitAppendBulk(_) => Command::SubmitAppendBulk,
6215        ResultBody::ResolveAppendBulk(_) => Command::ResolveAppendBulk,
6216        ResultBody::ObserveAppendCommitted(_) => Command::ObserveAppendCommitted,
6217        ResultBody::ResolveDocumentMutation(_) => Command::ResolveDocumentMutation,
6218        ResultBody::GetDocument(_) => Command::GetDocument,
6219        ResultBody::Search(_) => Command::Search,
6220        ResultBody::OpenPit(_) => Command::OpenPit,
6221        ResultBody::RenewPit(_) => Command::RenewPit,
6222        ResultBody::ClosePit(_) => Command::ClosePit,
6223        ResultBody::ListOperations(_) => Command::ListOperations,
6224        ResultBody::GetOperation(_) => Command::GetOperation,
6225        ResultBody::CancelOperation(_) => Command::CancelOperation,
6226        ResultBody::ListAuditEvents(_) => Command::ListAuditEvents,
6227        ResultBody::ExportAuditEvents(_) => Command::ExportAuditEvents,
6228        ResultBody::ReserveServiceCredential(_) => Command::ReserveServiceCredential,
6229        ResultBody::ReserveServiceCredentialRotation(_) => Command::ReserveServiceCredentialRotation,
6230        ResultBody::ActivateServiceCredential(_) => Command::ActivateServiceCredential,
6231        ResultBody::ResolveServiceCredentialReservation(_) => Command::ResolveServiceCredentialReservation,
6232        ResultBody::PrepareRevokeServiceCredential(_) => Command::PrepareRevokeServiceCredential,
6233        ResultBody::RevokeServiceCredential(_) => Command::RevokeServiceCredential,
6234        ResultBody::ResolveSecurityAction(_) => Command::ResolveSecurityAction,
6235        ResultBody::GetSecurityRole(_) => Command::GetSecurityRole,
6236        ResultBody::PrepareRoleAppendAccessChange(_) => Command::PrepareRoleAppendAccessChange,
6237        ResultBody::SubmitRoleAppendAccessChange(_) => Command::SubmitRoleAppendAccessChange,
6238        ResultBody::ListServiceCredentials(_) => Command::ListServiceCredentials,
6239        ResultBody::ListBackups(_) => Command::ListBackups,
6240        ResultBody::GetBackup(_) => Command::GetBackup,
6241        ResultBody::CreateBackup(_) => Command::CreateBackup,
6242        ResultBody::ResolveBackupAction(_) => Command::ResolveBackupAction,
6243        ResultBody::GetRuntimeStatus(_) => Command::GetRuntimeStatus,
6244        ResultBody::GetResultCacheStatus(_) => Command::GetResultCacheStatus,
6245        ResultBody::GetFieldPromotionStatus(_) => Command::GetFieldPromotionStatus,
6246        ResultBody::GetOverloadStatus(_) => Command::GetOverloadStatus,
6247        ResultBody::ConfigureExternalKey(_) => Command::ConfigureExternalKey,
6248        ResultBody::RotateExternalKeyBinding(_) => Command::RotateExternalKeyBinding,
6249        ResultBody::ConfigureAggregateThenDelete(_) => Command::ConfigureAggregateThenDelete,
6250        ResultBody::GetLifecycleStatus(_) => Command::GetLifecycleStatus,
6251        ResultBody::GetQuota(_) => Command::GetQuota,
6252        ResultBody::UpdateQuota(_) => Command::UpdateQuota,
6253        ResultBody::GetBinding(_) => Command::GetBinding,
6254        ResultBody::GetAdmissionStatus(_) => Command::GetAdmissionStatus,
6255        ResultBody::SetAdmission(_) => Command::SetAdmission,
6256        ResultBody::GetQuiesceStatus(_) => Command::GetQuiesceStatus,
6257        ResultBody::GetDecommissionReadiness(_) => Command::GetDecommissionReadiness,
6258        ResultBody::GetUpgradeReadiness(_) => Command::GetUpgradeReadiness,
6259        ResultBody::GetMaintenanceStatus(_) => Command::GetMaintenanceStatus,
6260        ResultBody::GetRestoreReadiness(_) => Command::GetRestoreReadiness,
6261        ResultBody::CreateDiagnostic(_) => Command::CreateDiagnostic,
6262        ResultBody::GetDiagnostic(_) => Command::GetDiagnostic,
6263        ResultBody::ReadArtifactChunk(_) => Command::ReadArtifactChunk,
6264        ResultBody::ExportUsage(_) => Command::ExportUsage,
6265        ResultBody::ExecuteStateRead(_) => Command::ExecuteStateRead,
6266        ResultBody::PrepareStateWrite(_) => Command::PrepareStateWrite,
6267        ResultBody::SubmitStateWrite(_) => Command::SubmitStateWrite,
6268        ResultBody::ResolveStateWrite(_) => Command::ResolveStateWrite,
6269    }
6270}
6271
6272#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
6273#[serde(deny_unknown_fields)]
6274pub struct RequestEnvelope {
6275    pub meta: RequestMeta,
6276    pub request: RequestBody,
6277}
6278#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
6279#[serde(tag = "outcome", rename_all = "snake_case")]
6280pub enum ResponseEnvelope {
6281    Success {
6282        format_version: u16,
6283        request_id: String,
6284        result: Box<ResultBody>,
6285    },
6286    Error {
6287        format_version: u16,
6288        request_id: String,
6289        error: ErrorBody,
6290    },
6291}
6292
6293#[derive(Clone, Copy, Debug, Eq, PartialEq)]
6294pub struct CommandContract {
6295    pub command: Command,
6296    pub action: Action,
6297    pub cancellable: bool,
6298    pub mutation: &'static str,
6299}
6300pub const LODESTONE_API_COMMAND_CONTRACTS: &[CommandContract] = &[
6301    CommandContract {
6302        command: Command::Discover,
6303        action: Action::IdentityDiscovery,
6304        cancellable: true,
6305        mutation: "read_only",
6306    },
6307    CommandContract {
6308        command: Command::ListIndexes,
6309        action: Action::CatalogRead,
6310        cancellable: true,
6311        mutation: "read_only",
6312    },
6313    CommandContract {
6314        command: Command::GetIndex,
6315        action: Action::CatalogRead,
6316        cancellable: true,
6317        mutation: "read_only",
6318    },
6319    CommandContract {
6320        command: Command::ValidateIndexChange,
6321        action: Action::IndexAdmin,
6322        cancellable: true,
6323        mutation: "read_only",
6324    },
6325    CommandContract {
6326        command: Command::ApplyIndexChange,
6327        action: Action::IndexAdmin,
6328        cancellable: true,
6329        mutation: "catalog_submit",
6330    },
6331    CommandContract {
6332        command: Command::ApplyAdministrationMutation,
6333        action: Action::LifecycleAdmin,
6334        cancellable: true,
6335        mutation: "administration_submit",
6336    },
6337    CommandContract {
6338        command: Command::ListAliases,
6339        action: Action::CatalogRead,
6340        cancellable: true,
6341        mutation: "read_only",
6342    },
6343    CommandContract {
6344        command: Command::GetAlias,
6345        action: Action::CatalogRead,
6346        cancellable: true,
6347        mutation: "read_only",
6348    },
6349    CommandContract {
6350        command: Command::ListDataStreams,
6351        action: Action::CatalogRead,
6352        cancellable: true,
6353        mutation: "read_only",
6354    },
6355    CommandContract {
6356        command: Command::GetDataStream,
6357        action: Action::CatalogRead,
6358        cancellable: true,
6359        mutation: "read_only",
6360    },
6361    CommandContract {
6362        command: Command::ListComponentTemplates,
6363        action: Action::CatalogRead,
6364        cancellable: true,
6365        mutation: "read_only",
6366    },
6367    CommandContract {
6368        command: Command::GetComponentTemplate,
6369        action: Action::CatalogRead,
6370        cancellable: true,
6371        mutation: "read_only",
6372    },
6373    CommandContract {
6374        command: Command::ListIndexTemplates,
6375        action: Action::CatalogRead,
6376        cancellable: true,
6377        mutation: "read_only",
6378    },
6379    CommandContract {
6380        command: Command::GetIndexTemplate,
6381        action: Action::CatalogRead,
6382        cancellable: true,
6383        mutation: "read_only",
6384    },
6385    CommandContract {
6386        command: Command::ListIngestPipelines,
6387        action: Action::LifecycleAdmin,
6388        cancellable: true,
6389        mutation: "read_only",
6390    },
6391    CommandContract {
6392        command: Command::GetIngestPipeline,
6393        action: Action::LifecycleAdmin,
6394        cancellable: true,
6395        mutation: "read_only",
6396    },
6397    CommandContract {
6398        command: Command::SimulateIngestPipeline,
6399        action: Action::LifecycleAdmin,
6400        cancellable: true,
6401        mutation: "read_only",
6402    },
6403    CommandContract {
6404        command: Command::ReprocessByQuery,
6405        action: Action::DataWrite,
6406        cancellable: true,
6407        mutation: "authority_submit",
6408    },
6409    CommandContract {
6410        command: Command::ListLifecyclePolicies,
6411        action: Action::CatalogRead,
6412        cancellable: true,
6413        mutation: "read_only",
6414    },
6415    CommandContract {
6416        command: Command::GetLifecyclePolicy,
6417        action: Action::CatalogRead,
6418        cancellable: true,
6419        mutation: "read_only",
6420    },
6421    CommandContract {
6422        command: Command::PrepareCreateIndex,
6423        action: Action::IndexAdmin,
6424        cancellable: true,
6425        mutation: "catalog_prepare",
6426    },
6427    CommandContract {
6428        command: Command::PrepareDeleteIndex,
6429        action: Action::IndexAdmin,
6430        cancellable: true,
6431        mutation: "catalog_prepare",
6432    },
6433    CommandContract {
6434        command: Command::SubmitCatalogAction,
6435        action: Action::IndexAdmin,
6436        cancellable: true,
6437        mutation: "catalog_submit",
6438    },
6439    CommandContract {
6440        command: Command::ResolveCatalogAction,
6441        action: Action::IndexAdmin,
6442        cancellable: true,
6443        mutation: "read_only",
6444    },
6445    CommandContract {
6446        command: Command::PrepareReplayableSourceIndex,
6447        action: Action::IndexAdmin,
6448        cancellable: true,
6449        mutation: "catalog_prepare",
6450    },
6451    CommandContract {
6452        command: Command::SubmitReplayableSourceIndex,
6453        action: Action::IndexAdmin,
6454        cancellable: true,
6455        mutation: "catalog_submit",
6456    },
6457    CommandContract {
6458        command: Command::GetReplayableSource,
6459        action: Action::CatalogRead,
6460        cancellable: true,
6461        mutation: "read_only",
6462    },
6463    CommandContract {
6464        command: Command::ControlReplayableSource,
6465        action: Action::IndexAdmin,
6466        cancellable: true,
6467        mutation: "catalog_submit",
6468    },
6469    CommandContract {
6470        command: Command::CloneIndex,
6471        action: Action::IndexAdmin,
6472        cancellable: true,
6473        mutation: "catalog_submit",
6474    },
6475    CommandContract {
6476        command: Command::ConfigureHistory,
6477        action: Action::IndexAdmin,
6478        cancellable: true,
6479        mutation: "catalog_submit",
6480    },
6481    CommandContract {
6482        command: Command::GetHistory,
6483        action: Action::CatalogRead,
6484        cancellable: true,
6485        mutation: "read_only",
6486    },
6487    CommandContract {
6488        command: Command::ResolveHistory,
6489        action: Action::DataRead,
6490        cancellable: true,
6491        mutation: "read_only",
6492    },
6493    CommandContract {
6494        command: Command::PlaceHistoryHold,
6495        action: Action::IndexAdmin,
6496        cancellable: true,
6497        mutation: "catalog_submit",
6498    },
6499    CommandContract {
6500        command: Command::ReleaseHistoryHold,
6501        action: Action::IndexAdmin,
6502        cancellable: true,
6503        mutation: "catalog_submit",
6504    },
6505    CommandContract {
6506        command: Command::PrepareDocumentMutation,
6507        action: Action::DataWrite,
6508        cancellable: true,
6509        mutation: "read_only_prepare",
6510    },
6511    CommandContract {
6512        command: Command::SubmitDocumentMutation,
6513        action: Action::DataWrite,
6514        cancellable: true,
6515        mutation: "wal_submit",
6516    },
6517    CommandContract {
6518        command: Command::PrepareDocumentBulk,
6519        action: Action::DataWrite,
6520        cancellable: true,
6521        mutation: "read_only_prepare",
6522    },
6523    CommandContract {
6524        command: Command::SubmitDocumentBulk,
6525        action: Action::DataWrite,
6526        cancellable: true,
6527        mutation: "wal_submit",
6528    },
6529    CommandContract {
6530        command: Command::ResolveDocumentBulk,
6531        action: Action::DataRead,
6532        cancellable: true,
6533        mutation: "read_only",
6534    },
6535    CommandContract {
6536        command: Command::PrepareAppendBulk,
6537        action: Action::Append,
6538        cancellable: true,
6539        mutation: "read_only_prepare",
6540    },
6541    CommandContract {
6542        command: Command::SubmitAppendBulk,
6543        action: Action::Append,
6544        cancellable: true,
6545        mutation: "wal_submit",
6546    },
6547    CommandContract {
6548        command: Command::ResolveAppendBulk,
6549        action: Action::ResolveAppend,
6550        cancellable: true,
6551        mutation: "read_only",
6552    },
6553    CommandContract {
6554        command: Command::ObserveAppendCommitted,
6555        action: Action::ResolveAppend,
6556        cancellable: true,
6557        mutation: "read_only",
6558    },
6559    CommandContract {
6560        command: Command::ResolveDocumentMutation,
6561        action: Action::DataRead,
6562        cancellable: true,
6563        mutation: "read_only",
6564    },
6565    CommandContract {
6566        command: Command::GetDocument,
6567        action: Action::DataRead,
6568        cancellable: true,
6569        mutation: "read_only",
6570    },
6571    CommandContract {
6572        command: Command::Search,
6573        action: Action::DataRead,
6574        cancellable: true,
6575        mutation: "read_only",
6576    },
6577    CommandContract {
6578        command: Command::OpenPit,
6579        action: Action::DataRead,
6580        cancellable: true,
6581        mutation: "authority_submit",
6582    },
6583    CommandContract {
6584        command: Command::RenewPit,
6585        action: Action::DataRead,
6586        cancellable: true,
6587        mutation: "authority_submit",
6588    },
6589    CommandContract {
6590        command: Command::ClosePit,
6591        action: Action::DataRead,
6592        cancellable: true,
6593        mutation: "authority_submit",
6594    },
6595    CommandContract {
6596        command: Command::ListOperations,
6597        action: Action::OperationRead,
6598        cancellable: true,
6599        mutation: "read_only",
6600    },
6601    CommandContract {
6602        command: Command::GetOperation,
6603        action: Action::OperationRead,
6604        cancellable: true,
6605        mutation: "read_only",
6606    },
6607    CommandContract {
6608        command: Command::CancelOperation,
6609        action: Action::OperationCancel,
6610        cancellable: true,
6611        mutation: "authority_submit",
6612    },
6613    CommandContract {
6614        command: Command::ListAuditEvents,
6615        action: Action::AuditRead,
6616        cancellable: true,
6617        mutation: "read_only",
6618    },
6619    CommandContract {
6620        command: Command::ExportAuditEvents,
6621        action: Action::AuditRead,
6622        cancellable: true,
6623        mutation: "read_only",
6624    },
6625    CommandContract {
6626        command: Command::ReserveServiceCredential,
6627        action: Action::SecurityAdmin,
6628        cancellable: true,
6629        mutation: "security_reserve",
6630    },
6631    CommandContract {
6632        command: Command::ReserveServiceCredentialRotation,
6633        action: Action::SecurityAdmin,
6634        cancellable: true,
6635        mutation: "security_reserve",
6636    },
6637    CommandContract {
6638        command: Command::ActivateServiceCredential,
6639        action: Action::SecurityAdmin,
6640        cancellable: true,
6641        mutation: "security_submit",
6642    },
6643    CommandContract {
6644        command: Command::ResolveServiceCredentialReservation,
6645        action: Action::SecurityRead,
6646        cancellable: true,
6647        mutation: "read_only",
6648    },
6649    CommandContract {
6650        command: Command::PrepareRevokeServiceCredential,
6651        action: Action::SecurityAdmin,
6652        cancellable: true,
6653        mutation: "read_only_prepare",
6654    },
6655    CommandContract {
6656        command: Command::RevokeServiceCredential,
6657        action: Action::SecurityAdmin,
6658        cancellable: true,
6659        mutation: "security_submit",
6660    },
6661    CommandContract {
6662        command: Command::ResolveSecurityAction,
6663        action: Action::SecurityRead,
6664        cancellable: true,
6665        mutation: "read_only",
6666    },
6667    CommandContract {
6668        command: Command::GetSecurityRole,
6669        action: Action::SecurityRead,
6670        cancellable: true,
6671        mutation: "read_only",
6672    },
6673    CommandContract {
6674        command: Command::PrepareRoleAppendAccessChange,
6675        action: Action::SecurityAdmin,
6676        cancellable: true,
6677        mutation: "read_only_prepare",
6678    },
6679    CommandContract {
6680        command: Command::SubmitRoleAppendAccessChange,
6681        action: Action::SecurityAdmin,
6682        cancellable: true,
6683        mutation: "security_submit",
6684    },
6685    CommandContract {
6686        command: Command::ListServiceCredentials,
6687        action: Action::SecurityRead,
6688        cancellable: true,
6689        mutation: "read_only",
6690    },
6691    CommandContract {
6692        command: Command::ListBackups,
6693        action: Action::BackupRead,
6694        cancellable: true,
6695        mutation: "read_only",
6696    },
6697    CommandContract {
6698        command: Command::GetBackup,
6699        action: Action::BackupRead,
6700        cancellable: true,
6701        mutation: "read_only",
6702    },
6703    CommandContract {
6704        command: Command::CreateBackup,
6705        action: Action::BackupAdmin,
6706        cancellable: true,
6707        mutation: "backup_submit",
6708    },
6709    CommandContract {
6710        command: Command::ResolveBackupAction,
6711        action: Action::BackupRead,
6712        cancellable: true,
6713        mutation: "read_only",
6714    },
6715    CommandContract {
6716        command: Command::GetRuntimeStatus,
6717        action: Action::CatalogRead,
6718        cancellable: true,
6719        mutation: "read_only",
6720    },
6721    CommandContract {
6722        command: Command::GetResultCacheStatus,
6723        action: Action::CatalogRead,
6724        cancellable: true,
6725        mutation: "read_only",
6726    },
6727    CommandContract {
6728        command: Command::GetFieldPromotionStatus,
6729        action: Action::CatalogRead,
6730        cancellable: true,
6731        mutation: "read_only",
6732    },
6733    CommandContract {
6734        command: Command::GetOverloadStatus,
6735        action: Action::CatalogRead,
6736        cancellable: true,
6737        mutation: "read_only",
6738    },
6739    CommandContract {
6740        command: Command::ConfigureExternalKey,
6741        action: Action::LifecycleAdmin,
6742        cancellable: true,
6743        mutation: "authority_submit",
6744    },
6745    CommandContract {
6746        command: Command::RotateExternalKeyBinding,
6747        action: Action::LifecycleAdmin,
6748        cancellable: true,
6749        mutation: "authority_submit",
6750    },
6751    CommandContract {
6752        command: Command::ConfigureAggregateThenDelete,
6753        action: Action::LifecycleAdmin,
6754        cancellable: true,
6755        mutation: "authority_submit",
6756    },
6757    CommandContract {
6758        command: Command::GetLifecycleStatus,
6759        action: Action::CatalogRead,
6760        cancellable: true,
6761        mutation: "read_only",
6762    },
6763    CommandContract {
6764        command: Command::GetQuota,
6765        action: Action::QuotaRead,
6766        cancellable: true,
6767        mutation: "read_only",
6768    },
6769    CommandContract {
6770        command: Command::UpdateQuota,
6771        action: Action::QuotaAdmin,
6772        cancellable: true,
6773        mutation: "quota_submit",
6774    },
6775    CommandContract {
6776        command: Command::GetBinding,
6777        action: Action::BindingRead,
6778        cancellable: true,
6779        mutation: "read_only",
6780    },
6781    CommandContract {
6782        command: Command::GetAdmissionStatus,
6783        action: Action::AdmissionRead,
6784        cancellable: true,
6785        mutation: "read_only",
6786    },
6787    CommandContract {
6788        command: Command::SetAdmission,
6789        action: Action::AdmissionAdmin,
6790        cancellable: true,
6791        mutation: "admission_submit",
6792    },
6793    CommandContract {
6794        command: Command::GetQuiesceStatus,
6795        action: Action::AdmissionRead,
6796        cancellable: true,
6797        mutation: "read_only",
6798    },
6799    CommandContract {
6800        command: Command::GetDecommissionReadiness,
6801        action: Action::AdmissionRead,
6802        cancellable: true,
6803        mutation: "read_only",
6804    },
6805    CommandContract {
6806        command: Command::GetUpgradeReadiness,
6807        action: Action::TaskRead,
6808        cancellable: true,
6809        mutation: "read_only",
6810    },
6811    CommandContract {
6812        command: Command::GetMaintenanceStatus,
6813        action: Action::TaskRead,
6814        cancellable: true,
6815        mutation: "read_only",
6816    },
6817    CommandContract {
6818        command: Command::GetRestoreReadiness,
6819        action: Action::BackupRead,
6820        cancellable: true,
6821        mutation: "read_only",
6822    },
6823    CommandContract {
6824        command: Command::CreateDiagnostic,
6825        action: Action::DiagnosticsCreate,
6826        cancellable: true,
6827        mutation: "diagnostic_submit",
6828    },
6829    CommandContract {
6830        command: Command::GetDiagnostic,
6831        action: Action::DiagnosticsRead,
6832        cancellable: true,
6833        mutation: "read_only",
6834    },
6835    CommandContract {
6836        command: Command::ReadArtifactChunk,
6837        action: Action::OperationRead,
6838        cancellable: true,
6839        mutation: "read_only",
6840    },
6841    CommandContract {
6842        command: Command::ExportUsage,
6843        action: Action::UsageRead,
6844        cancellable: true,
6845        mutation: "read_only",
6846    },
6847    CommandContract {
6848        command: Command::ExecuteStateRead,
6849        action: Action::DataRead,
6850        cancellable: true,
6851        mutation: "read_only",
6852    },
6853    CommandContract {
6854        command: Command::PrepareStateWrite,
6855        action: Action::DataWrite,
6856        cancellable: true,
6857        mutation: "read_only_prepare",
6858    },
6859    CommandContract {
6860        command: Command::SubmitStateWrite,
6861        action: Action::DataWrite,
6862        cancellable: true,
6863        mutation: "state_submit",
6864    },
6865    CommandContract {
6866        command: Command::ResolveStateWrite,
6867        action: Action::DataRead,
6868        cancellable: true,
6869        mutation: "read_only",
6870    },
6871];
6872#[derive(Clone, Copy, Debug, Eq, PartialEq)]
6873pub struct CommandSemanticContract {
6874    pub command: Command,
6875    pub admissible_errors: &'static [ErrorCode],
6876    pub limit_ids: &'static [&'static str],
6877    pub effect_class: &'static str,
6878    pub risk_flags: &'static [&'static str],
6879    pub capability_family: &'static str,
6880    pub retry_safety: &'static str,
6881    pub identity_requirement: &'static str,
6882    pub resolver: Option<Command>,
6883    pub cancellation: &'static str,
6884    pub side_effects: &'static [&'static str],
6885    pub recovery: &'static str,
6886    pub collection_index_ref: &'static str,
6887}
6888pub const LODESTONE_API_COMMAND_SEMANTICS: &[CommandSemanticContract] = &[
6889    CommandSemanticContract {
6890        command: Command::Discover,
6891        admissible_errors: &[
6892            ErrorCode::Aborted,
6893            ErrorCode::DeadlineExceeded,
6894            ErrorCode::InvalidRequest,
6895            ErrorCode::UnsupportedVersion,
6896            ErrorCode::Unauthenticated,
6897            ErrorCode::PermissionDenied,
6898            ErrorCode::NotFound,
6899            ErrorCode::LimitExceeded,
6900            ErrorCode::CapabilityUnavailable,
6901            ErrorCode::TemporarilyUnavailable,
6902            ErrorCode::Internal,
6903        ],
6904        limit_ids: &["request_bytes", "response_bytes"],
6905        effect_class: "read_only",
6906        risk_flags: &[],
6907        capability_family: "discovery",
6908        retry_safety: "safe",
6909        identity_requirement: "none",
6910        resolver: None,
6911        cancellation: "per_call",
6912        side_effects: &[],
6913        recovery: "retry",
6914        collection_index_ref: "none",
6915    },
6916    CommandSemanticContract {
6917        command: Command::ListIndexes,
6918        admissible_errors: &[
6919            ErrorCode::Aborted,
6920            ErrorCode::DeadlineExceeded,
6921            ErrorCode::InvalidRequest,
6922            ErrorCode::UnsupportedVersion,
6923            ErrorCode::Unauthenticated,
6924            ErrorCode::PermissionDenied,
6925            ErrorCode::NotFound,
6926            ErrorCode::StaleCursor,
6927            ErrorCode::RestartBudgetExhausted,
6928            ErrorCode::LimitExceeded,
6929            ErrorCode::CapabilityUnavailable,
6930            ErrorCode::TemporarilyUnavailable,
6931            ErrorCode::Internal,
6932        ],
6933        limit_ids: &[
6934            "request_bytes",
6935            "response_bytes",
6936            "page_size",
6937            "catalog_page_size",
6938            "catalog_restart_budget",
6939        ],
6940        effect_class: "read_only",
6941        risk_flags: &[],
6942        capability_family: "catalog",
6943        retry_safety: "safe",
6944        identity_requirement: "none",
6945        resolver: None,
6946        cancellation: "per_call",
6947        side_effects: &[],
6948        recovery: "retry",
6949        collection_index_ref: "none",
6950    },
6951    CommandSemanticContract {
6952        command: Command::GetIndex,
6953        admissible_errors: &[
6954            ErrorCode::Aborted,
6955            ErrorCode::DeadlineExceeded,
6956            ErrorCode::InvalidRequest,
6957            ErrorCode::UnsupportedVersion,
6958            ErrorCode::Unauthenticated,
6959            ErrorCode::PermissionDenied,
6960            ErrorCode::NotFound,
6961            ErrorCode::LimitExceeded,
6962            ErrorCode::CapabilityUnavailable,
6963            ErrorCode::TemporarilyUnavailable,
6964            ErrorCode::Internal,
6965        ],
6966        limit_ids: &["request_bytes", "response_bytes"],
6967        effect_class: "read_only",
6968        risk_flags: &[],
6969        capability_family: "catalog",
6970        retry_safety: "safe",
6971        identity_requirement: "none",
6972        resolver: None,
6973        cancellation: "per_call",
6974        side_effects: &[],
6975        recovery: "retry",
6976        collection_index_ref: "none",
6977    },
6978    CommandSemanticContract {
6979        command: Command::ValidateIndexChange,
6980        admissible_errors: &[
6981            ErrorCode::Aborted,
6982            ErrorCode::DeadlineExceeded,
6983            ErrorCode::InvalidRequest,
6984            ErrorCode::UnsupportedVersion,
6985            ErrorCode::Unauthenticated,
6986            ErrorCode::PermissionDenied,
6987            ErrorCode::NotFound,
6988            ErrorCode::LimitExceeded,
6989            ErrorCode::CapabilityUnavailable,
6990            ErrorCode::TemporarilyUnavailable,
6991            ErrorCode::Internal,
6992        ],
6993        limit_ids: &["request_bytes", "response_bytes"],
6994        effect_class: "read_only",
6995        risk_flags: &[],
6996        capability_family: "catalog",
6997        retry_safety: "safe",
6998        identity_requirement: "none",
6999        resolver: None,
7000        cancellation: "per_call",
7001        side_effects: &[],
7002        recovery: "retry",
7003        collection_index_ref: "request_name",
7004    },
7005    CommandSemanticContract {
7006        command: Command::ApplyIndexChange,
7007        admissible_errors: &[
7008            ErrorCode::Aborted,
7009            ErrorCode::DeadlineExceeded,
7010            ErrorCode::InvalidRequest,
7011            ErrorCode::UnsupportedVersion,
7012            ErrorCode::Unauthenticated,
7013            ErrorCode::PermissionDenied,
7014            ErrorCode::NotFound,
7015            ErrorCode::Conflict,
7016            ErrorCode::LimitExceeded,
7017            ErrorCode::CapabilityUnavailable,
7018            ErrorCode::NotSubmitted,
7019            ErrorCode::SubmittedIndeterminate,
7020            ErrorCode::ExpiredUnknown,
7021            ErrorCode::TemporarilyUnavailable,
7022            ErrorCode::Internal,
7023        ],
7024        limit_ids: &["request_bytes", "response_bytes"],
7025        effect_class: "durable_submit",
7026        risk_flags: &[],
7027        capability_family: "catalog",
7028        retry_safety: "pre_submit_only",
7029        identity_requirement: "caller_action_id",
7030        resolver: None,
7031        cancellation: "per_call_until_submission_then_resolve",
7032        side_effects: &["commits_authoritative_state"],
7033        recovery: "retry_if_not_submitted",
7034        collection_index_ref: "request_index",
7035    },
7036    CommandSemanticContract {
7037        command: Command::ApplyAdministrationMutation,
7038        admissible_errors: &[
7039            ErrorCode::Aborted,
7040            ErrorCode::DeadlineExceeded,
7041            ErrorCode::InvalidRequest,
7042            ErrorCode::UnsupportedVersion,
7043            ErrorCode::Unauthenticated,
7044            ErrorCode::PermissionDenied,
7045            ErrorCode::NotFound,
7046            ErrorCode::Conflict,
7047            ErrorCode::LimitExceeded,
7048            ErrorCode::CapabilityUnavailable,
7049            ErrorCode::NotSubmitted,
7050            ErrorCode::SubmittedIndeterminate,
7051            ErrorCode::ExpiredUnknown,
7052            ErrorCode::TemporarilyUnavailable,
7053            ErrorCode::Internal,
7054        ],
7055        limit_ids: &["request_bytes", "response_bytes"],
7056        effect_class: "control_write",
7057        risk_flags: &[],
7058        capability_family: "lifecycle",
7059        retry_safety: "pre_submit_only",
7060        identity_requirement: "caller_action_id",
7061        resolver: None,
7062        cancellation: "per_call_until_submission_then_resolve",
7063        side_effects: &["commits_authoritative_state"],
7064        recovery: "retry_if_not_submitted",
7065        collection_index_ref: "none",
7066    },
7067    CommandSemanticContract {
7068        command: Command::ListAliases,
7069        admissible_errors: &[
7070            ErrorCode::Aborted,
7071            ErrorCode::DeadlineExceeded,
7072            ErrorCode::InvalidRequest,
7073            ErrorCode::UnsupportedVersion,
7074            ErrorCode::Unauthenticated,
7075            ErrorCode::PermissionDenied,
7076            ErrorCode::NotFound,
7077            ErrorCode::StaleCursor,
7078            ErrorCode::RestartBudgetExhausted,
7079            ErrorCode::LimitExceeded,
7080            ErrorCode::CapabilityUnavailable,
7081            ErrorCode::TemporarilyUnavailable,
7082            ErrorCode::Internal,
7083        ],
7084        limit_ids: &[
7085            "request_bytes",
7086            "response_bytes",
7087            "page_size",
7088            "catalog_page_size",
7089            "catalog_restart_budget",
7090        ],
7091        effect_class: "read_only",
7092        risk_flags: &[],
7093        capability_family: "catalog",
7094        retry_safety: "safe",
7095        identity_requirement: "none",
7096        resolver: None,
7097        cancellation: "per_call",
7098        side_effects: &[],
7099        recovery: "retry",
7100        collection_index_ref: "none",
7101    },
7102    CommandSemanticContract {
7103        command: Command::GetAlias,
7104        admissible_errors: &[
7105            ErrorCode::Aborted,
7106            ErrorCode::DeadlineExceeded,
7107            ErrorCode::InvalidRequest,
7108            ErrorCode::UnsupportedVersion,
7109            ErrorCode::Unauthenticated,
7110            ErrorCode::PermissionDenied,
7111            ErrorCode::NotFound,
7112            ErrorCode::LimitExceeded,
7113            ErrorCode::CapabilityUnavailable,
7114            ErrorCode::TemporarilyUnavailable,
7115            ErrorCode::Internal,
7116        ],
7117        limit_ids: &["request_bytes", "response_bytes"],
7118        effect_class: "read_only",
7119        risk_flags: &[],
7120        capability_family: "catalog",
7121        retry_safety: "safe",
7122        identity_requirement: "none",
7123        resolver: None,
7124        cancellation: "per_call",
7125        side_effects: &[],
7126        recovery: "retry",
7127        collection_index_ref: "none",
7128    },
7129    CommandSemanticContract {
7130        command: Command::ListDataStreams,
7131        admissible_errors: &[
7132            ErrorCode::Aborted,
7133            ErrorCode::DeadlineExceeded,
7134            ErrorCode::InvalidRequest,
7135            ErrorCode::UnsupportedVersion,
7136            ErrorCode::Unauthenticated,
7137            ErrorCode::PermissionDenied,
7138            ErrorCode::NotFound,
7139            ErrorCode::StaleCursor,
7140            ErrorCode::RestartBudgetExhausted,
7141            ErrorCode::LimitExceeded,
7142            ErrorCode::CapabilityUnavailable,
7143            ErrorCode::TemporarilyUnavailable,
7144            ErrorCode::Internal,
7145        ],
7146        limit_ids: &[
7147            "request_bytes",
7148            "response_bytes",
7149            "page_size",
7150            "catalog_page_size",
7151            "catalog_restart_budget",
7152        ],
7153        effect_class: "read_only",
7154        risk_flags: &[],
7155        capability_family: "catalog",
7156        retry_safety: "safe",
7157        identity_requirement: "none",
7158        resolver: None,
7159        cancellation: "per_call",
7160        side_effects: &[],
7161        recovery: "retry",
7162        collection_index_ref: "none",
7163    },
7164    CommandSemanticContract {
7165        command: Command::GetDataStream,
7166        admissible_errors: &[
7167            ErrorCode::Aborted,
7168            ErrorCode::DeadlineExceeded,
7169            ErrorCode::InvalidRequest,
7170            ErrorCode::UnsupportedVersion,
7171            ErrorCode::Unauthenticated,
7172            ErrorCode::PermissionDenied,
7173            ErrorCode::NotFound,
7174            ErrorCode::LimitExceeded,
7175            ErrorCode::CapabilityUnavailable,
7176            ErrorCode::TemporarilyUnavailable,
7177            ErrorCode::Internal,
7178        ],
7179        limit_ids: &["request_bytes", "response_bytes"],
7180        effect_class: "read_only",
7181        risk_flags: &[],
7182        capability_family: "catalog",
7183        retry_safety: "safe",
7184        identity_requirement: "none",
7185        resolver: None,
7186        cancellation: "per_call",
7187        side_effects: &[],
7188        recovery: "retry",
7189        collection_index_ref: "none",
7190    },
7191    CommandSemanticContract {
7192        command: Command::ListComponentTemplates,
7193        admissible_errors: &[
7194            ErrorCode::Aborted,
7195            ErrorCode::DeadlineExceeded,
7196            ErrorCode::InvalidRequest,
7197            ErrorCode::UnsupportedVersion,
7198            ErrorCode::Unauthenticated,
7199            ErrorCode::PermissionDenied,
7200            ErrorCode::NotFound,
7201            ErrorCode::StaleCursor,
7202            ErrorCode::RestartBudgetExhausted,
7203            ErrorCode::LimitExceeded,
7204            ErrorCode::CapabilityUnavailable,
7205            ErrorCode::TemporarilyUnavailable,
7206            ErrorCode::Internal,
7207        ],
7208        limit_ids: &[
7209            "request_bytes",
7210            "response_bytes",
7211            "page_size",
7212            "catalog_page_size",
7213            "catalog_restart_budget",
7214        ],
7215        effect_class: "read_only",
7216        risk_flags: &[],
7217        capability_family: "catalog",
7218        retry_safety: "safe",
7219        identity_requirement: "none",
7220        resolver: None,
7221        cancellation: "per_call",
7222        side_effects: &[],
7223        recovery: "retry",
7224        collection_index_ref: "none",
7225    },
7226    CommandSemanticContract {
7227        command: Command::GetComponentTemplate,
7228        admissible_errors: &[
7229            ErrorCode::Aborted,
7230            ErrorCode::DeadlineExceeded,
7231            ErrorCode::InvalidRequest,
7232            ErrorCode::UnsupportedVersion,
7233            ErrorCode::Unauthenticated,
7234            ErrorCode::PermissionDenied,
7235            ErrorCode::NotFound,
7236            ErrorCode::LimitExceeded,
7237            ErrorCode::CapabilityUnavailable,
7238            ErrorCode::TemporarilyUnavailable,
7239            ErrorCode::Internal,
7240        ],
7241        limit_ids: &["request_bytes", "response_bytes"],
7242        effect_class: "read_only",
7243        risk_flags: &[],
7244        capability_family: "catalog",
7245        retry_safety: "safe",
7246        identity_requirement: "none",
7247        resolver: None,
7248        cancellation: "per_call",
7249        side_effects: &[],
7250        recovery: "retry",
7251        collection_index_ref: "none",
7252    },
7253    CommandSemanticContract {
7254        command: Command::ListIndexTemplates,
7255        admissible_errors: &[
7256            ErrorCode::Aborted,
7257            ErrorCode::DeadlineExceeded,
7258            ErrorCode::InvalidRequest,
7259            ErrorCode::UnsupportedVersion,
7260            ErrorCode::Unauthenticated,
7261            ErrorCode::PermissionDenied,
7262            ErrorCode::NotFound,
7263            ErrorCode::StaleCursor,
7264            ErrorCode::RestartBudgetExhausted,
7265            ErrorCode::LimitExceeded,
7266            ErrorCode::CapabilityUnavailable,
7267            ErrorCode::TemporarilyUnavailable,
7268            ErrorCode::Internal,
7269        ],
7270        limit_ids: &[
7271            "request_bytes",
7272            "response_bytes",
7273            "page_size",
7274            "catalog_page_size",
7275            "catalog_restart_budget",
7276        ],
7277        effect_class: "read_only",
7278        risk_flags: &[],
7279        capability_family: "catalog",
7280        retry_safety: "safe",
7281        identity_requirement: "none",
7282        resolver: None,
7283        cancellation: "per_call",
7284        side_effects: &[],
7285        recovery: "retry",
7286        collection_index_ref: "none",
7287    },
7288    CommandSemanticContract {
7289        command: Command::GetIndexTemplate,
7290        admissible_errors: &[
7291            ErrorCode::Aborted,
7292            ErrorCode::DeadlineExceeded,
7293            ErrorCode::InvalidRequest,
7294            ErrorCode::UnsupportedVersion,
7295            ErrorCode::Unauthenticated,
7296            ErrorCode::PermissionDenied,
7297            ErrorCode::NotFound,
7298            ErrorCode::LimitExceeded,
7299            ErrorCode::CapabilityUnavailable,
7300            ErrorCode::TemporarilyUnavailable,
7301            ErrorCode::Internal,
7302        ],
7303        limit_ids: &["request_bytes", "response_bytes"],
7304        effect_class: "read_only",
7305        risk_flags: &[],
7306        capability_family: "catalog",
7307        retry_safety: "safe",
7308        identity_requirement: "none",
7309        resolver: None,
7310        cancellation: "per_call",
7311        side_effects: &[],
7312        recovery: "retry",
7313        collection_index_ref: "none",
7314    },
7315    CommandSemanticContract {
7316        command: Command::ListIngestPipelines,
7317        admissible_errors: &[
7318            ErrorCode::Aborted,
7319            ErrorCode::DeadlineExceeded,
7320            ErrorCode::InvalidRequest,
7321            ErrorCode::UnsupportedVersion,
7322            ErrorCode::Unauthenticated,
7323            ErrorCode::PermissionDenied,
7324            ErrorCode::NotFound,
7325            ErrorCode::StaleCursor,
7326            ErrorCode::RestartBudgetExhausted,
7327            ErrorCode::LimitExceeded,
7328            ErrorCode::CapabilityUnavailable,
7329            ErrorCode::TemporarilyUnavailable,
7330            ErrorCode::Internal,
7331        ],
7332        limit_ids: &[
7333            "request_bytes",
7334            "response_bytes",
7335            "page_size",
7336            "catalog_page_size",
7337            "catalog_restart_budget",
7338        ],
7339        effect_class: "read_only",
7340        risk_flags: &[],
7341        capability_family: "lifecycle",
7342        retry_safety: "safe",
7343        identity_requirement: "none",
7344        resolver: None,
7345        cancellation: "per_call",
7346        side_effects: &[],
7347        recovery: "retry",
7348        collection_index_ref: "none",
7349    },
7350    CommandSemanticContract {
7351        command: Command::GetIngestPipeline,
7352        admissible_errors: &[
7353            ErrorCode::Aborted,
7354            ErrorCode::DeadlineExceeded,
7355            ErrorCode::InvalidRequest,
7356            ErrorCode::UnsupportedVersion,
7357            ErrorCode::Unauthenticated,
7358            ErrorCode::PermissionDenied,
7359            ErrorCode::NotFound,
7360            ErrorCode::LimitExceeded,
7361            ErrorCode::CapabilityUnavailable,
7362            ErrorCode::TemporarilyUnavailable,
7363            ErrorCode::Internal,
7364        ],
7365        limit_ids: &["request_bytes", "response_bytes"],
7366        effect_class: "read_only",
7367        risk_flags: &[],
7368        capability_family: "lifecycle",
7369        retry_safety: "safe",
7370        identity_requirement: "none",
7371        resolver: None,
7372        cancellation: "per_call",
7373        side_effects: &[],
7374        recovery: "retry",
7375        collection_index_ref: "none",
7376    },
7377    CommandSemanticContract {
7378        command: Command::SimulateIngestPipeline,
7379        admissible_errors: &[
7380            ErrorCode::Aborted,
7381            ErrorCode::DeadlineExceeded,
7382            ErrorCode::InvalidRequest,
7383            ErrorCode::UnsupportedVersion,
7384            ErrorCode::Unauthenticated,
7385            ErrorCode::PermissionDenied,
7386            ErrorCode::NotFound,
7387            ErrorCode::LimitExceeded,
7388            ErrorCode::CapabilityUnavailable,
7389            ErrorCode::TemporarilyUnavailable,
7390            ErrorCode::Internal,
7391        ],
7392        limit_ids: &["request_bytes", "response_bytes"],
7393        effect_class: "read_only",
7394        risk_flags: &[],
7395        capability_family: "lifecycle",
7396        retry_safety: "safe",
7397        identity_requirement: "none",
7398        resolver: None,
7399        cancellation: "per_call",
7400        side_effects: &[],
7401        recovery: "retry",
7402        collection_index_ref: "none",
7403    },
7404    CommandSemanticContract {
7405        command: Command::ReprocessByQuery,
7406        admissible_errors: &[
7407            ErrorCode::Aborted,
7408            ErrorCode::DeadlineExceeded,
7409            ErrorCode::InvalidRequest,
7410            ErrorCode::UnsupportedVersion,
7411            ErrorCode::Unauthenticated,
7412            ErrorCode::PermissionDenied,
7413            ErrorCode::NotFound,
7414            ErrorCode::Conflict,
7415            ErrorCode::LimitExceeded,
7416            ErrorCode::CapabilityUnavailable,
7417            ErrorCode::NotSubmitted,
7418            ErrorCode::SubmittedIndeterminate,
7419            ErrorCode::ExpiredUnknown,
7420            ErrorCode::TemporarilyUnavailable,
7421            ErrorCode::Internal,
7422        ],
7423        limit_ids: &["request_bytes", "response_bytes"],
7424        effect_class: "durable_submit",
7425        risk_flags: &[],
7426        capability_family: "data",
7427        retry_safety: "safe",
7428        identity_requirement: "caller_action_id",
7429        resolver: None,
7430        cancellation: "per_call_until_submission_then_resolve",
7431        side_effects: &["commits_authoritative_state"],
7432        recovery: "retry",
7433        collection_index_ref: "request_index",
7434    },
7435    CommandSemanticContract {
7436        command: Command::ListLifecyclePolicies,
7437        admissible_errors: &[
7438            ErrorCode::Aborted,
7439            ErrorCode::DeadlineExceeded,
7440            ErrorCode::InvalidRequest,
7441            ErrorCode::UnsupportedVersion,
7442            ErrorCode::Unauthenticated,
7443            ErrorCode::PermissionDenied,
7444            ErrorCode::NotFound,
7445            ErrorCode::StaleCursor,
7446            ErrorCode::RestartBudgetExhausted,
7447            ErrorCode::LimitExceeded,
7448            ErrorCode::CapabilityUnavailable,
7449            ErrorCode::TemporarilyUnavailable,
7450            ErrorCode::Internal,
7451        ],
7452        limit_ids: &[
7453            "request_bytes",
7454            "response_bytes",
7455            "page_size",
7456            "catalog_page_size",
7457            "catalog_restart_budget",
7458        ],
7459        effect_class: "read_only",
7460        risk_flags: &[],
7461        capability_family: "catalog",
7462        retry_safety: "safe",
7463        identity_requirement: "none",
7464        resolver: None,
7465        cancellation: "per_call",
7466        side_effects: &[],
7467        recovery: "retry",
7468        collection_index_ref: "none",
7469    },
7470    CommandSemanticContract {
7471        command: Command::GetLifecyclePolicy,
7472        admissible_errors: &[
7473            ErrorCode::Aborted,
7474            ErrorCode::DeadlineExceeded,
7475            ErrorCode::InvalidRequest,
7476            ErrorCode::UnsupportedVersion,
7477            ErrorCode::Unauthenticated,
7478            ErrorCode::PermissionDenied,
7479            ErrorCode::NotFound,
7480            ErrorCode::LimitExceeded,
7481            ErrorCode::CapabilityUnavailable,
7482            ErrorCode::TemporarilyUnavailable,
7483            ErrorCode::Internal,
7484        ],
7485        limit_ids: &["request_bytes", "response_bytes"],
7486        effect_class: "read_only",
7487        risk_flags: &[],
7488        capability_family: "catalog",
7489        retry_safety: "safe",
7490        identity_requirement: "none",
7491        resolver: None,
7492        cancellation: "per_call",
7493        side_effects: &[],
7494        recovery: "retry",
7495        collection_index_ref: "none",
7496    },
7497    CommandSemanticContract {
7498        command: Command::PrepareCreateIndex,
7499        admissible_errors: &[
7500            ErrorCode::Aborted,
7501            ErrorCode::DeadlineExceeded,
7502            ErrorCode::InvalidRequest,
7503            ErrorCode::UnsupportedVersion,
7504            ErrorCode::Unauthenticated,
7505            ErrorCode::PermissionDenied,
7506            ErrorCode::NotFound,
7507            ErrorCode::LimitExceeded,
7508            ErrorCode::CapabilityUnavailable,
7509            ErrorCode::TemporarilyUnavailable,
7510            ErrorCode::Internal,
7511        ],
7512        limit_ids: &[
7513            "request_bytes",
7514            "response_bytes",
7515            "resource_initial_shards",
7516            "resource_target_shard_bytes",
7517            "resource_admission_weight",
7518            "resource_ram_bytes",
7519            "resource_nvme_bytes",
7520            "resource_refresh_millis",
7521            "resource_memtable_bytes",
7522            "resource_parallelism",
7523        ],
7524        effect_class: "prepare",
7525        risk_flags: &[],
7526        capability_family: "catalog",
7527        retry_safety: "safe",
7528        identity_requirement: "server_locator",
7529        resolver: None,
7530        cancellation: "per_call",
7531        side_effects: &["creates_bounded_preparation"],
7532        recovery: "retry",
7533        collection_index_ref: "request_name",
7534    },
7535    CommandSemanticContract {
7536        command: Command::PrepareDeleteIndex,
7537        admissible_errors: &[
7538            ErrorCode::Aborted,
7539            ErrorCode::DeadlineExceeded,
7540            ErrorCode::InvalidRequest,
7541            ErrorCode::UnsupportedVersion,
7542            ErrorCode::Unauthenticated,
7543            ErrorCode::PermissionDenied,
7544            ErrorCode::NotFound,
7545            ErrorCode::LimitExceeded,
7546            ErrorCode::CapabilityUnavailable,
7547            ErrorCode::TemporarilyUnavailable,
7548            ErrorCode::Internal,
7549        ],
7550        limit_ids: &["request_bytes", "response_bytes"],
7551        effect_class: "prepare",
7552        risk_flags: &["destructive"],
7553        capability_family: "catalog",
7554        retry_safety: "safe",
7555        identity_requirement: "server_locator",
7556        resolver: None,
7557        cancellation: "per_call",
7558        side_effects: &["creates_bounded_preparation"],
7559        recovery: "retry",
7560        collection_index_ref: "request_name",
7561    },
7562    CommandSemanticContract {
7563        command: Command::SubmitCatalogAction,
7564        admissible_errors: &[
7565            ErrorCode::Aborted,
7566            ErrorCode::DeadlineExceeded,
7567            ErrorCode::InvalidRequest,
7568            ErrorCode::UnsupportedVersion,
7569            ErrorCode::Unauthenticated,
7570            ErrorCode::PermissionDenied,
7571            ErrorCode::NotFound,
7572            ErrorCode::Conflict,
7573            ErrorCode::LimitExceeded,
7574            ErrorCode::CapabilityUnavailable,
7575            ErrorCode::NotSubmitted,
7576            ErrorCode::SubmittedIndeterminate,
7577            ErrorCode::ExpiredUnknown,
7578            ErrorCode::TemporarilyUnavailable,
7579            ErrorCode::Internal,
7580        ],
7581        limit_ids: &[
7582            "request_bytes",
7583            "response_bytes",
7584            "resource_initial_shards",
7585            "resource_target_shard_bytes",
7586            "resource_admission_weight",
7587            "resource_ram_bytes",
7588            "resource_nvme_bytes",
7589            "resource_refresh_millis",
7590            "resource_memtable_bytes",
7591            "resource_parallelism",
7592        ],
7593        effect_class: "durable_submit",
7594        risk_flags: &[],
7595        capability_family: "catalog",
7596        retry_safety: "pre_submit_only",
7597        identity_requirement: "request_locator",
7598        resolver: Some(Command::ResolveCatalogAction),
7599        cancellation: "per_call_until_submission_then_resolve",
7600        side_effects: &["commits_authoritative_state"],
7601        recovery: "resolve_with_resolve_catalog_action",
7602        collection_index_ref: "request_name",
7603    },
7604    CommandSemanticContract {
7605        command: Command::ResolveCatalogAction,
7606        admissible_errors: &[
7607            ErrorCode::Aborted,
7608            ErrorCode::DeadlineExceeded,
7609            ErrorCode::InvalidRequest,
7610            ErrorCode::UnsupportedVersion,
7611            ErrorCode::Unauthenticated,
7612            ErrorCode::PermissionDenied,
7613            ErrorCode::NotFound,
7614            ErrorCode::LimitExceeded,
7615            ErrorCode::CapabilityUnavailable,
7616            ErrorCode::TemporarilyUnavailable,
7617            ErrorCode::Internal,
7618        ],
7619        limit_ids: &["request_bytes", "response_bytes"],
7620        effect_class: "read_only",
7621        risk_flags: &[],
7622        capability_family: "catalog",
7623        retry_safety: "safe",
7624        identity_requirement: "request_locator",
7625        resolver: None,
7626        cancellation: "per_call",
7627        side_effects: &[],
7628        recovery: "retry",
7629        collection_index_ref: "caller",
7630    },
7631    CommandSemanticContract {
7632        command: Command::PrepareReplayableSourceIndex,
7633        admissible_errors: &[
7634            ErrorCode::Aborted,
7635            ErrorCode::DeadlineExceeded,
7636            ErrorCode::InvalidRequest,
7637            ErrorCode::UnsupportedVersion,
7638            ErrorCode::Unauthenticated,
7639            ErrorCode::PermissionDenied,
7640            ErrorCode::NotFound,
7641            ErrorCode::LimitExceeded,
7642            ErrorCode::CapabilityUnavailable,
7643            ErrorCode::RetentionGap,
7644            ErrorCode::TemporarilyUnavailable,
7645            ErrorCode::Internal,
7646        ],
7647        limit_ids: &[
7648            "request_bytes",
7649            "response_bytes",
7650            "resource_initial_shards",
7651            "resource_target_shard_bytes",
7652            "resource_admission_weight",
7653            "resource_ram_bytes",
7654            "resource_nvme_bytes",
7655            "resource_refresh_millis",
7656            "resource_memtable_bytes",
7657            "resource_parallelism",
7658        ],
7659        effect_class: "prepare",
7660        risk_flags: &[],
7661        capability_family: "catalog",
7662        retry_safety: "safe",
7663        identity_requirement: "server_locator",
7664        resolver: None,
7665        cancellation: "per_call",
7666        side_effects: &["creates_bounded_preparation"],
7667        recovery: "retry",
7668        collection_index_ref: "request_name",
7669    },
7670    CommandSemanticContract {
7671        command: Command::SubmitReplayableSourceIndex,
7672        admissible_errors: &[
7673            ErrorCode::Aborted,
7674            ErrorCode::DeadlineExceeded,
7675            ErrorCode::InvalidRequest,
7676            ErrorCode::UnsupportedVersion,
7677            ErrorCode::Unauthenticated,
7678            ErrorCode::PermissionDenied,
7679            ErrorCode::NotFound,
7680            ErrorCode::Conflict,
7681            ErrorCode::LimitExceeded,
7682            ErrorCode::CapabilityUnavailable,
7683            ErrorCode::NotSubmitted,
7684            ErrorCode::SubmittedIndeterminate,
7685            ErrorCode::ExpiredUnknown,
7686            ErrorCode::RetentionGap,
7687            ErrorCode::TemporarilyUnavailable,
7688            ErrorCode::Internal,
7689        ],
7690        limit_ids: &[
7691            "request_bytes",
7692            "response_bytes",
7693            "resource_initial_shards",
7694            "resource_target_shard_bytes",
7695            "resource_admission_weight",
7696            "resource_ram_bytes",
7697            "resource_nvme_bytes",
7698            "resource_refresh_millis",
7699            "resource_memtable_bytes",
7700            "resource_parallelism",
7701        ],
7702        effect_class: "durable_submit",
7703        risk_flags: &[],
7704        capability_family: "catalog",
7705        retry_safety: "pre_submit_only",
7706        identity_requirement: "request_locator",
7707        resolver: Some(Command::ResolveCatalogAction),
7708        cancellation: "per_call_until_submission_then_resolve",
7709        side_effects: &["commits_authoritative_state"],
7710        recovery: "resolve_with_resolve_catalog_action",
7711        collection_index_ref: "request_name",
7712    },
7713    CommandSemanticContract {
7714        command: Command::GetReplayableSource,
7715        admissible_errors: &[
7716            ErrorCode::Aborted,
7717            ErrorCode::DeadlineExceeded,
7718            ErrorCode::InvalidRequest,
7719            ErrorCode::UnsupportedVersion,
7720            ErrorCode::Unauthenticated,
7721            ErrorCode::PermissionDenied,
7722            ErrorCode::NotFound,
7723            ErrorCode::LimitExceeded,
7724            ErrorCode::CapabilityUnavailable,
7725            ErrorCode::RetentionGap,
7726            ErrorCode::TemporarilyUnavailable,
7727            ErrorCode::Internal,
7728        ],
7729        limit_ids: &["request_bytes", "response_bytes"],
7730        effect_class: "read_only",
7731        risk_flags: &[],
7732        capability_family: "catalog",
7733        retry_safety: "safe",
7734        identity_requirement: "none",
7735        resolver: None,
7736        cancellation: "per_call",
7737        side_effects: &[],
7738        recovery: "retry",
7739        collection_index_ref: "none",
7740    },
7741    CommandSemanticContract {
7742        command: Command::ControlReplayableSource,
7743        admissible_errors: &[
7744            ErrorCode::Aborted,
7745            ErrorCode::DeadlineExceeded,
7746            ErrorCode::InvalidRequest,
7747            ErrorCode::UnsupportedVersion,
7748            ErrorCode::Unauthenticated,
7749            ErrorCode::PermissionDenied,
7750            ErrorCode::NotFound,
7751            ErrorCode::Conflict,
7752            ErrorCode::LimitExceeded,
7753            ErrorCode::CapabilityUnavailable,
7754            ErrorCode::NotSubmitted,
7755            ErrorCode::SubmittedIndeterminate,
7756            ErrorCode::ExpiredUnknown,
7757            ErrorCode::RetentionGap,
7758            ErrorCode::TemporarilyUnavailable,
7759            ErrorCode::Internal,
7760        ],
7761        limit_ids: &["request_bytes", "response_bytes"],
7762        effect_class: "durable_submit",
7763        risk_flags: &[],
7764        capability_family: "catalog",
7765        retry_safety: "pre_submit_only",
7766        identity_requirement: "none",
7767        resolver: None,
7768        cancellation: "per_call_until_submission_then_resolve",
7769        side_effects: &["commits_authoritative_state"],
7770        recovery: "retry_if_not_submitted",
7771        collection_index_ref: "request_index",
7772    },
7773    CommandSemanticContract {
7774        command: Command::CloneIndex,
7775        admissible_errors: &[
7776            ErrorCode::Aborted,
7777            ErrorCode::DeadlineExceeded,
7778            ErrorCode::InvalidRequest,
7779            ErrorCode::UnsupportedVersion,
7780            ErrorCode::Unauthenticated,
7781            ErrorCode::PermissionDenied,
7782            ErrorCode::NotFound,
7783            ErrorCode::Conflict,
7784            ErrorCode::LimitExceeded,
7785            ErrorCode::CapabilityUnavailable,
7786            ErrorCode::NotSubmitted,
7787            ErrorCode::SubmittedIndeterminate,
7788            ErrorCode::ExpiredUnknown,
7789            ErrorCode::TemporarilyUnavailable,
7790            ErrorCode::Internal,
7791        ],
7792        limit_ids: &["request_bytes", "response_bytes"],
7793        effect_class: "durable_submit",
7794        risk_flags: &[],
7795        capability_family: "catalog",
7796        retry_safety: "pre_submit_only",
7797        identity_requirement: "caller_action_id",
7798        resolver: Some(Command::CloneIndex),
7799        cancellation: "per_call_until_submission_then_resolve",
7800        side_effects: &["commits_authoritative_state"],
7801        recovery: "resolve_with_clone_index",
7802        collection_index_ref: "caller",
7803    },
7804    CommandSemanticContract {
7805        command: Command::ConfigureHistory,
7806        admissible_errors: &[
7807            ErrorCode::Aborted,
7808            ErrorCode::DeadlineExceeded,
7809            ErrorCode::InvalidRequest,
7810            ErrorCode::UnsupportedVersion,
7811            ErrorCode::Unauthenticated,
7812            ErrorCode::PermissionDenied,
7813            ErrorCode::NotFound,
7814            ErrorCode::Conflict,
7815            ErrorCode::LimitExceeded,
7816            ErrorCode::CapabilityUnavailable,
7817            ErrorCode::NotSubmitted,
7818            ErrorCode::SubmittedIndeterminate,
7819            ErrorCode::ExpiredUnknown,
7820            ErrorCode::TemporarilyUnavailable,
7821            ErrorCode::Internal,
7822        ],
7823        limit_ids: &["request_bytes", "response_bytes"],
7824        effect_class: "durable_submit",
7825        risk_flags: &[],
7826        capability_family: "catalog",
7827        retry_safety: "pre_submit_only",
7828        identity_requirement: "none",
7829        resolver: Some(Command::GetHistory),
7830        cancellation: "per_call_until_submission_then_resolve",
7831        side_effects: &["commits_authoritative_state"],
7832        recovery: "resolve_with_get_history",
7833        collection_index_ref: "request_index",
7834    },
7835    CommandSemanticContract {
7836        command: Command::GetHistory,
7837        admissible_errors: &[
7838            ErrorCode::Aborted,
7839            ErrorCode::DeadlineExceeded,
7840            ErrorCode::InvalidRequest,
7841            ErrorCode::UnsupportedVersion,
7842            ErrorCode::Unauthenticated,
7843            ErrorCode::PermissionDenied,
7844            ErrorCode::NotFound,
7845            ErrorCode::LimitExceeded,
7846            ErrorCode::CapabilityUnavailable,
7847            ErrorCode::TemporarilyUnavailable,
7848            ErrorCode::Internal,
7849        ],
7850        limit_ids: &["request_bytes", "response_bytes"],
7851        effect_class: "read_only",
7852        risk_flags: &[],
7853        capability_family: "catalog",
7854        retry_safety: "safe",
7855        identity_requirement: "none",
7856        resolver: None,
7857        cancellation: "per_call",
7858        side_effects: &[],
7859        recovery: "retry",
7860        collection_index_ref: "none",
7861    },
7862    CommandSemanticContract {
7863        command: Command::ResolveHistory,
7864        admissible_errors: &[
7865            ErrorCode::Aborted,
7866            ErrorCode::DeadlineExceeded,
7867            ErrorCode::InvalidRequest,
7868            ErrorCode::UnsupportedVersion,
7869            ErrorCode::Unauthenticated,
7870            ErrorCode::PermissionDenied,
7871            ErrorCode::NotFound,
7872            ErrorCode::LimitExceeded,
7873            ErrorCode::CapabilityUnavailable,
7874            ErrorCode::RetentionGap,
7875            ErrorCode::TemporarilyUnavailable,
7876            ErrorCode::Internal,
7877        ],
7878        limit_ids: &["request_bytes", "response_bytes"],
7879        effect_class: "read_only",
7880        risk_flags: &[],
7881        capability_family: "data",
7882        retry_safety: "safe",
7883        identity_requirement: "none",
7884        resolver: None,
7885        cancellation: "per_call",
7886        side_effects: &[],
7887        recovery: "retry",
7888        collection_index_ref: "request_index",
7889    },
7890    CommandSemanticContract {
7891        command: Command::PlaceHistoryHold,
7892        admissible_errors: &[
7893            ErrorCode::Aborted,
7894            ErrorCode::DeadlineExceeded,
7895            ErrorCode::InvalidRequest,
7896            ErrorCode::UnsupportedVersion,
7897            ErrorCode::Unauthenticated,
7898            ErrorCode::PermissionDenied,
7899            ErrorCode::NotFound,
7900            ErrorCode::Conflict,
7901            ErrorCode::LimitExceeded,
7902            ErrorCode::CapabilityUnavailable,
7903            ErrorCode::NotSubmitted,
7904            ErrorCode::SubmittedIndeterminate,
7905            ErrorCode::ExpiredUnknown,
7906            ErrorCode::TemporarilyUnavailable,
7907            ErrorCode::Internal,
7908        ],
7909        limit_ids: &["request_bytes", "response_bytes"],
7910        effect_class: "durable_submit",
7911        risk_flags: &[],
7912        capability_family: "catalog",
7913        retry_safety: "pre_submit_only",
7914        identity_requirement: "none",
7915        resolver: Some(Command::GetHistory),
7916        cancellation: "per_call_until_submission_then_resolve",
7917        side_effects: &["commits_authoritative_state"],
7918        recovery: "resolve_with_get_history",
7919        collection_index_ref: "request_index",
7920    },
7921    CommandSemanticContract {
7922        command: Command::ReleaseHistoryHold,
7923        admissible_errors: &[
7924            ErrorCode::Aborted,
7925            ErrorCode::DeadlineExceeded,
7926            ErrorCode::InvalidRequest,
7927            ErrorCode::UnsupportedVersion,
7928            ErrorCode::Unauthenticated,
7929            ErrorCode::PermissionDenied,
7930            ErrorCode::NotFound,
7931            ErrorCode::Conflict,
7932            ErrorCode::LimitExceeded,
7933            ErrorCode::CapabilityUnavailable,
7934            ErrorCode::NotSubmitted,
7935            ErrorCode::SubmittedIndeterminate,
7936            ErrorCode::ExpiredUnknown,
7937            ErrorCode::TemporarilyUnavailable,
7938            ErrorCode::Internal,
7939        ],
7940        limit_ids: &["request_bytes", "response_bytes"],
7941        effect_class: "durable_submit",
7942        risk_flags: &[],
7943        capability_family: "catalog",
7944        retry_safety: "pre_submit_only",
7945        identity_requirement: "none",
7946        resolver: Some(Command::GetHistory),
7947        cancellation: "per_call_until_submission_then_resolve",
7948        side_effects: &["commits_authoritative_state"],
7949        recovery: "resolve_with_get_history",
7950        collection_index_ref: "request_index",
7951    },
7952    CommandSemanticContract {
7953        command: Command::PrepareDocumentMutation,
7954        admissible_errors: &[
7955            ErrorCode::Aborted,
7956            ErrorCode::DeadlineExceeded,
7957            ErrorCode::InvalidRequest,
7958            ErrorCode::UnsupportedVersion,
7959            ErrorCode::Unauthenticated,
7960            ErrorCode::PermissionDenied,
7961            ErrorCode::NotFound,
7962            ErrorCode::LimitExceeded,
7963            ErrorCode::CapabilityUnavailable,
7964            ErrorCode::TemporarilyUnavailable,
7965            ErrorCode::Internal,
7966        ],
7967        limit_ids: &["request_bytes", "response_bytes"],
7968        effect_class: "prepare",
7969        risk_flags: &[],
7970        capability_family: "data",
7971        retry_safety: "safe",
7972        identity_requirement: "server_locator",
7973        resolver: None,
7974        cancellation: "per_call",
7975        side_effects: &["creates_bounded_preparation"],
7976        recovery: "retry",
7977        collection_index_ref: "request_index",
7978    },
7979    CommandSemanticContract {
7980        command: Command::SubmitDocumentMutation,
7981        admissible_errors: &[
7982            ErrorCode::Aborted,
7983            ErrorCode::DeadlineExceeded,
7984            ErrorCode::InvalidRequest,
7985            ErrorCode::UnsupportedVersion,
7986            ErrorCode::Unauthenticated,
7987            ErrorCode::PermissionDenied,
7988            ErrorCode::NotFound,
7989            ErrorCode::Conflict,
7990            ErrorCode::LimitExceeded,
7991            ErrorCode::CapabilityUnavailable,
7992            ErrorCode::NotSubmitted,
7993            ErrorCode::SubmittedIndeterminate,
7994            ErrorCode::ExpiredUnknown,
7995            ErrorCode::TemporarilyUnavailable,
7996            ErrorCode::Internal,
7997        ],
7998        limit_ids: &["request_bytes", "response_bytes"],
7999        effect_class: "durable_submit",
8000        risk_flags: &[],
8001        capability_family: "data",
8002        retry_safety: "pre_submit_only",
8003        identity_requirement: "request_locator",
8004        resolver: Some(Command::ResolveDocumentMutation),
8005        cancellation: "per_call_until_submission_then_resolve",
8006        side_effects: &["commits_authoritative_state"],
8007        recovery: "resolve_with_resolve_document_mutation",
8008        collection_index_ref: "request_index",
8009    },
8010    CommandSemanticContract {
8011        command: Command::PrepareDocumentBulk,
8012        admissible_errors: &[
8013            ErrorCode::Aborted,
8014            ErrorCode::DeadlineExceeded,
8015            ErrorCode::InvalidRequest,
8016            ErrorCode::UnsupportedVersion,
8017            ErrorCode::Unauthenticated,
8018            ErrorCode::PermissionDenied,
8019            ErrorCode::NotFound,
8020            ErrorCode::LimitExceeded,
8021            ErrorCode::CapabilityUnavailable,
8022            ErrorCode::TemporarilyUnavailable,
8023            ErrorCode::Internal,
8024        ],
8025        limit_ids: &[
8026            "request_bytes",
8027            "response_bytes",
8028            "bulk_document_items",
8029            "bulk_document_bytes",
8030        ],
8031        effect_class: "prepare",
8032        risk_flags: &[],
8033        capability_family: "data",
8034        retry_safety: "safe",
8035        identity_requirement: "caller_action_id",
8036        resolver: None,
8037        cancellation: "per_call",
8038        side_effects: &["creates_bounded_preparation"],
8039        recovery: "retry",
8040        collection_index_ref: "request_index",
8041    },
8042    CommandSemanticContract {
8043        command: Command::SubmitDocumentBulk,
8044        admissible_errors: &[
8045            ErrorCode::Aborted,
8046            ErrorCode::DeadlineExceeded,
8047            ErrorCode::InvalidRequest,
8048            ErrorCode::UnsupportedVersion,
8049            ErrorCode::Unauthenticated,
8050            ErrorCode::PermissionDenied,
8051            ErrorCode::NotFound,
8052            ErrorCode::Conflict,
8053            ErrorCode::LimitExceeded,
8054            ErrorCode::CapabilityUnavailable,
8055            ErrorCode::NotSubmitted,
8056            ErrorCode::SubmittedIndeterminate,
8057            ErrorCode::ExpiredUnknown,
8058            ErrorCode::TemporarilyUnavailable,
8059            ErrorCode::Internal,
8060        ],
8061        limit_ids: &[
8062            "request_bytes",
8063            "response_bytes",
8064            "bulk_document_items",
8065            "bulk_document_bytes",
8066        ],
8067        effect_class: "durable_submit",
8068        risk_flags: &[],
8069        capability_family: "data",
8070        retry_safety: "pre_submit_only",
8071        identity_requirement: "caller_action_id",
8072        resolver: Some(Command::ResolveDocumentBulk),
8073        cancellation: "per_call_until_submission_then_resolve",
8074        side_effects: &["commits_authoritative_state"],
8075        recovery: "resolve_with_resolve_document_bulk",
8076        collection_index_ref: "request_index",
8077    },
8078    CommandSemanticContract {
8079        command: Command::ResolveDocumentBulk,
8080        admissible_errors: &[
8081            ErrorCode::Aborted,
8082            ErrorCode::DeadlineExceeded,
8083            ErrorCode::InvalidRequest,
8084            ErrorCode::UnsupportedVersion,
8085            ErrorCode::Unauthenticated,
8086            ErrorCode::PermissionDenied,
8087            ErrorCode::NotFound,
8088            ErrorCode::LimitExceeded,
8089            ErrorCode::CapabilityUnavailable,
8090            ErrorCode::TemporarilyUnavailable,
8091            ErrorCode::Internal,
8092        ],
8093        limit_ids: &[
8094            "request_bytes",
8095            "response_bytes",
8096            "bulk_document_items",
8097            "bulk_document_bytes",
8098        ],
8099        effect_class: "read_only",
8100        risk_flags: &[],
8101        capability_family: "data",
8102        retry_safety: "safe",
8103        identity_requirement: "caller_action_id",
8104        resolver: None,
8105        cancellation: "per_call",
8106        side_effects: &[],
8107        recovery: "retry",
8108        collection_index_ref: "request_index",
8109    },
8110    CommandSemanticContract {
8111        command: Command::PrepareAppendBulk,
8112        admissible_errors: &[
8113            ErrorCode::Aborted,
8114            ErrorCode::DeadlineExceeded,
8115            ErrorCode::InvalidRequest,
8116            ErrorCode::UnsupportedVersion,
8117            ErrorCode::Unauthenticated,
8118            ErrorCode::PermissionDenied,
8119            ErrorCode::NotFound,
8120            ErrorCode::LimitExceeded,
8121            ErrorCode::CapabilityUnavailable,
8122            ErrorCode::TemporarilyUnavailable,
8123            ErrorCode::Internal,
8124        ],
8125        limit_ids: &[
8126            "request_bytes",
8127            "response_bytes",
8128            "bulk_document_items",
8129            "bulk_document_bytes",
8130        ],
8131        effect_class: "prepare",
8132        risk_flags: &[],
8133        capability_family: "data",
8134        retry_safety: "safe",
8135        identity_requirement: "caller_action_id",
8136        resolver: None,
8137        cancellation: "per_call",
8138        side_effects: &[],
8139        recovery: "retry",
8140        collection_index_ref: "request_index",
8141    },
8142    CommandSemanticContract {
8143        command: Command::SubmitAppendBulk,
8144        admissible_errors: &[
8145            ErrorCode::Aborted,
8146            ErrorCode::DeadlineExceeded,
8147            ErrorCode::InvalidRequest,
8148            ErrorCode::UnsupportedVersion,
8149            ErrorCode::Unauthenticated,
8150            ErrorCode::PermissionDenied,
8151            ErrorCode::NotFound,
8152            ErrorCode::Conflict,
8153            ErrorCode::LimitExceeded,
8154            ErrorCode::CapabilityUnavailable,
8155            ErrorCode::NotSubmitted,
8156            ErrorCode::SubmittedIndeterminate,
8157            ErrorCode::TemporarilyUnavailable,
8158            ErrorCode::Internal,
8159        ],
8160        limit_ids: &[
8161            "request_bytes",
8162            "response_bytes",
8163            "bulk_document_items",
8164            "bulk_document_bytes",
8165        ],
8166        effect_class: "durable_submit",
8167        risk_flags: &[],
8168        capability_family: "data",
8169        retry_safety: "pre_submit_only",
8170        identity_requirement: "request_locator",
8171        resolver: Some(Command::ResolveAppendBulk),
8172        cancellation: "per_call_until_submission_then_resolve",
8173        side_effects: &["commits_authoritative_state"],
8174        recovery: "resolve_with_resolve_append_bulk",
8175        collection_index_ref: "request_index",
8176    },
8177    CommandSemanticContract {
8178        command: Command::ResolveAppendBulk,
8179        admissible_errors: &[
8180            ErrorCode::Aborted,
8181            ErrorCode::DeadlineExceeded,
8182            ErrorCode::InvalidRequest,
8183            ErrorCode::UnsupportedVersion,
8184            ErrorCode::Unauthenticated,
8185            ErrorCode::PermissionDenied,
8186            ErrorCode::NotFound,
8187            ErrorCode::Conflict,
8188            ErrorCode::LimitExceeded,
8189            ErrorCode::CapabilityUnavailable,
8190            ErrorCode::TemporarilyUnavailable,
8191            ErrorCode::Internal,
8192        ],
8193        limit_ids: &[
8194            "request_bytes",
8195            "response_bytes",
8196            "bulk_document_items",
8197            "bulk_document_bytes",
8198        ],
8199        effect_class: "read_only",
8200        risk_flags: &[],
8201        capability_family: "data",
8202        retry_safety: "safe",
8203        identity_requirement: "request_locator",
8204        resolver: None,
8205        cancellation: "per_call",
8206        side_effects: &[],
8207        recovery: "retry",
8208        collection_index_ref: "request_index",
8209    },
8210    CommandSemanticContract {
8211        command: Command::ObserveAppendCommitted,
8212        admissible_errors: &[
8213            ErrorCode::Aborted,
8214            ErrorCode::DeadlineExceeded,
8215            ErrorCode::InvalidRequest,
8216            ErrorCode::UnsupportedVersion,
8217            ErrorCode::Unauthenticated,
8218            ErrorCode::PermissionDenied,
8219            ErrorCode::NotFound,
8220            ErrorCode::Conflict,
8221            ErrorCode::LimitExceeded,
8222            ErrorCode::CapabilityUnavailable,
8223            ErrorCode::TemporarilyUnavailable,
8224            ErrorCode::Internal,
8225        ],
8226        limit_ids: &["request_bytes", "response_bytes"],
8227        effect_class: "read_only",
8228        risk_flags: &[],
8229        capability_family: "data",
8230        retry_safety: "safe",
8231        identity_requirement: "request_locator",
8232        resolver: None,
8233        cancellation: "per_call",
8234        side_effects: &[],
8235        recovery: "retry",
8236        collection_index_ref: "request_index",
8237    },
8238    CommandSemanticContract {
8239        command: Command::ResolveDocumentMutation,
8240        admissible_errors: &[
8241            ErrorCode::Aborted,
8242            ErrorCode::DeadlineExceeded,
8243            ErrorCode::InvalidRequest,
8244            ErrorCode::UnsupportedVersion,
8245            ErrorCode::Unauthenticated,
8246            ErrorCode::PermissionDenied,
8247            ErrorCode::NotFound,
8248            ErrorCode::LimitExceeded,
8249            ErrorCode::CapabilityUnavailable,
8250            ErrorCode::TemporarilyUnavailable,
8251            ErrorCode::Internal,
8252        ],
8253        limit_ids: &["request_bytes", "response_bytes"],
8254        effect_class: "read_only",
8255        risk_flags: &[],
8256        capability_family: "data",
8257        retry_safety: "safe",
8258        identity_requirement: "request_locator",
8259        resolver: None,
8260        cancellation: "per_call",
8261        side_effects: &[],
8262        recovery: "retry",
8263        collection_index_ref: "caller",
8264    },
8265    CommandSemanticContract {
8266        command: Command::GetDocument,
8267        admissible_errors: &[
8268            ErrorCode::Aborted,
8269            ErrorCode::DeadlineExceeded,
8270            ErrorCode::InvalidRequest,
8271            ErrorCode::UnsupportedVersion,
8272            ErrorCode::Unauthenticated,
8273            ErrorCode::PermissionDenied,
8274            ErrorCode::NotFound,
8275            ErrorCode::LimitExceeded,
8276            ErrorCode::CapabilityUnavailable,
8277            ErrorCode::TemporarilyUnavailable,
8278            ErrorCode::Internal,
8279        ],
8280        limit_ids: &["request_bytes", "response_bytes"],
8281        effect_class: "read_only",
8282        risk_flags: &[],
8283        capability_family: "data",
8284        retry_safety: "safe",
8285        identity_requirement: "none",
8286        resolver: None,
8287        cancellation: "per_call",
8288        side_effects: &[],
8289        recovery: "retry",
8290        collection_index_ref: "request_index",
8291    },
8292    CommandSemanticContract {
8293        command: Command::Search,
8294        admissible_errors: &[
8295            ErrorCode::Aborted,
8296            ErrorCode::DeadlineExceeded,
8297            ErrorCode::InvalidRequest,
8298            ErrorCode::UnsupportedVersion,
8299            ErrorCode::Unauthenticated,
8300            ErrorCode::PermissionDenied,
8301            ErrorCode::NotFound,
8302            ErrorCode::StaleCursor,
8303            ErrorCode::RestartBudgetExhausted,
8304            ErrorCode::LimitExceeded,
8305            ErrorCode::CapabilityUnavailable,
8306            ErrorCode::TemporarilyUnavailable,
8307            ErrorCode::Internal,
8308        ],
8309        limit_ids: &[
8310            "request_bytes",
8311            "response_bytes",
8312            "page_size",
8313            "query_clauses",
8314            "aggregation_nodes",
8315            "aggregation_buckets",
8316            "routing_values",
8317            "routing_value_bytes",
8318            "query_recursion_depth",
8319            "text_query_bytes",
8320            "text_query_fields",
8321            "text_query_slop",
8322            "text_query_boost",
8323            "text_query_fuzzy_expansions",
8324            "text_query_fuzzy_distance",
8325            "text_query_dictionary_scan_terms",
8326            "text_query_dictionary_scan_bytes",
8327            "text_query_fuzzy_work_units",
8328            "vector_dimensions",
8329            "vector_candidates",
8330        ],
8331        effect_class: "read_only",
8332        risk_flags: &[],
8333        capability_family: "data",
8334        retry_safety: "safe",
8335        identity_requirement: "none",
8336        resolver: None,
8337        cancellation: "per_call",
8338        side_effects: &[],
8339        recovery: "retry",
8340        collection_index_ref: "request_indexes_or_pit_authority",
8341    },
8342    CommandSemanticContract {
8343        command: Command::OpenPit,
8344        admissible_errors: &[
8345            ErrorCode::Aborted,
8346            ErrorCode::DeadlineExceeded,
8347            ErrorCode::InvalidRequest,
8348            ErrorCode::UnsupportedVersion,
8349            ErrorCode::Unauthenticated,
8350            ErrorCode::PermissionDenied,
8351            ErrorCode::NotFound,
8352            ErrorCode::Conflict,
8353            ErrorCode::LimitExceeded,
8354            ErrorCode::CapabilityUnavailable,
8355            ErrorCode::NotSubmitted,
8356            ErrorCode::SubmittedIndeterminate,
8357            ErrorCode::ExpiredUnknown,
8358            ErrorCode::TemporarilyUnavailable,
8359            ErrorCode::Internal,
8360        ],
8361        limit_ids: &["request_bytes", "response_bytes"],
8362        effect_class: "lease_renewing_read",
8363        risk_flags: &[],
8364        capability_family: "data",
8365        retry_safety: "pre_submit_only",
8366        identity_requirement: "none",
8367        resolver: None,
8368        cancellation: "per_call_until_submission_then_resolve",
8369        side_effects: &["renews_or_closes_existing_lease"],
8370        recovery: "retry_if_not_submitted",
8371        collection_index_ref: "request_indexes_uniform",
8372    },
8373    CommandSemanticContract {
8374        command: Command::RenewPit,
8375        admissible_errors: &[
8376            ErrorCode::Aborted,
8377            ErrorCode::DeadlineExceeded,
8378            ErrorCode::InvalidRequest,
8379            ErrorCode::UnsupportedVersion,
8380            ErrorCode::Unauthenticated,
8381            ErrorCode::PermissionDenied,
8382            ErrorCode::NotFound,
8383            ErrorCode::Conflict,
8384            ErrorCode::LimitExceeded,
8385            ErrorCode::CapabilityUnavailable,
8386            ErrorCode::NotSubmitted,
8387            ErrorCode::SubmittedIndeterminate,
8388            ErrorCode::ExpiredUnknown,
8389            ErrorCode::TemporarilyUnavailable,
8390            ErrorCode::Internal,
8391        ],
8392        limit_ids: &["request_bytes", "response_bytes"],
8393        effect_class: "lease_renewing_read",
8394        risk_flags: &[],
8395        capability_family: "data",
8396        retry_safety: "pre_submit_only",
8397        identity_requirement: "none",
8398        resolver: None,
8399        cancellation: "per_call_until_submission_then_resolve",
8400        side_effects: &["renews_or_closes_existing_lease"],
8401        recovery: "retry_if_not_submitted",
8402        collection_index_ref: "pit_authority",
8403    },
8404    CommandSemanticContract {
8405        command: Command::ClosePit,
8406        admissible_errors: &[
8407            ErrorCode::Aborted,
8408            ErrorCode::DeadlineExceeded,
8409            ErrorCode::InvalidRequest,
8410            ErrorCode::UnsupportedVersion,
8411            ErrorCode::Unauthenticated,
8412            ErrorCode::PermissionDenied,
8413            ErrorCode::NotFound,
8414            ErrorCode::Conflict,
8415            ErrorCode::LimitExceeded,
8416            ErrorCode::CapabilityUnavailable,
8417            ErrorCode::NotSubmitted,
8418            ErrorCode::SubmittedIndeterminate,
8419            ErrorCode::ExpiredUnknown,
8420            ErrorCode::TemporarilyUnavailable,
8421            ErrorCode::Internal,
8422        ],
8423        limit_ids: &["request_bytes", "response_bytes"],
8424        effect_class: "lease_renewing_read",
8425        risk_flags: &[],
8426        capability_family: "data",
8427        retry_safety: "pre_submit_only",
8428        identity_requirement: "none",
8429        resolver: None,
8430        cancellation: "per_call_until_submission_then_resolve",
8431        side_effects: &["renews_or_closes_existing_lease"],
8432        recovery: "retry_if_not_submitted",
8433        collection_index_ref: "pit_authority",
8434    },
8435    CommandSemanticContract {
8436        command: Command::ListOperations,
8437        admissible_errors: &[
8438            ErrorCode::Aborted,
8439            ErrorCode::DeadlineExceeded,
8440            ErrorCode::InvalidRequest,
8441            ErrorCode::UnsupportedVersion,
8442            ErrorCode::Unauthenticated,
8443            ErrorCode::PermissionDenied,
8444            ErrorCode::NotFound,
8445            ErrorCode::StaleCursor,
8446            ErrorCode::RestartBudgetExhausted,
8447            ErrorCode::LimitExceeded,
8448            ErrorCode::CapabilityUnavailable,
8449            ErrorCode::TemporarilyUnavailable,
8450            ErrorCode::Internal,
8451        ],
8452        limit_ids: &["request_bytes", "response_bytes", "page_size", "operation_page_size"],
8453        effect_class: "read_only",
8454        risk_flags: &[],
8455        capability_family: "operations",
8456        retry_safety: "safe",
8457        identity_requirement: "none",
8458        resolver: None,
8459        cancellation: "per_call",
8460        side_effects: &[],
8461        recovery: "retry",
8462        collection_index_ref: "none",
8463    },
8464    CommandSemanticContract {
8465        command: Command::GetOperation,
8466        admissible_errors: &[
8467            ErrorCode::Aborted,
8468            ErrorCode::DeadlineExceeded,
8469            ErrorCode::InvalidRequest,
8470            ErrorCode::UnsupportedVersion,
8471            ErrorCode::Unauthenticated,
8472            ErrorCode::PermissionDenied,
8473            ErrorCode::NotFound,
8474            ErrorCode::LimitExceeded,
8475            ErrorCode::CapabilityUnavailable,
8476            ErrorCode::TemporarilyUnavailable,
8477            ErrorCode::Internal,
8478        ],
8479        limit_ids: &["request_bytes", "response_bytes"],
8480        effect_class: "read_only",
8481        risk_flags: &[],
8482        capability_family: "operations",
8483        retry_safety: "safe",
8484        identity_requirement: "request_locator",
8485        resolver: None,
8486        cancellation: "per_call",
8487        side_effects: &[],
8488        recovery: "retry",
8489        collection_index_ref: "none",
8490    },
8491    CommandSemanticContract {
8492        command: Command::CancelOperation,
8493        admissible_errors: &[
8494            ErrorCode::Aborted,
8495            ErrorCode::DeadlineExceeded,
8496            ErrorCode::InvalidRequest,
8497            ErrorCode::UnsupportedVersion,
8498            ErrorCode::Unauthenticated,
8499            ErrorCode::PermissionDenied,
8500            ErrorCode::NotFound,
8501            ErrorCode::Conflict,
8502            ErrorCode::LimitExceeded,
8503            ErrorCode::CapabilityUnavailable,
8504            ErrorCode::NotSubmitted,
8505            ErrorCode::SubmittedIndeterminate,
8506            ErrorCode::ExpiredUnknown,
8507            ErrorCode::TemporarilyUnavailable,
8508            ErrorCode::Internal,
8509        ],
8510        limit_ids: &["request_bytes", "response_bytes"],
8511        effect_class: "control_write",
8512        risk_flags: &[],
8513        capability_family: "operations",
8514        retry_safety: "pre_submit_only",
8515        identity_requirement: "request_locator",
8516        resolver: None,
8517        cancellation: "per_call_until_submission_then_resolve",
8518        side_effects: &["commits_authoritative_state"],
8519        recovery: "retry_if_not_submitted",
8520        collection_index_ref: "none",
8521    },
8522    CommandSemanticContract {
8523        command: Command::ListAuditEvents,
8524        admissible_errors: &[
8525            ErrorCode::Aborted,
8526            ErrorCode::DeadlineExceeded,
8527            ErrorCode::InvalidRequest,
8528            ErrorCode::UnsupportedVersion,
8529            ErrorCode::Unauthenticated,
8530            ErrorCode::PermissionDenied,
8531            ErrorCode::NotFound,
8532            ErrorCode::StaleCursor,
8533            ErrorCode::RestartBudgetExhausted,
8534            ErrorCode::LimitExceeded,
8535            ErrorCode::CapabilityUnavailable,
8536            ErrorCode::TemporarilyUnavailable,
8537            ErrorCode::Internal,
8538        ],
8539        limit_ids: &["request_bytes", "response_bytes", "page_size"],
8540        effect_class: "read_only",
8541        risk_flags: &[],
8542        capability_family: "audit",
8543        retry_safety: "safe",
8544        identity_requirement: "none",
8545        resolver: None,
8546        cancellation: "per_call",
8547        side_effects: &[],
8548        recovery: "retry",
8549        collection_index_ref: "none",
8550    },
8551    CommandSemanticContract {
8552        command: Command::ExportAuditEvents,
8553        admissible_errors: &[
8554            ErrorCode::Aborted,
8555            ErrorCode::DeadlineExceeded,
8556            ErrorCode::InvalidRequest,
8557            ErrorCode::UnsupportedVersion,
8558            ErrorCode::Unauthenticated,
8559            ErrorCode::PermissionDenied,
8560            ErrorCode::NotFound,
8561            ErrorCode::StaleCursor,
8562            ErrorCode::RestartBudgetExhausted,
8563            ErrorCode::LimitExceeded,
8564            ErrorCode::CapabilityUnavailable,
8565            ErrorCode::TemporarilyUnavailable,
8566            ErrorCode::Internal,
8567        ],
8568        limit_ids: &["request_bytes", "response_bytes", "page_size"],
8569        effect_class: "read_only",
8570        risk_flags: &[],
8571        capability_family: "audit",
8572        retry_safety: "safe",
8573        identity_requirement: "none",
8574        resolver: None,
8575        cancellation: "per_call",
8576        side_effects: &[],
8577        recovery: "retry",
8578        collection_index_ref: "none",
8579    },
8580    CommandSemanticContract {
8581        command: Command::ReserveServiceCredential,
8582        admissible_errors: &[
8583            ErrorCode::Aborted,
8584            ErrorCode::DeadlineExceeded,
8585            ErrorCode::InvalidRequest,
8586            ErrorCode::UnsupportedVersion,
8587            ErrorCode::Unauthenticated,
8588            ErrorCode::PermissionDenied,
8589            ErrorCode::NotFound,
8590            ErrorCode::Conflict,
8591            ErrorCode::LimitExceeded,
8592            ErrorCode::CapabilityUnavailable,
8593            ErrorCode::NotSubmitted,
8594            ErrorCode::SubmittedIndeterminate,
8595            ErrorCode::ExpiredUnknown,
8596            ErrorCode::SecretNotEscrowed,
8597            ErrorCode::TemporarilyUnavailable,
8598            ErrorCode::Internal,
8599        ],
8600        limit_ids: &["request_bytes", "response_bytes"],
8601        effect_class: "durable_submit",
8602        risk_flags: &["credential_sensitive"],
8603        capability_family: "security",
8604        retry_safety: "pre_submit_only",
8605        identity_requirement: "caller_action_id",
8606        resolver: Some(Command::ResolveServiceCredentialReservation),
8607        cancellation: "per_call_until_submission_then_resolve",
8608        side_effects: &["commits_authoritative_state"],
8609        recovery: "resolve_with_resolve_service_credential_reservation",
8610        collection_index_ref: "none",
8611    },
8612    CommandSemanticContract {
8613        command: Command::ReserveServiceCredentialRotation,
8614        admissible_errors: &[
8615            ErrorCode::Aborted,
8616            ErrorCode::DeadlineExceeded,
8617            ErrorCode::InvalidRequest,
8618            ErrorCode::UnsupportedVersion,
8619            ErrorCode::Unauthenticated,
8620            ErrorCode::PermissionDenied,
8621            ErrorCode::NotFound,
8622            ErrorCode::Conflict,
8623            ErrorCode::LimitExceeded,
8624            ErrorCode::CapabilityUnavailable,
8625            ErrorCode::NotSubmitted,
8626            ErrorCode::SubmittedIndeterminate,
8627            ErrorCode::ExpiredUnknown,
8628            ErrorCode::SecretNotEscrowed,
8629            ErrorCode::TemporarilyUnavailable,
8630            ErrorCode::Internal,
8631        ],
8632        limit_ids: &["request_bytes", "response_bytes"],
8633        effect_class: "durable_submit",
8634        risk_flags: &["credential_sensitive"],
8635        capability_family: "security",
8636        retry_safety: "pre_submit_only",
8637        identity_requirement: "caller_action_id",
8638        resolver: Some(Command::ResolveServiceCredentialReservation),
8639        cancellation: "per_call_until_submission_then_resolve",
8640        side_effects: &["commits_authoritative_state"],
8641        recovery: "resolve_with_resolve_service_credential_reservation",
8642        collection_index_ref: "none",
8643    },
8644    CommandSemanticContract {
8645        command: Command::ActivateServiceCredential,
8646        admissible_errors: &[
8647            ErrorCode::Aborted,
8648            ErrorCode::DeadlineExceeded,
8649            ErrorCode::InvalidRequest,
8650            ErrorCode::UnsupportedVersion,
8651            ErrorCode::Unauthenticated,
8652            ErrorCode::PermissionDenied,
8653            ErrorCode::NotFound,
8654            ErrorCode::Conflict,
8655            ErrorCode::LimitExceeded,
8656            ErrorCode::CapabilityUnavailable,
8657            ErrorCode::NotSubmitted,
8658            ErrorCode::SubmittedIndeterminate,
8659            ErrorCode::ExpiredUnknown,
8660            ErrorCode::SecretNotEscrowed,
8661            ErrorCode::TemporarilyUnavailable,
8662            ErrorCode::Internal,
8663        ],
8664        limit_ids: &["request_bytes", "response_bytes"],
8665        effect_class: "durable_submit",
8666        risk_flags: &["credential_sensitive"],
8667        capability_family: "security",
8668        retry_safety: "pre_submit_only",
8669        identity_requirement: "server_locator",
8670        resolver: Some(Command::ResolveServiceCredentialReservation),
8671        cancellation: "per_call_until_submission_then_resolve",
8672        side_effects: &["commits_authoritative_state"],
8673        recovery: "resolve_with_resolve_service_credential_reservation",
8674        collection_index_ref: "none",
8675    },
8676    CommandSemanticContract {
8677        command: Command::ResolveServiceCredentialReservation,
8678        admissible_errors: &[
8679            ErrorCode::Aborted,
8680            ErrorCode::DeadlineExceeded,
8681            ErrorCode::InvalidRequest,
8682            ErrorCode::UnsupportedVersion,
8683            ErrorCode::Unauthenticated,
8684            ErrorCode::PermissionDenied,
8685            ErrorCode::NotFound,
8686            ErrorCode::LimitExceeded,
8687            ErrorCode::CapabilityUnavailable,
8688            ErrorCode::SecretNotEscrowed,
8689            ErrorCode::TemporarilyUnavailable,
8690            ErrorCode::Internal,
8691        ],
8692        limit_ids: &["request_bytes", "response_bytes"],
8693        effect_class: "read_only",
8694        risk_flags: &["credential_sensitive"],
8695        capability_family: "security",
8696        retry_safety: "safe",
8697        identity_requirement: "caller_action_id",
8698        resolver: None,
8699        cancellation: "per_call",
8700        side_effects: &[],
8701        recovery: "retry",
8702        collection_index_ref: "none",
8703    },
8704    CommandSemanticContract {
8705        command: Command::PrepareRevokeServiceCredential,
8706        admissible_errors: &[
8707            ErrorCode::Aborted,
8708            ErrorCode::DeadlineExceeded,
8709            ErrorCode::InvalidRequest,
8710            ErrorCode::UnsupportedVersion,
8711            ErrorCode::Unauthenticated,
8712            ErrorCode::PermissionDenied,
8713            ErrorCode::NotFound,
8714            ErrorCode::LimitExceeded,
8715            ErrorCode::CapabilityUnavailable,
8716            ErrorCode::SecretNotEscrowed,
8717            ErrorCode::TemporarilyUnavailable,
8718            ErrorCode::Internal,
8719        ],
8720        limit_ids: &["request_bytes", "response_bytes"],
8721        effect_class: "prepare",
8722        risk_flags: &["destructive", "credential_sensitive"],
8723        capability_family: "security",
8724        retry_safety: "safe",
8725        identity_requirement: "server_locator",
8726        resolver: None,
8727        cancellation: "per_call",
8728        side_effects: &["creates_bounded_preparation"],
8729        recovery: "retry",
8730        collection_index_ref: "none",
8731    },
8732    CommandSemanticContract {
8733        command: Command::RevokeServiceCredential,
8734        admissible_errors: &[
8735            ErrorCode::Aborted,
8736            ErrorCode::DeadlineExceeded,
8737            ErrorCode::InvalidRequest,
8738            ErrorCode::UnsupportedVersion,
8739            ErrorCode::Unauthenticated,
8740            ErrorCode::PermissionDenied,
8741            ErrorCode::NotFound,
8742            ErrorCode::Conflict,
8743            ErrorCode::LimitExceeded,
8744            ErrorCode::CapabilityUnavailable,
8745            ErrorCode::NotSubmitted,
8746            ErrorCode::SubmittedIndeterminate,
8747            ErrorCode::ExpiredUnknown,
8748            ErrorCode::SecretNotEscrowed,
8749            ErrorCode::TemporarilyUnavailable,
8750            ErrorCode::Internal,
8751        ],
8752        limit_ids: &["request_bytes", "response_bytes"],
8753        effect_class: "durable_submit",
8754        risk_flags: &["destructive", "credential_sensitive"],
8755        capability_family: "security",
8756        retry_safety: "pre_submit_only",
8757        identity_requirement: "request_locator",
8758        resolver: Some(Command::ResolveSecurityAction),
8759        cancellation: "per_call_until_submission_then_resolve",
8760        side_effects: &["commits_authoritative_state"],
8761        recovery: "resolve_with_resolve_security_action",
8762        collection_index_ref: "none",
8763    },
8764    CommandSemanticContract {
8765        command: Command::ResolveSecurityAction,
8766        admissible_errors: &[
8767            ErrorCode::Aborted,
8768            ErrorCode::DeadlineExceeded,
8769            ErrorCode::InvalidRequest,
8770            ErrorCode::UnsupportedVersion,
8771            ErrorCode::Unauthenticated,
8772            ErrorCode::PermissionDenied,
8773            ErrorCode::NotFound,
8774            ErrorCode::LimitExceeded,
8775            ErrorCode::CapabilityUnavailable,
8776            ErrorCode::SecretNotEscrowed,
8777            ErrorCode::TemporarilyUnavailable,
8778            ErrorCode::Internal,
8779        ],
8780        limit_ids: &["request_bytes", "response_bytes"],
8781        effect_class: "read_only",
8782        risk_flags: &[],
8783        capability_family: "security",
8784        retry_safety: "safe",
8785        identity_requirement: "request_locator",
8786        resolver: None,
8787        cancellation: "per_call",
8788        side_effects: &[],
8789        recovery: "retry",
8790        collection_index_ref: "none",
8791    },
8792    CommandSemanticContract {
8793        command: Command::GetSecurityRole,
8794        admissible_errors: &[
8795            ErrorCode::Aborted,
8796            ErrorCode::DeadlineExceeded,
8797            ErrorCode::InvalidRequest,
8798            ErrorCode::UnsupportedVersion,
8799            ErrorCode::Unauthenticated,
8800            ErrorCode::PermissionDenied,
8801            ErrorCode::NotFound,
8802            ErrorCode::LimitExceeded,
8803            ErrorCode::CapabilityUnavailable,
8804            ErrorCode::TemporarilyUnavailable,
8805            ErrorCode::Internal,
8806        ],
8807        limit_ids: &["request_bytes", "response_bytes"],
8808        effect_class: "read_only",
8809        risk_flags: &[],
8810        capability_family: "security",
8811        retry_safety: "safe",
8812        identity_requirement: "none",
8813        resolver: None,
8814        cancellation: "per_call",
8815        side_effects: &[],
8816        recovery: "retry",
8817        collection_index_ref: "none",
8818    },
8819    CommandSemanticContract {
8820        command: Command::PrepareRoleAppendAccessChange,
8821        admissible_errors: &[
8822            ErrorCode::Aborted,
8823            ErrorCode::DeadlineExceeded,
8824            ErrorCode::InvalidRequest,
8825            ErrorCode::UnsupportedVersion,
8826            ErrorCode::Unauthenticated,
8827            ErrorCode::PermissionDenied,
8828            ErrorCode::NotFound,
8829            ErrorCode::Conflict,
8830            ErrorCode::LimitExceeded,
8831            ErrorCode::CapabilityUnavailable,
8832            ErrorCode::TemporarilyUnavailable,
8833            ErrorCode::Internal,
8834        ],
8835        limit_ids: &["request_bytes", "response_bytes"],
8836        effect_class: "prepare",
8837        risk_flags: &["destructive"],
8838        capability_family: "security",
8839        retry_safety: "safe",
8840        identity_requirement: "server_locator",
8841        resolver: None,
8842        cancellation: "per_call",
8843        side_effects: &["creates_bounded_preparation"],
8844        recovery: "retry",
8845        collection_index_ref: "none",
8846    },
8847    CommandSemanticContract {
8848        command: Command::SubmitRoleAppendAccessChange,
8849        admissible_errors: &[
8850            ErrorCode::Aborted,
8851            ErrorCode::DeadlineExceeded,
8852            ErrorCode::InvalidRequest,
8853            ErrorCode::UnsupportedVersion,
8854            ErrorCode::Unauthenticated,
8855            ErrorCode::PermissionDenied,
8856            ErrorCode::NotFound,
8857            ErrorCode::Conflict,
8858            ErrorCode::LimitExceeded,
8859            ErrorCode::CapabilityUnavailable,
8860            ErrorCode::NotSubmitted,
8861            ErrorCode::SubmittedIndeterminate,
8862            ErrorCode::ExpiredUnknown,
8863            ErrorCode::TemporarilyUnavailable,
8864            ErrorCode::Internal,
8865        ],
8866        limit_ids: &["request_bytes", "response_bytes"],
8867        effect_class: "durable_submit",
8868        risk_flags: &["destructive"],
8869        capability_family: "security",
8870        retry_safety: "pre_submit_only",
8871        identity_requirement: "request_locator",
8872        resolver: Some(Command::ResolveSecurityAction),
8873        cancellation: "per_call_until_submission_then_resolve",
8874        side_effects: &["commits_authoritative_state"],
8875        recovery: "resolve_with_resolve_security_action",
8876        collection_index_ref: "none",
8877    },
8878    CommandSemanticContract {
8879        command: Command::ListServiceCredentials,
8880        admissible_errors: &[
8881            ErrorCode::Aborted,
8882            ErrorCode::DeadlineExceeded,
8883            ErrorCode::InvalidRequest,
8884            ErrorCode::UnsupportedVersion,
8885            ErrorCode::Unauthenticated,
8886            ErrorCode::PermissionDenied,
8887            ErrorCode::NotFound,
8888            ErrorCode::StaleCursor,
8889            ErrorCode::RestartBudgetExhausted,
8890            ErrorCode::LimitExceeded,
8891            ErrorCode::CapabilityUnavailable,
8892            ErrorCode::SecretNotEscrowed,
8893            ErrorCode::TemporarilyUnavailable,
8894            ErrorCode::Internal,
8895        ],
8896        limit_ids: &["request_bytes", "response_bytes", "page_size"],
8897        effect_class: "read_only",
8898        risk_flags: &["credential_sensitive"],
8899        capability_family: "security",
8900        retry_safety: "safe",
8901        identity_requirement: "none",
8902        resolver: None,
8903        cancellation: "per_call",
8904        side_effects: &[],
8905        recovery: "retry",
8906        collection_index_ref: "none",
8907    },
8908    CommandSemanticContract {
8909        command: Command::ListBackups,
8910        admissible_errors: &[
8911            ErrorCode::Aborted,
8912            ErrorCode::DeadlineExceeded,
8913            ErrorCode::InvalidRequest,
8914            ErrorCode::UnsupportedVersion,
8915            ErrorCode::Unauthenticated,
8916            ErrorCode::PermissionDenied,
8917            ErrorCode::NotFound,
8918            ErrorCode::StaleCursor,
8919            ErrorCode::RestartBudgetExhausted,
8920            ErrorCode::LimitExceeded,
8921            ErrorCode::CapabilityUnavailable,
8922            ErrorCode::TemporarilyUnavailable,
8923            ErrorCode::Internal,
8924        ],
8925        limit_ids: &["request_bytes", "response_bytes", "page_size"],
8926        effect_class: "read_only",
8927        risk_flags: &[],
8928        capability_family: "backup",
8929        retry_safety: "safe",
8930        identity_requirement: "none",
8931        resolver: None,
8932        cancellation: "per_call",
8933        side_effects: &[],
8934        recovery: "retry",
8935        collection_index_ref: "none",
8936    },
8937    CommandSemanticContract {
8938        command: Command::GetBackup,
8939        admissible_errors: &[
8940            ErrorCode::Aborted,
8941            ErrorCode::DeadlineExceeded,
8942            ErrorCode::InvalidRequest,
8943            ErrorCode::UnsupportedVersion,
8944            ErrorCode::Unauthenticated,
8945            ErrorCode::PermissionDenied,
8946            ErrorCode::NotFound,
8947            ErrorCode::LimitExceeded,
8948            ErrorCode::CapabilityUnavailable,
8949            ErrorCode::TemporarilyUnavailable,
8950            ErrorCode::Internal,
8951        ],
8952        limit_ids: &["request_bytes", "response_bytes"],
8953        effect_class: "read_only",
8954        risk_flags: &[],
8955        capability_family: "backup",
8956        retry_safety: "safe",
8957        identity_requirement: "request_locator",
8958        resolver: None,
8959        cancellation: "per_call",
8960        side_effects: &[],
8961        recovery: "retry",
8962        collection_index_ref: "none",
8963    },
8964    CommandSemanticContract {
8965        command: Command::CreateBackup,
8966        admissible_errors: &[
8967            ErrorCode::Aborted,
8968            ErrorCode::DeadlineExceeded,
8969            ErrorCode::InvalidRequest,
8970            ErrorCode::UnsupportedVersion,
8971            ErrorCode::Unauthenticated,
8972            ErrorCode::PermissionDenied,
8973            ErrorCode::NotFound,
8974            ErrorCode::Conflict,
8975            ErrorCode::LimitExceeded,
8976            ErrorCode::CapabilityUnavailable,
8977            ErrorCode::NotSubmitted,
8978            ErrorCode::SubmittedIndeterminate,
8979            ErrorCode::ExpiredUnknown,
8980            ErrorCode::TemporarilyUnavailable,
8981            ErrorCode::Internal,
8982        ],
8983        limit_ids: &["request_bytes", "response_bytes"],
8984        effect_class: "durable_submit",
8985        risk_flags: &[],
8986        capability_family: "backup",
8987        retry_safety: "pre_submit_only",
8988        identity_requirement: "caller_action_id",
8989        resolver: Some(Command::ResolveBackupAction),
8990        cancellation: "per_call_until_submission_then_resolve",
8991        side_effects: &["commits_authoritative_state"],
8992        recovery: "resolve_with_resolve_backup_action",
8993        collection_index_ref: "none",
8994    },
8995    CommandSemanticContract {
8996        command: Command::ResolveBackupAction,
8997        admissible_errors: &[
8998            ErrorCode::Aborted,
8999            ErrorCode::DeadlineExceeded,
9000            ErrorCode::InvalidRequest,
9001            ErrorCode::UnsupportedVersion,
9002            ErrorCode::Unauthenticated,
9003            ErrorCode::PermissionDenied,
9004            ErrorCode::NotFound,
9005            ErrorCode::LimitExceeded,
9006            ErrorCode::CapabilityUnavailable,
9007            ErrorCode::TemporarilyUnavailable,
9008            ErrorCode::Internal,
9009        ],
9010        limit_ids: &["request_bytes", "response_bytes"],
9011        effect_class: "read_only",
9012        risk_flags: &[],
9013        capability_family: "backup",
9014        retry_safety: "safe",
9015        identity_requirement: "caller_action_id",
9016        resolver: None,
9017        cancellation: "per_call",
9018        side_effects: &[],
9019        recovery: "retry",
9020        collection_index_ref: "none",
9021    },
9022    CommandSemanticContract {
9023        command: Command::GetRuntimeStatus,
9024        admissible_errors: &[
9025            ErrorCode::Aborted,
9026            ErrorCode::DeadlineExceeded,
9027            ErrorCode::InvalidRequest,
9028            ErrorCode::UnsupportedVersion,
9029            ErrorCode::Unauthenticated,
9030            ErrorCode::PermissionDenied,
9031            ErrorCode::NotFound,
9032            ErrorCode::LimitExceeded,
9033            ErrorCode::CapabilityUnavailable,
9034            ErrorCode::TemporarilyUnavailable,
9035            ErrorCode::Internal,
9036        ],
9037        limit_ids: &["request_bytes", "response_bytes"],
9038        effect_class: "read_only",
9039        risk_flags: &[],
9040        capability_family: "catalog",
9041        retry_safety: "safe",
9042        identity_requirement: "none",
9043        resolver: None,
9044        cancellation: "per_call",
9045        side_effects: &[],
9046        recovery: "retry",
9047        collection_index_ref: "none",
9048    },
9049    CommandSemanticContract {
9050        command: Command::GetResultCacheStatus,
9051        admissible_errors: &[
9052            ErrorCode::Aborted,
9053            ErrorCode::DeadlineExceeded,
9054            ErrorCode::InvalidRequest,
9055            ErrorCode::UnsupportedVersion,
9056            ErrorCode::Unauthenticated,
9057            ErrorCode::PermissionDenied,
9058            ErrorCode::NotFound,
9059            ErrorCode::LimitExceeded,
9060            ErrorCode::CapabilityUnavailable,
9061            ErrorCode::TemporarilyUnavailable,
9062            ErrorCode::Internal,
9063        ],
9064        limit_ids: &["request_bytes", "response_bytes"],
9065        effect_class: "read_only",
9066        risk_flags: &[],
9067        capability_family: "catalog",
9068        retry_safety: "safe",
9069        identity_requirement: "none",
9070        resolver: None,
9071        cancellation: "per_call",
9072        side_effects: &[],
9073        recovery: "retry",
9074        collection_index_ref: "none",
9075    },
9076    CommandSemanticContract {
9077        command: Command::GetFieldPromotionStatus,
9078        admissible_errors: &[
9079            ErrorCode::Aborted,
9080            ErrorCode::DeadlineExceeded,
9081            ErrorCode::InvalidRequest,
9082            ErrorCode::UnsupportedVersion,
9083            ErrorCode::Unauthenticated,
9084            ErrorCode::PermissionDenied,
9085            ErrorCode::NotFound,
9086            ErrorCode::LimitExceeded,
9087            ErrorCode::CapabilityUnavailable,
9088            ErrorCode::TemporarilyUnavailable,
9089            ErrorCode::Internal,
9090        ],
9091        limit_ids: &["request_bytes", "response_bytes"],
9092        effect_class: "read_only",
9093        risk_flags: &[],
9094        capability_family: "catalog",
9095        retry_safety: "safe",
9096        identity_requirement: "none",
9097        resolver: None,
9098        cancellation: "per_call",
9099        side_effects: &[],
9100        recovery: "retry",
9101        collection_index_ref: "none",
9102    },
9103    CommandSemanticContract {
9104        command: Command::GetOverloadStatus,
9105        admissible_errors: &[
9106            ErrorCode::Aborted,
9107            ErrorCode::DeadlineExceeded,
9108            ErrorCode::InvalidRequest,
9109            ErrorCode::UnsupportedVersion,
9110            ErrorCode::Unauthenticated,
9111            ErrorCode::PermissionDenied,
9112            ErrorCode::NotFound,
9113            ErrorCode::LimitExceeded,
9114            ErrorCode::CapabilityUnavailable,
9115            ErrorCode::TemporarilyUnavailable,
9116            ErrorCode::Internal,
9117        ],
9118        limit_ids: &["request_bytes", "response_bytes"],
9119        effect_class: "read_only",
9120        risk_flags: &[],
9121        capability_family: "catalog",
9122        retry_safety: "safe",
9123        identity_requirement: "none",
9124        resolver: None,
9125        cancellation: "per_call",
9126        side_effects: &[],
9127        recovery: "retry",
9128        collection_index_ref: "none",
9129    },
9130    CommandSemanticContract {
9131        command: Command::ConfigureExternalKey,
9132        admissible_errors: &[
9133            ErrorCode::Aborted,
9134            ErrorCode::DeadlineExceeded,
9135            ErrorCode::InvalidRequest,
9136            ErrorCode::UnsupportedVersion,
9137            ErrorCode::Unauthenticated,
9138            ErrorCode::PermissionDenied,
9139            ErrorCode::NotFound,
9140            ErrorCode::Conflict,
9141            ErrorCode::LimitExceeded,
9142            ErrorCode::CapabilityUnavailable,
9143            ErrorCode::NotSubmitted,
9144            ErrorCode::SubmittedIndeterminate,
9145            ErrorCode::ExpiredUnknown,
9146            ErrorCode::TemporarilyUnavailable,
9147            ErrorCode::Internal,
9148        ],
9149        limit_ids: &["request_bytes", "response_bytes"],
9150        effect_class: "control_write",
9151        risk_flags: &[],
9152        capability_family: "lifecycle",
9153        retry_safety: "pre_submit_only",
9154        identity_requirement: "none",
9155        resolver: None,
9156        cancellation: "per_call_until_submission_then_resolve",
9157        side_effects: &["commits_authoritative_state"],
9158        recovery: "retry_if_not_submitted",
9159        collection_index_ref: "request_index",
9160    },
9161    CommandSemanticContract {
9162        command: Command::RotateExternalKeyBinding,
9163        admissible_errors: &[
9164            ErrorCode::Aborted,
9165            ErrorCode::DeadlineExceeded,
9166            ErrorCode::InvalidRequest,
9167            ErrorCode::UnsupportedVersion,
9168            ErrorCode::Unauthenticated,
9169            ErrorCode::PermissionDenied,
9170            ErrorCode::NotFound,
9171            ErrorCode::Conflict,
9172            ErrorCode::LimitExceeded,
9173            ErrorCode::CapabilityUnavailable,
9174            ErrorCode::NotSubmitted,
9175            ErrorCode::SubmittedIndeterminate,
9176            ErrorCode::ExpiredUnknown,
9177            ErrorCode::TemporarilyUnavailable,
9178            ErrorCode::Internal,
9179        ],
9180        limit_ids: &["request_bytes", "response_bytes"],
9181        effect_class: "control_write",
9182        risk_flags: &[],
9183        capability_family: "lifecycle",
9184        retry_safety: "pre_submit_only",
9185        identity_requirement: "none",
9186        resolver: None,
9187        cancellation: "per_call_until_submission_then_resolve",
9188        side_effects: &["commits_authoritative_state"],
9189        recovery: "retry_if_not_submitted",
9190        collection_index_ref: "request_index",
9191    },
9192    CommandSemanticContract {
9193        command: Command::ConfigureAggregateThenDelete,
9194        admissible_errors: &[
9195            ErrorCode::Aborted,
9196            ErrorCode::DeadlineExceeded,
9197            ErrorCode::InvalidRequest,
9198            ErrorCode::UnsupportedVersion,
9199            ErrorCode::Unauthenticated,
9200            ErrorCode::PermissionDenied,
9201            ErrorCode::NotFound,
9202            ErrorCode::Conflict,
9203            ErrorCode::LimitExceeded,
9204            ErrorCode::CapabilityUnavailable,
9205            ErrorCode::NotSubmitted,
9206            ErrorCode::SubmittedIndeterminate,
9207            ErrorCode::ExpiredUnknown,
9208            ErrorCode::TemporarilyUnavailable,
9209            ErrorCode::Internal,
9210        ],
9211        limit_ids: &["request_bytes", "response_bytes"],
9212        effect_class: "control_write",
9213        risk_flags: &["destructive"],
9214        capability_family: "lifecycle",
9215        retry_safety: "pre_submit_only",
9216        identity_requirement: "none",
9217        resolver: None,
9218        cancellation: "per_call_until_submission_then_resolve",
9219        side_effects: &["commits_authoritative_state"],
9220        recovery: "retry_if_not_submitted",
9221        collection_index_ref: "request_index",
9222    },
9223    CommandSemanticContract {
9224        command: Command::GetLifecycleStatus,
9225        admissible_errors: &[
9226            ErrorCode::Aborted,
9227            ErrorCode::DeadlineExceeded,
9228            ErrorCode::InvalidRequest,
9229            ErrorCode::UnsupportedVersion,
9230            ErrorCode::Unauthenticated,
9231            ErrorCode::PermissionDenied,
9232            ErrorCode::NotFound,
9233            ErrorCode::LimitExceeded,
9234            ErrorCode::CapabilityUnavailable,
9235            ErrorCode::TemporarilyUnavailable,
9236            ErrorCode::Internal,
9237        ],
9238        limit_ids: &["request_bytes", "response_bytes"],
9239        effect_class: "read_only",
9240        risk_flags: &[],
9241        capability_family: "catalog",
9242        retry_safety: "safe",
9243        identity_requirement: "none",
9244        resolver: None,
9245        cancellation: "per_call",
9246        side_effects: &[],
9247        recovery: "retry",
9248        collection_index_ref: "none",
9249    },
9250    CommandSemanticContract {
9251        command: Command::GetQuota,
9252        admissible_errors: &[
9253            ErrorCode::Aborted,
9254            ErrorCode::DeadlineExceeded,
9255            ErrorCode::InvalidRequest,
9256            ErrorCode::UnsupportedVersion,
9257            ErrorCode::Unauthenticated,
9258            ErrorCode::PermissionDenied,
9259            ErrorCode::NotFound,
9260            ErrorCode::LimitExceeded,
9261            ErrorCode::CapabilityUnavailable,
9262            ErrorCode::TemporarilyUnavailable,
9263            ErrorCode::Internal,
9264        ],
9265        limit_ids: &["request_bytes", "response_bytes"],
9266        effect_class: "read_only",
9267        risk_flags: &[],
9268        capability_family: "quota",
9269        retry_safety: "safe",
9270        identity_requirement: "none",
9271        resolver: None,
9272        cancellation: "per_call",
9273        side_effects: &[],
9274        recovery: "retry",
9275        collection_index_ref: "none",
9276    },
9277    CommandSemanticContract {
9278        command: Command::UpdateQuota,
9279        admissible_errors: &[
9280            ErrorCode::Aborted,
9281            ErrorCode::DeadlineExceeded,
9282            ErrorCode::InvalidRequest,
9283            ErrorCode::UnsupportedVersion,
9284            ErrorCode::Unauthenticated,
9285            ErrorCode::PermissionDenied,
9286            ErrorCode::NotFound,
9287            ErrorCode::Conflict,
9288            ErrorCode::LimitExceeded,
9289            ErrorCode::CapabilityUnavailable,
9290            ErrorCode::NotSubmitted,
9291            ErrorCode::SubmittedIndeterminate,
9292            ErrorCode::ExpiredUnknown,
9293            ErrorCode::TemporarilyUnavailable,
9294            ErrorCode::Internal,
9295        ],
9296        limit_ids: &["request_bytes", "response_bytes"],
9297        effect_class: "control_write",
9298        risk_flags: &[],
9299        capability_family: "quota",
9300        retry_safety: "pre_submit_only",
9301        identity_requirement: "none",
9302        resolver: None,
9303        cancellation: "per_call_until_submission_then_resolve",
9304        side_effects: &["commits_authoritative_state"],
9305        recovery: "retry_if_not_submitted",
9306        collection_index_ref: "none",
9307    },
9308    CommandSemanticContract {
9309        command: Command::GetBinding,
9310        admissible_errors: &[
9311            ErrorCode::Aborted,
9312            ErrorCode::DeadlineExceeded,
9313            ErrorCode::InvalidRequest,
9314            ErrorCode::UnsupportedVersion,
9315            ErrorCode::Unauthenticated,
9316            ErrorCode::PermissionDenied,
9317            ErrorCode::NotFound,
9318            ErrorCode::LimitExceeded,
9319            ErrorCode::CapabilityUnavailable,
9320            ErrorCode::TemporarilyUnavailable,
9321            ErrorCode::Internal,
9322        ],
9323        limit_ids: &["request_bytes", "response_bytes"],
9324        effect_class: "read_only",
9325        risk_flags: &[],
9326        capability_family: "runtime_control",
9327        retry_safety: "safe",
9328        identity_requirement: "none",
9329        resolver: None,
9330        cancellation: "per_call",
9331        side_effects: &[],
9332        recovery: "retry",
9333        collection_index_ref: "none",
9334    },
9335    CommandSemanticContract {
9336        command: Command::GetAdmissionStatus,
9337        admissible_errors: &[
9338            ErrorCode::Aborted,
9339            ErrorCode::DeadlineExceeded,
9340            ErrorCode::InvalidRequest,
9341            ErrorCode::UnsupportedVersion,
9342            ErrorCode::Unauthenticated,
9343            ErrorCode::PermissionDenied,
9344            ErrorCode::NotFound,
9345            ErrorCode::LimitExceeded,
9346            ErrorCode::CapabilityUnavailable,
9347            ErrorCode::TemporarilyUnavailable,
9348            ErrorCode::Internal,
9349        ],
9350        limit_ids: &["request_bytes", "response_bytes"],
9351        effect_class: "read_only",
9352        risk_flags: &[],
9353        capability_family: "runtime_control",
9354        retry_safety: "safe",
9355        identity_requirement: "none",
9356        resolver: None,
9357        cancellation: "per_call",
9358        side_effects: &[],
9359        recovery: "retry",
9360        collection_index_ref: "none",
9361    },
9362    CommandSemanticContract {
9363        command: Command::SetAdmission,
9364        admissible_errors: &[
9365            ErrorCode::Aborted,
9366            ErrorCode::DeadlineExceeded,
9367            ErrorCode::InvalidRequest,
9368            ErrorCode::UnsupportedVersion,
9369            ErrorCode::Unauthenticated,
9370            ErrorCode::PermissionDenied,
9371            ErrorCode::NotFound,
9372            ErrorCode::Conflict,
9373            ErrorCode::LimitExceeded,
9374            ErrorCode::CapabilityUnavailable,
9375            ErrorCode::NotSubmitted,
9376            ErrorCode::SubmittedIndeterminate,
9377            ErrorCode::ExpiredUnknown,
9378            ErrorCode::TemporarilyUnavailable,
9379            ErrorCode::Internal,
9380        ],
9381        limit_ids: &["request_bytes", "response_bytes"],
9382        effect_class: "control_write",
9383        risk_flags: &[],
9384        capability_family: "runtime_control",
9385        retry_safety: "pre_submit_only",
9386        identity_requirement: "none",
9387        resolver: None,
9388        cancellation: "per_call_until_submission_then_resolve",
9389        side_effects: &["commits_authoritative_state"],
9390        recovery: "retry_if_not_submitted",
9391        collection_index_ref: "none",
9392    },
9393    CommandSemanticContract {
9394        command: Command::GetQuiesceStatus,
9395        admissible_errors: &[
9396            ErrorCode::Aborted,
9397            ErrorCode::DeadlineExceeded,
9398            ErrorCode::InvalidRequest,
9399            ErrorCode::UnsupportedVersion,
9400            ErrorCode::Unauthenticated,
9401            ErrorCode::PermissionDenied,
9402            ErrorCode::NotFound,
9403            ErrorCode::LimitExceeded,
9404            ErrorCode::CapabilityUnavailable,
9405            ErrorCode::TemporarilyUnavailable,
9406            ErrorCode::Internal,
9407        ],
9408        limit_ids: &["request_bytes", "response_bytes"],
9409        effect_class: "read_only",
9410        risk_flags: &[],
9411        capability_family: "runtime_control",
9412        retry_safety: "safe",
9413        identity_requirement: "none",
9414        resolver: None,
9415        cancellation: "per_call",
9416        side_effects: &[],
9417        recovery: "retry",
9418        collection_index_ref: "none",
9419    },
9420    CommandSemanticContract {
9421        command: Command::GetDecommissionReadiness,
9422        admissible_errors: &[
9423            ErrorCode::Aborted,
9424            ErrorCode::DeadlineExceeded,
9425            ErrorCode::InvalidRequest,
9426            ErrorCode::UnsupportedVersion,
9427            ErrorCode::Unauthenticated,
9428            ErrorCode::PermissionDenied,
9429            ErrorCode::NotFound,
9430            ErrorCode::LimitExceeded,
9431            ErrorCode::CapabilityUnavailable,
9432            ErrorCode::TemporarilyUnavailable,
9433            ErrorCode::Internal,
9434        ],
9435        limit_ids: &["request_bytes", "response_bytes"],
9436        effect_class: "read_only",
9437        risk_flags: &[],
9438        capability_family: "runtime_control",
9439        retry_safety: "safe",
9440        identity_requirement: "none",
9441        resolver: None,
9442        cancellation: "per_call",
9443        side_effects: &[],
9444        recovery: "retry",
9445        collection_index_ref: "none",
9446    },
9447    CommandSemanticContract {
9448        command: Command::GetUpgradeReadiness,
9449        admissible_errors: &[
9450            ErrorCode::Aborted,
9451            ErrorCode::DeadlineExceeded,
9452            ErrorCode::InvalidRequest,
9453            ErrorCode::UnsupportedVersion,
9454            ErrorCode::Unauthenticated,
9455            ErrorCode::PermissionDenied,
9456            ErrorCode::NotFound,
9457            ErrorCode::LimitExceeded,
9458            ErrorCode::CapabilityUnavailable,
9459            ErrorCode::TemporarilyUnavailable,
9460            ErrorCode::Internal,
9461        ],
9462        limit_ids: &["request_bytes", "response_bytes"],
9463        effect_class: "read_only",
9464        risk_flags: &[],
9465        capability_family: "operations",
9466        retry_safety: "safe",
9467        identity_requirement: "none",
9468        resolver: None,
9469        cancellation: "per_call",
9470        side_effects: &[],
9471        recovery: "retry",
9472        collection_index_ref: "none",
9473    },
9474    CommandSemanticContract {
9475        command: Command::GetMaintenanceStatus,
9476        admissible_errors: &[
9477            ErrorCode::Aborted,
9478            ErrorCode::DeadlineExceeded,
9479            ErrorCode::InvalidRequest,
9480            ErrorCode::UnsupportedVersion,
9481            ErrorCode::Unauthenticated,
9482            ErrorCode::PermissionDenied,
9483            ErrorCode::NotFound,
9484            ErrorCode::StaleCursor,
9485            ErrorCode::LimitExceeded,
9486            ErrorCode::CapabilityUnavailable,
9487            ErrorCode::TemporarilyUnavailable,
9488            ErrorCode::Internal,
9489        ],
9490        limit_ids: &["request_bytes", "response_bytes", "page_size", "operation_page_size"],
9491        effect_class: "read_only",
9492        risk_flags: &[],
9493        capability_family: "operations",
9494        retry_safety: "safe",
9495        identity_requirement: "none",
9496        resolver: None,
9497        cancellation: "per_call",
9498        side_effects: &[],
9499        recovery: "retry",
9500        collection_index_ref: "optional_request_index",
9501    },
9502    CommandSemanticContract {
9503        command: Command::GetRestoreReadiness,
9504        admissible_errors: &[
9505            ErrorCode::Aborted,
9506            ErrorCode::DeadlineExceeded,
9507            ErrorCode::InvalidRequest,
9508            ErrorCode::UnsupportedVersion,
9509            ErrorCode::Unauthenticated,
9510            ErrorCode::PermissionDenied,
9511            ErrorCode::NotFound,
9512            ErrorCode::LimitExceeded,
9513            ErrorCode::CapabilityUnavailable,
9514            ErrorCode::TemporarilyUnavailable,
9515            ErrorCode::Internal,
9516        ],
9517        limit_ids: &["request_bytes", "response_bytes"],
9518        effect_class: "read_only",
9519        risk_flags: &[],
9520        capability_family: "backup",
9521        retry_safety: "safe",
9522        identity_requirement: "none",
9523        resolver: None,
9524        cancellation: "per_call",
9525        side_effects: &[],
9526        recovery: "retry",
9527        collection_index_ref: "none",
9528    },
9529    CommandSemanticContract {
9530        command: Command::CreateDiagnostic,
9531        admissible_errors: &[
9532            ErrorCode::Aborted,
9533            ErrorCode::DeadlineExceeded,
9534            ErrorCode::InvalidRequest,
9535            ErrorCode::UnsupportedVersion,
9536            ErrorCode::Unauthenticated,
9537            ErrorCode::PermissionDenied,
9538            ErrorCode::NotFound,
9539            ErrorCode::Conflict,
9540            ErrorCode::LimitExceeded,
9541            ErrorCode::CapabilityUnavailable,
9542            ErrorCode::NotSubmitted,
9543            ErrorCode::SubmittedIndeterminate,
9544            ErrorCode::ExpiredUnknown,
9545            ErrorCode::TemporarilyUnavailable,
9546            ErrorCode::Internal,
9547        ],
9548        limit_ids: &["request_bytes", "response_bytes"],
9549        effect_class: "durable_submit",
9550        risk_flags: &[],
9551        capability_family: "diagnostics",
9552        retry_safety: "pre_submit_only",
9553        identity_requirement: "none",
9554        resolver: None,
9555        cancellation: "per_call_until_submission_then_resolve",
9556        side_effects: &["commits_authoritative_state"],
9557        recovery: "retry_if_not_submitted",
9558        collection_index_ref: "none",
9559    },
9560    CommandSemanticContract {
9561        command: Command::GetDiagnostic,
9562        admissible_errors: &[
9563            ErrorCode::Aborted,
9564            ErrorCode::DeadlineExceeded,
9565            ErrorCode::InvalidRequest,
9566            ErrorCode::UnsupportedVersion,
9567            ErrorCode::Unauthenticated,
9568            ErrorCode::PermissionDenied,
9569            ErrorCode::NotFound,
9570            ErrorCode::LimitExceeded,
9571            ErrorCode::CapabilityUnavailable,
9572            ErrorCode::TemporarilyUnavailable,
9573            ErrorCode::Internal,
9574        ],
9575        limit_ids: &["request_bytes", "response_bytes"],
9576        effect_class: "read_only",
9577        risk_flags: &[],
9578        capability_family: "diagnostics",
9579        retry_safety: "safe",
9580        identity_requirement: "request_locator",
9581        resolver: None,
9582        cancellation: "per_call",
9583        side_effects: &[],
9584        recovery: "retry",
9585        collection_index_ref: "none",
9586    },
9587    CommandSemanticContract {
9588        command: Command::ReadArtifactChunk,
9589        admissible_errors: &[
9590            ErrorCode::Aborted,
9591            ErrorCode::DeadlineExceeded,
9592            ErrorCode::InvalidRequest,
9593            ErrorCode::UnsupportedVersion,
9594            ErrorCode::Unauthenticated,
9595            ErrorCode::PermissionDenied,
9596            ErrorCode::NotFound,
9597            ErrorCode::LimitExceeded,
9598            ErrorCode::CapabilityUnavailable,
9599            ErrorCode::ArtifactRangeInvalid,
9600            ErrorCode::ChecksumMismatch,
9601            ErrorCode::TemporarilyUnavailable,
9602            ErrorCode::Internal,
9603        ],
9604        limit_ids: &["request_bytes", "response_bytes", "artifact_chunk_bytes"],
9605        effect_class: "read_only",
9606        risk_flags: &[],
9607        capability_family: "operations",
9608        retry_safety: "safe",
9609        identity_requirement: "none",
9610        resolver: None,
9611        cancellation: "per_call",
9612        side_effects: &[],
9613        recovery: "retry",
9614        collection_index_ref: "none",
9615    },
9616    CommandSemanticContract {
9617        command: Command::ExportUsage,
9618        admissible_errors: &[
9619            ErrorCode::Aborted,
9620            ErrorCode::DeadlineExceeded,
9621            ErrorCode::InvalidRequest,
9622            ErrorCode::UnsupportedVersion,
9623            ErrorCode::Unauthenticated,
9624            ErrorCode::PermissionDenied,
9625            ErrorCode::NotFound,
9626            ErrorCode::StaleCursor,
9627            ErrorCode::RestartBudgetExhausted,
9628            ErrorCode::LimitExceeded,
9629            ErrorCode::CapabilityUnavailable,
9630            ErrorCode::TemporarilyUnavailable,
9631            ErrorCode::Internal,
9632        ],
9633        limit_ids: &["request_bytes", "response_bytes", "page_size"],
9634        effect_class: "read_only",
9635        risk_flags: &[],
9636        capability_family: "usage",
9637        retry_safety: "safe",
9638        identity_requirement: "none",
9639        resolver: None,
9640        cancellation: "per_call",
9641        side_effects: &[],
9642        recovery: "retry",
9643        collection_index_ref: "none",
9644    },
9645    CommandSemanticContract {
9646        command: Command::ExecuteStateRead,
9647        admissible_errors: &[
9648            ErrorCode::Aborted,
9649            ErrorCode::DeadlineExceeded,
9650            ErrorCode::InvalidRequest,
9651            ErrorCode::UnsupportedVersion,
9652            ErrorCode::Unauthenticated,
9653            ErrorCode::PermissionDenied,
9654            ErrorCode::NotFound,
9655            ErrorCode::LimitExceeded,
9656            ErrorCode::CapabilityUnavailable,
9657            ErrorCode::TemporarilyUnavailable,
9658            ErrorCode::Internal,
9659        ],
9660        limit_ids: &[
9661            "request_bytes",
9662            "response_bytes",
9663            "state_command_keys",
9664            "state_command_value_bytes",
9665        ],
9666        effect_class: "read_only",
9667        risk_flags: &[],
9668        capability_family: "data",
9669        retry_safety: "safe",
9670        identity_requirement: "none",
9671        resolver: None,
9672        cancellation: "per_call",
9673        side_effects: &[],
9674        recovery: "retry",
9675        collection_index_ref: "request_index",
9676    },
9677    CommandSemanticContract {
9678        command: Command::PrepareStateWrite,
9679        admissible_errors: &[
9680            ErrorCode::Aborted,
9681            ErrorCode::DeadlineExceeded,
9682            ErrorCode::InvalidRequest,
9683            ErrorCode::UnsupportedVersion,
9684            ErrorCode::Unauthenticated,
9685            ErrorCode::PermissionDenied,
9686            ErrorCode::NotFound,
9687            ErrorCode::LimitExceeded,
9688            ErrorCode::CapabilityUnavailable,
9689            ErrorCode::TemporarilyUnavailable,
9690            ErrorCode::Internal,
9691        ],
9692        limit_ids: &[
9693            "request_bytes",
9694            "response_bytes",
9695            "state_command_keys",
9696            "state_command_value_bytes",
9697        ],
9698        effect_class: "prepare",
9699        risk_flags: &[],
9700        capability_family: "data",
9701        retry_safety: "safe",
9702        identity_requirement: "caller_action_id",
9703        resolver: None,
9704        cancellation: "per_call",
9705        side_effects: &["creates_bounded_preparation"],
9706        recovery: "retry",
9707        collection_index_ref: "request_index",
9708    },
9709    CommandSemanticContract {
9710        command: Command::SubmitStateWrite,
9711        admissible_errors: &[
9712            ErrorCode::Aborted,
9713            ErrorCode::DeadlineExceeded,
9714            ErrorCode::InvalidRequest,
9715            ErrorCode::UnsupportedVersion,
9716            ErrorCode::Unauthenticated,
9717            ErrorCode::PermissionDenied,
9718            ErrorCode::NotFound,
9719            ErrorCode::Conflict,
9720            ErrorCode::LimitExceeded,
9721            ErrorCode::CapabilityUnavailable,
9722            ErrorCode::NotSubmitted,
9723            ErrorCode::SubmittedIndeterminate,
9724            ErrorCode::ExpiredUnknown,
9725            ErrorCode::TemporarilyUnavailable,
9726            ErrorCode::Internal,
9727        ],
9728        limit_ids: &[
9729            "request_bytes",
9730            "response_bytes",
9731            "state_command_keys",
9732            "state_command_value_bytes",
9733        ],
9734        effect_class: "durable_submit",
9735        risk_flags: &[],
9736        capability_family: "data",
9737        retry_safety: "pre_submit_only",
9738        identity_requirement: "request_locator",
9739        resolver: Some(Command::ResolveStateWrite),
9740        cancellation: "per_call_until_submission_then_resolve",
9741        side_effects: &["commits_authoritative_state"],
9742        recovery: "resolve_with_resolve_state_write",
9743        collection_index_ref: "request_index",
9744    },
9745    CommandSemanticContract {
9746        command: Command::ResolveStateWrite,
9747        admissible_errors: &[
9748            ErrorCode::Aborted,
9749            ErrorCode::DeadlineExceeded,
9750            ErrorCode::InvalidRequest,
9751            ErrorCode::UnsupportedVersion,
9752            ErrorCode::Unauthenticated,
9753            ErrorCode::PermissionDenied,
9754            ErrorCode::NotFound,
9755            ErrorCode::LimitExceeded,
9756            ErrorCode::CapabilityUnavailable,
9757            ErrorCode::TemporarilyUnavailable,
9758            ErrorCode::Internal,
9759        ],
9760        limit_ids: &[
9761            "request_bytes",
9762            "response_bytes",
9763            "state_command_keys",
9764            "state_command_value_bytes",
9765        ],
9766        effect_class: "read_only",
9767        risk_flags: &[],
9768        capability_family: "data",
9769        retry_safety: "safe",
9770        identity_requirement: "request_locator",
9771        resolver: None,
9772        cancellation: "per_call",
9773        side_effects: &[],
9774        recovery: "retry",
9775        collection_index_ref: "request_index",
9776    },
9777];
9778#[derive(Clone, Copy, Debug, Eq, PartialEq)]
9779pub struct CommandOutcomeContract {
9780    pub command: Command,
9781    pub pre_submit_retry_safe: bool,
9782    pub possible_submission_states: &'static [&'static str],
9783    pub identity_requirement: &'static str,
9784    pub resolver_command: Option<Command>,
9785    pub cancellation: &'static str,
9786    pub bounded_retry_after: bool,
9787}
9788pub const LODESTONE_API_COMMAND_OUTCOMES: &[CommandOutcomeContract] = &[
9789    CommandOutcomeContract {
9790        command: Command::Discover,
9791        pre_submit_retry_safe: true,
9792        possible_submission_states: &["not_submitted", "resolved"],
9793        identity_requirement: "none",
9794        resolver_command: None,
9795        cancellation: "per_call",
9796        bounded_retry_after: true,
9797    },
9798    CommandOutcomeContract {
9799        command: Command::ListIndexes,
9800        pre_submit_retry_safe: true,
9801        possible_submission_states: &["not_submitted", "resolved"],
9802        identity_requirement: "none",
9803        resolver_command: None,
9804        cancellation: "per_call",
9805        bounded_retry_after: true,
9806    },
9807    CommandOutcomeContract {
9808        command: Command::GetIndex,
9809        pre_submit_retry_safe: true,
9810        possible_submission_states: &["not_submitted", "resolved"],
9811        identity_requirement: "none",
9812        resolver_command: None,
9813        cancellation: "per_call",
9814        bounded_retry_after: true,
9815    },
9816    CommandOutcomeContract {
9817        command: Command::ValidateIndexChange,
9818        pre_submit_retry_safe: true,
9819        possible_submission_states: &["not_submitted", "resolved"],
9820        identity_requirement: "none",
9821        resolver_command: None,
9822        cancellation: "per_call",
9823        bounded_retry_after: true,
9824    },
9825    CommandOutcomeContract {
9826        command: Command::ApplyIndexChange,
9827        pre_submit_retry_safe: true,
9828        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
9829        identity_requirement: "caller_action_id",
9830        resolver_command: None,
9831        cancellation: "per_call_until_submission_then_resolve",
9832        bounded_retry_after: true,
9833    },
9834    CommandOutcomeContract {
9835        command: Command::ApplyAdministrationMutation,
9836        pre_submit_retry_safe: true,
9837        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
9838        identity_requirement: "caller_action_id",
9839        resolver_command: None,
9840        cancellation: "per_call_until_submission_then_resolve",
9841        bounded_retry_after: true,
9842    },
9843    CommandOutcomeContract {
9844        command: Command::ListAliases,
9845        pre_submit_retry_safe: true,
9846        possible_submission_states: &["not_submitted", "resolved"],
9847        identity_requirement: "none",
9848        resolver_command: None,
9849        cancellation: "per_call",
9850        bounded_retry_after: true,
9851    },
9852    CommandOutcomeContract {
9853        command: Command::GetAlias,
9854        pre_submit_retry_safe: true,
9855        possible_submission_states: &["not_submitted", "resolved"],
9856        identity_requirement: "none",
9857        resolver_command: None,
9858        cancellation: "per_call",
9859        bounded_retry_after: true,
9860    },
9861    CommandOutcomeContract {
9862        command: Command::ListDataStreams,
9863        pre_submit_retry_safe: true,
9864        possible_submission_states: &["not_submitted", "resolved"],
9865        identity_requirement: "none",
9866        resolver_command: None,
9867        cancellation: "per_call",
9868        bounded_retry_after: true,
9869    },
9870    CommandOutcomeContract {
9871        command: Command::GetDataStream,
9872        pre_submit_retry_safe: true,
9873        possible_submission_states: &["not_submitted", "resolved"],
9874        identity_requirement: "none",
9875        resolver_command: None,
9876        cancellation: "per_call",
9877        bounded_retry_after: true,
9878    },
9879    CommandOutcomeContract {
9880        command: Command::ListComponentTemplates,
9881        pre_submit_retry_safe: true,
9882        possible_submission_states: &["not_submitted", "resolved"],
9883        identity_requirement: "none",
9884        resolver_command: None,
9885        cancellation: "per_call",
9886        bounded_retry_after: true,
9887    },
9888    CommandOutcomeContract {
9889        command: Command::GetComponentTemplate,
9890        pre_submit_retry_safe: true,
9891        possible_submission_states: &["not_submitted", "resolved"],
9892        identity_requirement: "none",
9893        resolver_command: None,
9894        cancellation: "per_call",
9895        bounded_retry_after: true,
9896    },
9897    CommandOutcomeContract {
9898        command: Command::ListIndexTemplates,
9899        pre_submit_retry_safe: true,
9900        possible_submission_states: &["not_submitted", "resolved"],
9901        identity_requirement: "none",
9902        resolver_command: None,
9903        cancellation: "per_call",
9904        bounded_retry_after: true,
9905    },
9906    CommandOutcomeContract {
9907        command: Command::GetIndexTemplate,
9908        pre_submit_retry_safe: true,
9909        possible_submission_states: &["not_submitted", "resolved"],
9910        identity_requirement: "none",
9911        resolver_command: None,
9912        cancellation: "per_call",
9913        bounded_retry_after: true,
9914    },
9915    CommandOutcomeContract {
9916        command: Command::ListIngestPipelines,
9917        pre_submit_retry_safe: true,
9918        possible_submission_states: &["not_submitted", "resolved"],
9919        identity_requirement: "none",
9920        resolver_command: None,
9921        cancellation: "per_call",
9922        bounded_retry_after: true,
9923    },
9924    CommandOutcomeContract {
9925        command: Command::GetIngestPipeline,
9926        pre_submit_retry_safe: true,
9927        possible_submission_states: &["not_submitted", "resolved"],
9928        identity_requirement: "none",
9929        resolver_command: None,
9930        cancellation: "per_call",
9931        bounded_retry_after: true,
9932    },
9933    CommandOutcomeContract {
9934        command: Command::SimulateIngestPipeline,
9935        pre_submit_retry_safe: true,
9936        possible_submission_states: &["not_submitted", "resolved"],
9937        identity_requirement: "none",
9938        resolver_command: None,
9939        cancellation: "per_call",
9940        bounded_retry_after: true,
9941    },
9942    CommandOutcomeContract {
9943        command: Command::ReprocessByQuery,
9944        pre_submit_retry_safe: true,
9945        possible_submission_states: &[
9946            "not_submitted",
9947            "submitted",
9948            "known_retired",
9949            "indeterminate",
9950            "resolved",
9951        ],
9952        identity_requirement: "caller_action_id",
9953        resolver_command: None,
9954        cancellation: "per_call_until_submission_then_resolve",
9955        bounded_retry_after: true,
9956    },
9957    CommandOutcomeContract {
9958        command: Command::ListLifecyclePolicies,
9959        pre_submit_retry_safe: true,
9960        possible_submission_states: &["not_submitted", "resolved"],
9961        identity_requirement: "none",
9962        resolver_command: None,
9963        cancellation: "per_call",
9964        bounded_retry_after: true,
9965    },
9966    CommandOutcomeContract {
9967        command: Command::GetLifecyclePolicy,
9968        pre_submit_retry_safe: true,
9969        possible_submission_states: &["not_submitted", "resolved"],
9970        identity_requirement: "none",
9971        resolver_command: None,
9972        cancellation: "per_call",
9973        bounded_retry_after: true,
9974    },
9975    CommandOutcomeContract {
9976        command: Command::PrepareCreateIndex,
9977        pre_submit_retry_safe: true,
9978        possible_submission_states: &["not_submitted", "resolved"],
9979        identity_requirement: "server_locator",
9980        resolver_command: None,
9981        cancellation: "per_call",
9982        bounded_retry_after: true,
9983    },
9984    CommandOutcomeContract {
9985        command: Command::PrepareDeleteIndex,
9986        pre_submit_retry_safe: true,
9987        possible_submission_states: &["not_submitted", "resolved"],
9988        identity_requirement: "server_locator",
9989        resolver_command: None,
9990        cancellation: "per_call",
9991        bounded_retry_after: true,
9992    },
9993    CommandOutcomeContract {
9994        command: Command::SubmitCatalogAction,
9995        pre_submit_retry_safe: true,
9996        possible_submission_states: &[
9997            "not_submitted",
9998            "submitted",
9999            "known_retired",
10000            "indeterminate",
10001            "resolved",
10002        ],
10003        identity_requirement: "request_locator",
10004        resolver_command: Some(Command::ResolveCatalogAction),
10005        cancellation: "per_call_until_submission_then_resolve",
10006        bounded_retry_after: true,
10007    },
10008    CommandOutcomeContract {
10009        command: Command::ResolveCatalogAction,
10010        pre_submit_retry_safe: true,
10011        possible_submission_states: &["not_submitted", "resolved"],
10012        identity_requirement: "request_locator",
10013        resolver_command: None,
10014        cancellation: "per_call",
10015        bounded_retry_after: true,
10016    },
10017    CommandOutcomeContract {
10018        command: Command::PrepareReplayableSourceIndex,
10019        pre_submit_retry_safe: true,
10020        possible_submission_states: &["not_submitted", "resolved"],
10021        identity_requirement: "server_locator",
10022        resolver_command: None,
10023        cancellation: "per_call",
10024        bounded_retry_after: true,
10025    },
10026    CommandOutcomeContract {
10027        command: Command::SubmitReplayableSourceIndex,
10028        pre_submit_retry_safe: true,
10029        possible_submission_states: &[
10030            "not_submitted",
10031            "submitted",
10032            "known_retired",
10033            "indeterminate",
10034            "resolved",
10035        ],
10036        identity_requirement: "request_locator",
10037        resolver_command: Some(Command::ResolveCatalogAction),
10038        cancellation: "per_call_until_submission_then_resolve",
10039        bounded_retry_after: true,
10040    },
10041    CommandOutcomeContract {
10042        command: Command::GetReplayableSource,
10043        pre_submit_retry_safe: true,
10044        possible_submission_states: &["not_submitted", "resolved"],
10045        identity_requirement: "none",
10046        resolver_command: None,
10047        cancellation: "per_call",
10048        bounded_retry_after: true,
10049    },
10050    CommandOutcomeContract {
10051        command: Command::ControlReplayableSource,
10052        pre_submit_retry_safe: true,
10053        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10054        identity_requirement: "none",
10055        resolver_command: None,
10056        cancellation: "per_call_until_submission_then_resolve",
10057        bounded_retry_after: true,
10058    },
10059    CommandOutcomeContract {
10060        command: Command::CloneIndex,
10061        pre_submit_retry_safe: true,
10062        possible_submission_states: &[
10063            "not_submitted",
10064            "submitted",
10065            "known_retired",
10066            "indeterminate",
10067            "resolved",
10068        ],
10069        identity_requirement: "caller_action_id",
10070        resolver_command: Some(Command::CloneIndex),
10071        cancellation: "per_call_until_submission_then_resolve",
10072        bounded_retry_after: true,
10073    },
10074    CommandOutcomeContract {
10075        command: Command::ConfigureHistory,
10076        pre_submit_retry_safe: true,
10077        possible_submission_states: &[
10078            "not_submitted",
10079            "submitted",
10080            "known_retired",
10081            "indeterminate",
10082            "resolved",
10083        ],
10084        identity_requirement: "none",
10085        resolver_command: Some(Command::GetHistory),
10086        cancellation: "per_call_until_submission_then_resolve",
10087        bounded_retry_after: true,
10088    },
10089    CommandOutcomeContract {
10090        command: Command::GetHistory,
10091        pre_submit_retry_safe: true,
10092        possible_submission_states: &["not_submitted", "resolved"],
10093        identity_requirement: "none",
10094        resolver_command: None,
10095        cancellation: "per_call",
10096        bounded_retry_after: true,
10097    },
10098    CommandOutcomeContract {
10099        command: Command::ResolveHistory,
10100        pre_submit_retry_safe: true,
10101        possible_submission_states: &["not_submitted", "resolved"],
10102        identity_requirement: "none",
10103        resolver_command: None,
10104        cancellation: "per_call",
10105        bounded_retry_after: true,
10106    },
10107    CommandOutcomeContract {
10108        command: Command::PlaceHistoryHold,
10109        pre_submit_retry_safe: true,
10110        possible_submission_states: &[
10111            "not_submitted",
10112            "submitted",
10113            "known_retired",
10114            "indeterminate",
10115            "resolved",
10116        ],
10117        identity_requirement: "none",
10118        resolver_command: Some(Command::GetHistory),
10119        cancellation: "per_call_until_submission_then_resolve",
10120        bounded_retry_after: true,
10121    },
10122    CommandOutcomeContract {
10123        command: Command::ReleaseHistoryHold,
10124        pre_submit_retry_safe: true,
10125        possible_submission_states: &[
10126            "not_submitted",
10127            "submitted",
10128            "known_retired",
10129            "indeterminate",
10130            "resolved",
10131        ],
10132        identity_requirement: "none",
10133        resolver_command: Some(Command::GetHistory),
10134        cancellation: "per_call_until_submission_then_resolve",
10135        bounded_retry_after: true,
10136    },
10137    CommandOutcomeContract {
10138        command: Command::PrepareDocumentMutation,
10139        pre_submit_retry_safe: true,
10140        possible_submission_states: &["not_submitted", "resolved"],
10141        identity_requirement: "server_locator",
10142        resolver_command: None,
10143        cancellation: "per_call",
10144        bounded_retry_after: true,
10145    },
10146    CommandOutcomeContract {
10147        command: Command::SubmitDocumentMutation,
10148        pre_submit_retry_safe: true,
10149        possible_submission_states: &[
10150            "not_submitted",
10151            "submitted",
10152            "known_retired",
10153            "indeterminate",
10154            "resolved",
10155        ],
10156        identity_requirement: "request_locator",
10157        resolver_command: Some(Command::ResolveDocumentMutation),
10158        cancellation: "per_call_until_submission_then_resolve",
10159        bounded_retry_after: true,
10160    },
10161    CommandOutcomeContract {
10162        command: Command::PrepareDocumentBulk,
10163        pre_submit_retry_safe: true,
10164        possible_submission_states: &["not_submitted", "resolved"],
10165        identity_requirement: "caller_action_id",
10166        resolver_command: None,
10167        cancellation: "per_call",
10168        bounded_retry_after: true,
10169    },
10170    CommandOutcomeContract {
10171        command: Command::SubmitDocumentBulk,
10172        pre_submit_retry_safe: true,
10173        possible_submission_states: &[
10174            "not_submitted",
10175            "submitted",
10176            "known_retired",
10177            "indeterminate",
10178            "resolved",
10179        ],
10180        identity_requirement: "caller_action_id",
10181        resolver_command: Some(Command::ResolveDocumentBulk),
10182        cancellation: "per_call_until_submission_then_resolve",
10183        bounded_retry_after: true,
10184    },
10185    CommandOutcomeContract {
10186        command: Command::ResolveDocumentBulk,
10187        pre_submit_retry_safe: true,
10188        possible_submission_states: &["not_submitted", "resolved"],
10189        identity_requirement: "caller_action_id",
10190        resolver_command: None,
10191        cancellation: "per_call",
10192        bounded_retry_after: true,
10193    },
10194    CommandOutcomeContract {
10195        command: Command::PrepareAppendBulk,
10196        pre_submit_retry_safe: true,
10197        possible_submission_states: &["not_submitted", "resolved"],
10198        identity_requirement: "caller_action_id",
10199        resolver_command: None,
10200        cancellation: "per_call",
10201        bounded_retry_after: true,
10202    },
10203    CommandOutcomeContract {
10204        command: Command::SubmitAppendBulk,
10205        pre_submit_retry_safe: true,
10206        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10207        identity_requirement: "request_locator",
10208        resolver_command: Some(Command::ResolveAppendBulk),
10209        cancellation: "per_call_until_submission_then_resolve",
10210        bounded_retry_after: true,
10211    },
10212    CommandOutcomeContract {
10213        command: Command::ResolveAppendBulk,
10214        pre_submit_retry_safe: true,
10215        possible_submission_states: &["not_submitted", "resolved"],
10216        identity_requirement: "request_locator",
10217        resolver_command: None,
10218        cancellation: "per_call",
10219        bounded_retry_after: true,
10220    },
10221    CommandOutcomeContract {
10222        command: Command::ObserveAppendCommitted,
10223        pre_submit_retry_safe: true,
10224        possible_submission_states: &["not_submitted", "resolved"],
10225        identity_requirement: "request_locator",
10226        resolver_command: None,
10227        cancellation: "per_call",
10228        bounded_retry_after: true,
10229    },
10230    CommandOutcomeContract {
10231        command: Command::ResolveDocumentMutation,
10232        pre_submit_retry_safe: true,
10233        possible_submission_states: &["not_submitted", "resolved"],
10234        identity_requirement: "request_locator",
10235        resolver_command: None,
10236        cancellation: "per_call",
10237        bounded_retry_after: true,
10238    },
10239    CommandOutcomeContract {
10240        command: Command::GetDocument,
10241        pre_submit_retry_safe: true,
10242        possible_submission_states: &["not_submitted", "resolved"],
10243        identity_requirement: "none",
10244        resolver_command: None,
10245        cancellation: "per_call",
10246        bounded_retry_after: true,
10247    },
10248    CommandOutcomeContract {
10249        command: Command::Search,
10250        pre_submit_retry_safe: true,
10251        possible_submission_states: &["not_submitted", "resolved"],
10252        identity_requirement: "none",
10253        resolver_command: None,
10254        cancellation: "per_call",
10255        bounded_retry_after: true,
10256    },
10257    CommandOutcomeContract {
10258        command: Command::OpenPit,
10259        pre_submit_retry_safe: true,
10260        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10261        identity_requirement: "none",
10262        resolver_command: None,
10263        cancellation: "per_call_until_submission_then_resolve",
10264        bounded_retry_after: true,
10265    },
10266    CommandOutcomeContract {
10267        command: Command::RenewPit,
10268        pre_submit_retry_safe: true,
10269        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10270        identity_requirement: "none",
10271        resolver_command: None,
10272        cancellation: "per_call_until_submission_then_resolve",
10273        bounded_retry_after: true,
10274    },
10275    CommandOutcomeContract {
10276        command: Command::ClosePit,
10277        pre_submit_retry_safe: true,
10278        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10279        identity_requirement: "none",
10280        resolver_command: None,
10281        cancellation: "per_call_until_submission_then_resolve",
10282        bounded_retry_after: true,
10283    },
10284    CommandOutcomeContract {
10285        command: Command::ListOperations,
10286        pre_submit_retry_safe: true,
10287        possible_submission_states: &["not_submitted", "resolved"],
10288        identity_requirement: "none",
10289        resolver_command: None,
10290        cancellation: "per_call",
10291        bounded_retry_after: true,
10292    },
10293    CommandOutcomeContract {
10294        command: Command::GetOperation,
10295        pre_submit_retry_safe: true,
10296        possible_submission_states: &["not_submitted", "resolved"],
10297        identity_requirement: "request_locator",
10298        resolver_command: None,
10299        cancellation: "per_call",
10300        bounded_retry_after: true,
10301    },
10302    CommandOutcomeContract {
10303        command: Command::CancelOperation,
10304        pre_submit_retry_safe: true,
10305        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10306        identity_requirement: "request_locator",
10307        resolver_command: None,
10308        cancellation: "per_call_until_submission_then_resolve",
10309        bounded_retry_after: true,
10310    },
10311    CommandOutcomeContract {
10312        command: Command::ListAuditEvents,
10313        pre_submit_retry_safe: true,
10314        possible_submission_states: &["not_submitted", "resolved"],
10315        identity_requirement: "none",
10316        resolver_command: None,
10317        cancellation: "per_call",
10318        bounded_retry_after: true,
10319    },
10320    CommandOutcomeContract {
10321        command: Command::ExportAuditEvents,
10322        pre_submit_retry_safe: true,
10323        possible_submission_states: &["not_submitted", "resolved"],
10324        identity_requirement: "none",
10325        resolver_command: None,
10326        cancellation: "per_call",
10327        bounded_retry_after: true,
10328    },
10329    CommandOutcomeContract {
10330        command: Command::ReserveServiceCredential,
10331        pre_submit_retry_safe: true,
10332        possible_submission_states: &[
10333            "not_submitted",
10334            "submitted",
10335            "known_retired",
10336            "indeterminate",
10337            "resolved",
10338        ],
10339        identity_requirement: "caller_action_id",
10340        resolver_command: Some(Command::ResolveServiceCredentialReservation),
10341        cancellation: "per_call_until_submission_then_resolve",
10342        bounded_retry_after: true,
10343    },
10344    CommandOutcomeContract {
10345        command: Command::ReserveServiceCredentialRotation,
10346        pre_submit_retry_safe: true,
10347        possible_submission_states: &[
10348            "not_submitted",
10349            "submitted",
10350            "known_retired",
10351            "indeterminate",
10352            "resolved",
10353        ],
10354        identity_requirement: "caller_action_id",
10355        resolver_command: Some(Command::ResolveServiceCredentialReservation),
10356        cancellation: "per_call_until_submission_then_resolve",
10357        bounded_retry_after: true,
10358    },
10359    CommandOutcomeContract {
10360        command: Command::ActivateServiceCredential,
10361        pre_submit_retry_safe: true,
10362        possible_submission_states: &[
10363            "not_submitted",
10364            "submitted",
10365            "known_retired",
10366            "indeterminate",
10367            "resolved",
10368        ],
10369        identity_requirement: "server_locator",
10370        resolver_command: Some(Command::ResolveServiceCredentialReservation),
10371        cancellation: "per_call_until_submission_then_resolve",
10372        bounded_retry_after: true,
10373    },
10374    CommandOutcomeContract {
10375        command: Command::ResolveServiceCredentialReservation,
10376        pre_submit_retry_safe: true,
10377        possible_submission_states: &["not_submitted", "resolved"],
10378        identity_requirement: "caller_action_id",
10379        resolver_command: None,
10380        cancellation: "per_call",
10381        bounded_retry_after: true,
10382    },
10383    CommandOutcomeContract {
10384        command: Command::PrepareRevokeServiceCredential,
10385        pre_submit_retry_safe: true,
10386        possible_submission_states: &["not_submitted", "resolved"],
10387        identity_requirement: "server_locator",
10388        resolver_command: None,
10389        cancellation: "per_call",
10390        bounded_retry_after: true,
10391    },
10392    CommandOutcomeContract {
10393        command: Command::RevokeServiceCredential,
10394        pre_submit_retry_safe: true,
10395        possible_submission_states: &[
10396            "not_submitted",
10397            "submitted",
10398            "known_retired",
10399            "indeterminate",
10400            "resolved",
10401        ],
10402        identity_requirement: "request_locator",
10403        resolver_command: Some(Command::ResolveSecurityAction),
10404        cancellation: "per_call_until_submission_then_resolve",
10405        bounded_retry_after: true,
10406    },
10407    CommandOutcomeContract {
10408        command: Command::ResolveSecurityAction,
10409        pre_submit_retry_safe: true,
10410        possible_submission_states: &["not_submitted", "resolved"],
10411        identity_requirement: "request_locator",
10412        resolver_command: None,
10413        cancellation: "per_call",
10414        bounded_retry_after: true,
10415    },
10416    CommandOutcomeContract {
10417        command: Command::GetSecurityRole,
10418        pre_submit_retry_safe: true,
10419        possible_submission_states: &["not_submitted", "resolved"],
10420        identity_requirement: "none",
10421        resolver_command: None,
10422        cancellation: "per_call",
10423        bounded_retry_after: true,
10424    },
10425    CommandOutcomeContract {
10426        command: Command::PrepareRoleAppendAccessChange,
10427        pre_submit_retry_safe: true,
10428        possible_submission_states: &["not_submitted", "resolved"],
10429        identity_requirement: "server_locator",
10430        resolver_command: None,
10431        cancellation: "per_call",
10432        bounded_retry_after: true,
10433    },
10434    CommandOutcomeContract {
10435        command: Command::SubmitRoleAppendAccessChange,
10436        pre_submit_retry_safe: true,
10437        possible_submission_states: &[
10438            "not_submitted",
10439            "submitted",
10440            "known_retired",
10441            "indeterminate",
10442            "resolved",
10443        ],
10444        identity_requirement: "request_locator",
10445        resolver_command: Some(Command::ResolveSecurityAction),
10446        cancellation: "per_call_until_submission_then_resolve",
10447        bounded_retry_after: true,
10448    },
10449    CommandOutcomeContract {
10450        command: Command::ListServiceCredentials,
10451        pre_submit_retry_safe: true,
10452        possible_submission_states: &["not_submitted", "resolved"],
10453        identity_requirement: "none",
10454        resolver_command: None,
10455        cancellation: "per_call",
10456        bounded_retry_after: true,
10457    },
10458    CommandOutcomeContract {
10459        command: Command::ListBackups,
10460        pre_submit_retry_safe: true,
10461        possible_submission_states: &["not_submitted", "resolved"],
10462        identity_requirement: "none",
10463        resolver_command: None,
10464        cancellation: "per_call",
10465        bounded_retry_after: true,
10466    },
10467    CommandOutcomeContract {
10468        command: Command::GetBackup,
10469        pre_submit_retry_safe: true,
10470        possible_submission_states: &["not_submitted", "resolved"],
10471        identity_requirement: "request_locator",
10472        resolver_command: None,
10473        cancellation: "per_call",
10474        bounded_retry_after: true,
10475    },
10476    CommandOutcomeContract {
10477        command: Command::CreateBackup,
10478        pre_submit_retry_safe: true,
10479        possible_submission_states: &[
10480            "not_submitted",
10481            "submitted",
10482            "known_retired",
10483            "indeterminate",
10484            "resolved",
10485        ],
10486        identity_requirement: "caller_action_id",
10487        resolver_command: Some(Command::ResolveBackupAction),
10488        cancellation: "per_call_until_submission_then_resolve",
10489        bounded_retry_after: true,
10490    },
10491    CommandOutcomeContract {
10492        command: Command::ResolveBackupAction,
10493        pre_submit_retry_safe: true,
10494        possible_submission_states: &["not_submitted", "resolved"],
10495        identity_requirement: "caller_action_id",
10496        resolver_command: None,
10497        cancellation: "per_call",
10498        bounded_retry_after: true,
10499    },
10500    CommandOutcomeContract {
10501        command: Command::GetRuntimeStatus,
10502        pre_submit_retry_safe: true,
10503        possible_submission_states: &["not_submitted", "resolved"],
10504        identity_requirement: "none",
10505        resolver_command: None,
10506        cancellation: "per_call",
10507        bounded_retry_after: true,
10508    },
10509    CommandOutcomeContract {
10510        command: Command::GetResultCacheStatus,
10511        pre_submit_retry_safe: true,
10512        possible_submission_states: &["not_submitted", "resolved"],
10513        identity_requirement: "none",
10514        resolver_command: None,
10515        cancellation: "per_call",
10516        bounded_retry_after: true,
10517    },
10518    CommandOutcomeContract {
10519        command: Command::GetFieldPromotionStatus,
10520        pre_submit_retry_safe: true,
10521        possible_submission_states: &["not_submitted", "resolved"],
10522        identity_requirement: "none",
10523        resolver_command: None,
10524        cancellation: "per_call",
10525        bounded_retry_after: true,
10526    },
10527    CommandOutcomeContract {
10528        command: Command::GetOverloadStatus,
10529        pre_submit_retry_safe: true,
10530        possible_submission_states: &["not_submitted", "resolved"],
10531        identity_requirement: "none",
10532        resolver_command: None,
10533        cancellation: "per_call",
10534        bounded_retry_after: true,
10535    },
10536    CommandOutcomeContract {
10537        command: Command::ConfigureExternalKey,
10538        pre_submit_retry_safe: true,
10539        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10540        identity_requirement: "none",
10541        resolver_command: None,
10542        cancellation: "per_call_until_submission_then_resolve",
10543        bounded_retry_after: true,
10544    },
10545    CommandOutcomeContract {
10546        command: Command::RotateExternalKeyBinding,
10547        pre_submit_retry_safe: true,
10548        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10549        identity_requirement: "none",
10550        resolver_command: None,
10551        cancellation: "per_call_until_submission_then_resolve",
10552        bounded_retry_after: true,
10553    },
10554    CommandOutcomeContract {
10555        command: Command::ConfigureAggregateThenDelete,
10556        pre_submit_retry_safe: true,
10557        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10558        identity_requirement: "none",
10559        resolver_command: None,
10560        cancellation: "per_call_until_submission_then_resolve",
10561        bounded_retry_after: true,
10562    },
10563    CommandOutcomeContract {
10564        command: Command::GetLifecycleStatus,
10565        pre_submit_retry_safe: true,
10566        possible_submission_states: &["not_submitted", "resolved"],
10567        identity_requirement: "none",
10568        resolver_command: None,
10569        cancellation: "per_call",
10570        bounded_retry_after: true,
10571    },
10572    CommandOutcomeContract {
10573        command: Command::GetQuota,
10574        pre_submit_retry_safe: true,
10575        possible_submission_states: &["not_submitted", "resolved"],
10576        identity_requirement: "none",
10577        resolver_command: None,
10578        cancellation: "per_call",
10579        bounded_retry_after: true,
10580    },
10581    CommandOutcomeContract {
10582        command: Command::UpdateQuota,
10583        pre_submit_retry_safe: true,
10584        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10585        identity_requirement: "none",
10586        resolver_command: None,
10587        cancellation: "per_call_until_submission_then_resolve",
10588        bounded_retry_after: true,
10589    },
10590    CommandOutcomeContract {
10591        command: Command::GetBinding,
10592        pre_submit_retry_safe: true,
10593        possible_submission_states: &["not_submitted", "resolved"],
10594        identity_requirement: "none",
10595        resolver_command: None,
10596        cancellation: "per_call",
10597        bounded_retry_after: true,
10598    },
10599    CommandOutcomeContract {
10600        command: Command::GetAdmissionStatus,
10601        pre_submit_retry_safe: true,
10602        possible_submission_states: &["not_submitted", "resolved"],
10603        identity_requirement: "none",
10604        resolver_command: None,
10605        cancellation: "per_call",
10606        bounded_retry_after: true,
10607    },
10608    CommandOutcomeContract {
10609        command: Command::SetAdmission,
10610        pre_submit_retry_safe: true,
10611        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10612        identity_requirement: "none",
10613        resolver_command: None,
10614        cancellation: "per_call_until_submission_then_resolve",
10615        bounded_retry_after: true,
10616    },
10617    CommandOutcomeContract {
10618        command: Command::GetQuiesceStatus,
10619        pre_submit_retry_safe: true,
10620        possible_submission_states: &["not_submitted", "resolved"],
10621        identity_requirement: "none",
10622        resolver_command: None,
10623        cancellation: "per_call",
10624        bounded_retry_after: true,
10625    },
10626    CommandOutcomeContract {
10627        command: Command::GetDecommissionReadiness,
10628        pre_submit_retry_safe: true,
10629        possible_submission_states: &["not_submitted", "resolved"],
10630        identity_requirement: "none",
10631        resolver_command: None,
10632        cancellation: "per_call",
10633        bounded_retry_after: true,
10634    },
10635    CommandOutcomeContract {
10636        command: Command::GetUpgradeReadiness,
10637        pre_submit_retry_safe: true,
10638        possible_submission_states: &["not_submitted", "resolved"],
10639        identity_requirement: "none",
10640        resolver_command: None,
10641        cancellation: "per_call",
10642        bounded_retry_after: true,
10643    },
10644    CommandOutcomeContract {
10645        command: Command::GetMaintenanceStatus,
10646        pre_submit_retry_safe: true,
10647        possible_submission_states: &["not_submitted", "resolved"],
10648        identity_requirement: "none",
10649        resolver_command: None,
10650        cancellation: "per_call",
10651        bounded_retry_after: true,
10652    },
10653    CommandOutcomeContract {
10654        command: Command::GetRestoreReadiness,
10655        pre_submit_retry_safe: true,
10656        possible_submission_states: &["not_submitted", "resolved"],
10657        identity_requirement: "none",
10658        resolver_command: None,
10659        cancellation: "per_call",
10660        bounded_retry_after: true,
10661    },
10662    CommandOutcomeContract {
10663        command: Command::CreateDiagnostic,
10664        pre_submit_retry_safe: true,
10665        possible_submission_states: &["not_submitted", "submitted", "indeterminate", "resolved"],
10666        identity_requirement: "none",
10667        resolver_command: None,
10668        cancellation: "per_call_until_submission_then_resolve",
10669        bounded_retry_after: true,
10670    },
10671    CommandOutcomeContract {
10672        command: Command::GetDiagnostic,
10673        pre_submit_retry_safe: true,
10674        possible_submission_states: &["not_submitted", "resolved"],
10675        identity_requirement: "request_locator",
10676        resolver_command: None,
10677        cancellation: "per_call",
10678        bounded_retry_after: true,
10679    },
10680    CommandOutcomeContract {
10681        command: Command::ReadArtifactChunk,
10682        pre_submit_retry_safe: true,
10683        possible_submission_states: &["not_submitted", "resolved"],
10684        identity_requirement: "none",
10685        resolver_command: None,
10686        cancellation: "per_call",
10687        bounded_retry_after: true,
10688    },
10689    CommandOutcomeContract {
10690        command: Command::ExportUsage,
10691        pre_submit_retry_safe: true,
10692        possible_submission_states: &["not_submitted", "resolved"],
10693        identity_requirement: "none",
10694        resolver_command: None,
10695        cancellation: "per_call",
10696        bounded_retry_after: true,
10697    },
10698    CommandOutcomeContract {
10699        command: Command::ExecuteStateRead,
10700        pre_submit_retry_safe: true,
10701        possible_submission_states: &["not_submitted", "resolved"],
10702        identity_requirement: "none",
10703        resolver_command: None,
10704        cancellation: "per_call",
10705        bounded_retry_after: true,
10706    },
10707    CommandOutcomeContract {
10708        command: Command::PrepareStateWrite,
10709        pre_submit_retry_safe: true,
10710        possible_submission_states: &["not_submitted", "resolved"],
10711        identity_requirement: "caller_action_id",
10712        resolver_command: None,
10713        cancellation: "per_call",
10714        bounded_retry_after: true,
10715    },
10716    CommandOutcomeContract {
10717        command: Command::SubmitStateWrite,
10718        pre_submit_retry_safe: true,
10719        possible_submission_states: &[
10720            "not_submitted",
10721            "submitted",
10722            "known_retired",
10723            "indeterminate",
10724            "resolved",
10725        ],
10726        identity_requirement: "request_locator",
10727        resolver_command: Some(Command::ResolveStateWrite),
10728        cancellation: "per_call_until_submission_then_resolve",
10729        bounded_retry_after: true,
10730    },
10731    CommandOutcomeContract {
10732        command: Command::ResolveStateWrite,
10733        pre_submit_retry_safe: true,
10734        possible_submission_states: &["not_submitted", "resolved"],
10735        identity_requirement: "request_locator",
10736        resolver_command: None,
10737        cancellation: "per_call",
10738        bounded_retry_after: true,
10739    },
10740];
10741#[derive(Clone, Copy, Debug, Eq, PartialEq)]
10742pub struct ErrorOutcomeContract {
10743    pub code: ErrorCode,
10744    pub when_not_submitted: Option<&'static str>,
10745    pub when_submitted: Option<&'static str>,
10746    pub retry_safe: &'static str,
10747    pub retry_after_limit_id: Option<&'static str>,
10748    pub recovery_identity: &'static str,
10749}
10750pub const LODESTONE_API_ERROR_OUTCOMES: &[ErrorOutcomeContract] = &[
10751    ErrorOutcomeContract {
10752        code: ErrorCode::Aborted,
10753        when_not_submitted: Some("not_submitted"),
10754        when_submitted: Some("submitted"),
10755        retry_safe: "only_when_retry_safe",
10756        retry_after_limit_id: None,
10757        recovery_identity: "request_identity",
10758    },
10759    ErrorOutcomeContract {
10760        code: ErrorCode::DeadlineExceeded,
10761        when_not_submitted: Some("not_submitted"),
10762        when_submitted: Some("submitted"),
10763        retry_safe: "only_when_retry_safe",
10764        retry_after_limit_id: None,
10765        recovery_identity: "request_identity",
10766    },
10767    ErrorOutcomeContract {
10768        code: ErrorCode::InvalidRequest,
10769        when_not_submitted: Some("not_submitted"),
10770        when_submitted: None,
10771        retry_safe: "stop",
10772        retry_after_limit_id: None,
10773        recovery_identity: "none",
10774    },
10775    ErrorOutcomeContract {
10776        code: ErrorCode::UnsupportedVersion,
10777        when_not_submitted: Some("not_submitted"),
10778        when_submitted: None,
10779        retry_safe: "stop",
10780        retry_after_limit_id: None,
10781        recovery_identity: "none",
10782    },
10783    ErrorOutcomeContract {
10784        code: ErrorCode::Unauthenticated,
10785        when_not_submitted: Some("not_submitted"),
10786        when_submitted: None,
10787        retry_safe: "refresh_credential_then_retry",
10788        retry_after_limit_id: None,
10789        recovery_identity: "none",
10790    },
10791    ErrorOutcomeContract {
10792        code: ErrorCode::PermissionDenied,
10793        when_not_submitted: Some("not_submitted"),
10794        when_submitted: None,
10795        retry_safe: "stop",
10796        retry_after_limit_id: None,
10797        recovery_identity: "none",
10798    },
10799    ErrorOutcomeContract {
10800        code: ErrorCode::NotFound,
10801        when_not_submitted: Some("not_submitted"),
10802        when_submitted: Some("resolved"),
10803        retry_safe: "stop",
10804        retry_after_limit_id: None,
10805        recovery_identity: "request_identity",
10806    },
10807    ErrorOutcomeContract {
10808        code: ErrorCode::Conflict,
10809        when_not_submitted: Some("not_submitted"),
10810        when_submitted: Some("resolved"),
10811        retry_safe: "resolve_or_refresh_precondition",
10812        retry_after_limit_id: None,
10813        recovery_identity: "request_identity",
10814    },
10815    ErrorOutcomeContract {
10816        code: ErrorCode::StaleCursor,
10817        when_not_submitted: Some("not_submitted"),
10818        when_submitted: None,
10819        retry_safe: "restart_page",
10820        retry_after_limit_id: None,
10821        recovery_identity: "cursor",
10822    },
10823    ErrorOutcomeContract {
10824        code: ErrorCode::RestartBudgetExhausted,
10825        when_not_submitted: Some("not_submitted"),
10826        when_submitted: None,
10827        retry_safe: "stop",
10828        retry_after_limit_id: None,
10829        recovery_identity: "cursor",
10830    },
10831    ErrorOutcomeContract {
10832        code: ErrorCode::LimitExceeded,
10833        when_not_submitted: Some("not_submitted"),
10834        when_submitted: None,
10835        retry_safe: "reduce_request",
10836        retry_after_limit_id: None,
10837        recovery_identity: "none",
10838    },
10839    ErrorOutcomeContract {
10840        code: ErrorCode::CapabilityUnavailable,
10841        when_not_submitted: Some("not_submitted"),
10842        when_submitted: None,
10843        retry_safe: "stop",
10844        retry_after_limit_id: None,
10845        recovery_identity: "none",
10846    },
10847    ErrorOutcomeContract {
10848        code: ErrorCode::NotSubmitted,
10849        when_not_submitted: Some("not_submitted"),
10850        when_submitted: None,
10851        retry_safe: "retry_after",
10852        retry_after_limit_id: Some("retry_after_millis"),
10853        recovery_identity: "request_identity",
10854    },
10855    ErrorOutcomeContract {
10856        code: ErrorCode::SubmittedIndeterminate,
10857        when_not_submitted: None,
10858        when_submitted: Some("indeterminate"),
10859        retry_safe: "resolve",
10860        retry_after_limit_id: None,
10861        recovery_identity: "locator_or_caller_action_id",
10862    },
10863    ErrorOutcomeContract {
10864        code: ErrorCode::ExpiredUnknown,
10865        when_not_submitted: Some("known_retired"),
10866        when_submitted: Some("known_retired"),
10867        retry_safe: "stop",
10868        retry_after_limit_id: None,
10869        recovery_identity: "locator_or_caller_action_id",
10870    },
10871    ErrorOutcomeContract {
10872        code: ErrorCode::SecretNotEscrowed,
10873        when_not_submitted: None,
10874        when_submitted: Some("resolved"),
10875        retry_safe: "resolve",
10876        retry_after_limit_id: None,
10877        recovery_identity: "reservation_action_id",
10878    },
10879    ErrorOutcomeContract {
10880        code: ErrorCode::RetentionGap,
10881        when_not_submitted: Some("known_retired"),
10882        when_submitted: Some("known_retired"),
10883        retry_safe: "stop",
10884        retry_after_limit_id: None,
10885        recovery_identity: "cursor_or_locator",
10886    },
10887    ErrorOutcomeContract {
10888        code: ErrorCode::ArtifactRangeInvalid,
10889        when_not_submitted: Some("not_submitted"),
10890        when_submitted: None,
10891        retry_safe: "correct_range",
10892        retry_after_limit_id: None,
10893        recovery_identity: "artifact_identity",
10894    },
10895    ErrorOutcomeContract {
10896        code: ErrorCode::ChecksumMismatch,
10897        when_not_submitted: Some("resolved"),
10898        when_submitted: Some("resolved"),
10899        retry_safe: "stop",
10900        retry_after_limit_id: None,
10901        recovery_identity: "artifact_identity",
10902    },
10903    ErrorOutcomeContract {
10904        code: ErrorCode::TemporarilyUnavailable,
10905        when_not_submitted: Some("not_submitted"),
10906        when_submitted: Some("submitted"),
10907        retry_safe: "retry_after_when_safe",
10908        retry_after_limit_id: Some("retry_after_millis"),
10909        recovery_identity: "request_identity",
10910    },
10911    ErrorOutcomeContract {
10912        code: ErrorCode::Internal,
10913        when_not_submitted: Some("not_submitted"),
10914        when_submitted: Some("indeterminate"),
10915        retry_safe: "resolve_or_stop",
10916        retry_after_limit_id: None,
10917        recovery_identity: "request_identity",
10918    },
10919];
10920#[derive(Clone, Copy, Debug, Eq, PartialEq)]
10921pub struct Limit {
10922    pub id: &'static str,
10923    pub default: u64,
10924    pub maximum: u64,
10925    pub unit: &'static str,
10926}
10927pub const LODESTONE_API_LIMITS: &[Limit] = &[
10928    Limit {
10929        id: "request_bytes",
10930        default: 2097152,
10931        maximum: 2097152,
10932        unit: "bytes",
10933    },
10934    Limit {
10935        id: "response_bytes",
10936        default: 2097152,
10937        maximum: 2097152,
10938        unit: "bytes",
10939    },
10940    Limit {
10941        id: "page_size",
10942        default: 100,
10943        maximum: 1000,
10944        unit: "items",
10945    },
10946    Limit {
10947        id: "catalog_page_size",
10948        default: 100,
10949        maximum: 100,
10950        unit: "items",
10951    },
10952    Limit {
10953        id: "catalog_restart_budget",
10954        default: 8,
10955        maximum: 8,
10956        unit: "restarts",
10957    },
10958    Limit {
10959        id: "query_clauses",
10960        default: 256,
10961        maximum: 1024,
10962        unit: "clauses",
10963    },
10964    Limit {
10965        id: "text_query_bytes",
10966        default: 16384,
10967        maximum: 16384,
10968        unit: "bytes",
10969    },
10970    Limit {
10971        id: "text_query_fields",
10972        default: 64,
10973        maximum: 64,
10974        unit: "fields",
10975    },
10976    Limit {
10977        id: "text_query_slop",
10978        default: 64,
10979        maximum: 64,
10980        unit: "positions",
10981    },
10982    Limit {
10983        id: "text_query_boost",
10984        default: 1024,
10985        maximum: 1024,
10986        unit: "multiplier",
10987    },
10988    Limit {
10989        id: "text_query_fuzzy_expansions",
10990        default: 1024,
10991        maximum: 1024,
10992        unit: "terms",
10993    },
10994    Limit {
10995        id: "text_query_fuzzy_distance",
10996        default: 2,
10997        maximum: 2,
10998        unit: "edits",
10999    },
11000    Limit {
11001        id: "text_query_dictionary_scan_terms",
11002        default: 65536,
11003        maximum: 65536,
11004        unit: "terms",
11005    },
11006    Limit {
11007        id: "text_query_dictionary_scan_bytes",
11008        default: 16777216,
11009        maximum: 16777216,
11010        unit: "bytes",
11011    },
11012    Limit {
11013        id: "text_query_fuzzy_work_units",
11014        default: 2000000,
11015        maximum: 2000000,
11016        unit: "distance_cells",
11017    },
11018    Limit {
11019        id: "aggregation_nodes",
11020        default: 64,
11021        maximum: 256,
11022        unit: "nodes",
11023    },
11024    Limit {
11025        id: "aggregation_buckets",
11026        default: 65536,
11027        maximum: 65536,
11028        unit: "buckets",
11029    },
11030    Limit {
11031        id: "approximate_cardinality_precision",
11032        default: 12,
11033        maximum: 16,
11034        unit: "index_bits",
11035    },
11036    Limit {
11037        id: "approximate_percentile_precision",
11038        default: 10,
11039        maximum: 12,
11040        unit: "index_bits",
11041    },
11042    Limit {
11043        id: "operation_page_authorities",
11044        default: 6,
11045        maximum: 6,
11046        unit: "authorities",
11047    },
11048    Limit {
11049        id: "artifact_chunk_bytes",
11050        default: 262144,
11051        maximum: 1048576,
11052        unit: "bytes",
11053    },
11054    Limit {
11055        id: "bulk_document_items",
11056        default: 128,
11057        maximum: 1024,
11058        unit: "items",
11059    },
11060    Limit {
11061        id: "bulk_document_bytes",
11062        default: 2097152,
11063        maximum: 2097152,
11064        unit: "bytes",
11065    },
11066    Limit {
11067        id: "state_command_keys",
11068        default: 128,
11069        maximum: 128,
11070        unit: "keys",
11071    },
11072    Limit {
11073        id: "state_command_value_bytes",
11074        default: 1048576,
11075        maximum: 1048576,
11076        unit: "bytes",
11077    },
11078    Limit {
11079        id: "state_write_outcomes",
11080        default: 4096,
11081        maximum: 4096,
11082        unit: "entries",
11083    },
11084    Limit {
11085        id: "exact_decimal_scale",
11086        default: 18,
11087        maximum: 1024,
11088        unit: "decimal_places",
11089    },
11090    Limit {
11091        id: "retry_after_millis",
11092        default: 1000,
11093        maximum: 60000,
11094        unit: "milliseconds",
11095    },
11096    Limit {
11097        id: "mapping_fields",
11098        default: 16384,
11099        maximum: 16384,
11100        unit: "fields",
11101    },
11102    Limit {
11103        id: "search_result_window",
11104        default: 10000,
11105        maximum: 10000,
11106        unit: "items",
11107    },
11108    Limit {
11109        id: "routing_values",
11110        default: 1024,
11111        maximum: 1024,
11112        unit: "items",
11113    },
11114    Limit {
11115        id: "routing_value_bytes",
11116        default: 4096,
11117        maximum: 4096,
11118        unit: "bytes",
11119    },
11120    Limit {
11121        id: "query_recursion_depth",
11122        default: 64,
11123        maximum: 64,
11124        unit: "levels",
11125    },
11126    Limit {
11127        id: "vector_dimensions",
11128        default: 2048,
11129        maximum: 2048,
11130        unit: "dimensions",
11131    },
11132    Limit {
11133        id: "vector_candidates",
11134        default: 10000,
11135        maximum: 10000,
11136        unit: "items",
11137    },
11138    Limit {
11139        id: "operation_page_size",
11140        default: 100,
11141        maximum: 100,
11142        unit: "items",
11143    },
11144    Limit {
11145        id: "resource_initial_shards",
11146        default: 1,
11147        maximum: 4096,
11148        unit: "shards",
11149    },
11150    Limit {
11151        id: "resource_target_shard_bytes",
11152        default: 536870912,
11153        maximum: 1125899906842624,
11154        unit: "bytes",
11155    },
11156    Limit {
11157        id: "resource_admission_weight",
11158        default: 1,
11159        maximum: 1000000,
11160        unit: "weight",
11161    },
11162    Limit {
11163        id: "resource_ram_bytes",
11164        default: 1073741824,
11165        maximum: 1125899906842624,
11166        unit: "bytes",
11167    },
11168    Limit {
11169        id: "resource_nvme_bytes",
11170        default: 2147483648,
11171        maximum: 1125899906842624,
11172        unit: "bytes",
11173    },
11174    Limit {
11175        id: "resource_refresh_millis",
11176        default: 200,
11177        maximum: 604800000,
11178        unit: "milliseconds",
11179    },
11180    Limit {
11181        id: "resource_memtable_bytes",
11182        default: 268435456,
11183        maximum: 1125899906842624,
11184        unit: "bytes",
11185    },
11186    Limit {
11187        id: "resource_parallelism",
11188        default: 1,
11189        maximum: 4096,
11190        unit: "workers",
11191    },
11192];
11193#[derive(Clone, Copy, Debug, Eq, PartialEq)]
11194pub enum JsonError {
11195    DuplicateObjectField,
11196    InvalidScalar,
11197}
11198pub fn validate_semantic_json(value: &JsonValue) -> Result<(), JsonError> {
11199    match value {
11200        JsonValue::I64(item) => item.validate().map_err(|_| JsonError::InvalidScalar),
11201        JsonValue::U64(item) => item.validate().map_err(|_| JsonError::InvalidScalar),
11202        JsonValue::ExactDecimal(item) => item.validate().map_err(|_| JsonError::InvalidScalar),
11203        JsonValue::Approximate(item) => item.validate().map_err(|_| JsonError::InvalidScalar),
11204        JsonValue::Array(items) => items.iter().try_for_each(validate_semantic_json),
11205        JsonValue::Object(fields) => {
11206            let mut names = std::collections::BTreeSet::new();
11207            for field in fields {
11208                if !names.insert(field.name.as_str()) {
11209                    return Err(JsonError::DuplicateObjectField);
11210                }
11211                validate_semantic_json(&field.value)?;
11212            }
11213            Ok(())
11214        }
11215        JsonValue::Null | JsonValue::Bool(_) | JsonValue::String(_) => Ok(()),
11216    }
11217}
11218#[cfg(test)]
11219mod tests {
11220    use super::*;
11221    fn assert_fixture<T>(value: &serde_json::Value) -> Result<(), Box<dyn std::error::Error>>
11222    where
11223        T: serde::de::DeserializeOwned + Serialize,
11224    {
11225        let decoded: T = serde_json::from_value(value.clone())?;
11226        assert_eq!(serde_json::to_value(decoded)?, *value);
11227        Ok(())
11228    }
11229    #[test]
11230    fn every_named_type_has_a_canonical_round_trip_fixture() -> Result<(), Box<dyn std::error::Error>> {
11231        let document: serde_json::Value =
11232            serde_json::from_str(include_str!("../../../tests/p10/lodestone-api-closed-schema.json"))?;
11233        assert_eq!(document["spec_sha256"], LODESTONE_API_SPEC_SHA256);
11234        let fixtures = document["named_types"]
11235            .as_object()
11236            .ok_or("named type fixtures are not an object")?;
11237        assert_eq!(fixtures.len(), LODESTONE_API_TYPE_CONTRACTS.len());
11238        for (name, value) in fixtures {
11239            match name.as_str() {
11240                "cursor" => assert_fixture::<Cursor>(value)?,
11241                "locator" => assert_fixture::<Locator>(value)?,
11242                "resource" => assert_fixture::<Resource>(value)?,
11243                "field_promotion_configuration" => assert_fixture::<FieldPromotionConfiguration>(value)?,
11244                "overload_configuration" => assert_fixture::<OverloadConfiguration>(value)?,
11245                "index_policies" => assert_fixture::<IndexPolicies>(value)?,
11246                "maintenance_budgets" => assert_fixture::<MaintenanceBudgets>(value)?,
11247                "resource_durability_class" => assert_fixture::<ResourceDurabilityClass>(value)?,
11248                "resource_storage_class" => assert_fixture::<ResourceStorageClass>(value)?,
11249                "workload_class" => assert_fixture::<WorkloadClass>(value)?,
11250                "index_resource_spec" => assert_fixture::<IndexResourceSpec>(value)?,
11251                "index_summary" => assert_fixture::<IndexSummary>(value)?,
11252                "mapping_mode" => assert_fixture::<MappingMode>(value)?,
11253                "dynamic_mapping_policy" => assert_fixture::<DynamicMappingPolicy>(value)?,
11254                "mapping_analyzer" => assert_fixture::<MappingAnalyzer>(value)?,
11255                "keyword_normalizer" => assert_fixture::<KeywordNormalizer>(value)?,
11256                "vector_metric" => assert_fixture::<VectorMetric>(value)?,
11257                "mapping_scalar" => assert_fixture::<MappingScalar>(value)?,
11258                "mapping_field_type" => assert_fixture::<MappingFieldType>(value)?,
11259                "mapping_field" => assert_fixture::<MappingField>(value)?,
11260                "multi_field_projection" => assert_fixture::<MultiFieldProjection>(value)?,
11261                "analyzer_identity" => assert_fixture::<AnalyzerIdentity>(value)?,
11262                "keyword_limit" => assert_fixture::<KeywordLimit>(value)?,
11263                "mapping" => assert_fixture::<Mapping>(value)?,
11264                "index_detail" => assert_fixture::<IndexDetail>(value)?,
11265                "source_provider" => assert_fixture::<SourceProvider>(value)?,
11266                "source_decoder" => assert_fixture::<SourceDecoder>(value)?,
11267                "source_replay_guarantees" => assert_fixture::<SourceReplayGuarantees>(value)?,
11268                "source_partition_configuration" => assert_fixture::<SourcePartitionConfiguration>(value)?,
11269                "replayable_source_configuration" => assert_fixture::<ReplayableSourceConfiguration>(value)?,
11270                "source_partition_status" => assert_fixture::<SourcePartitionStatus>(value)?,
11271                "replayable_source_status" => assert_fixture::<ReplayableSourceStatus>(value)?,
11272                "source_control_transition" => assert_fixture::<SourceControlTransition>(value)?,
11273                "history_ledger_precondition" => assert_fixture::<HistoryLedgerPrecondition>(value)?,
11274                "history_retention_policy" => assert_fixture::<HistoryRetentionPolicy>(value)?,
11275                "history_selector" => assert_fixture::<HistorySelector>(value)?,
11276                "history_hold" => assert_fixture::<HistoryHold>(value)?,
11277                "history_status" => assert_fixture::<HistoryStatus>(value)?,
11278                "history_resolution" => assert_fixture::<HistoryResolution>(value)?,
11279                "index_reference" => assert_fixture::<IndexReference>(value)?,
11280                "alias_target" => assert_fixture::<AliasTarget>(value)?,
11281                "alias_summary" => assert_fixture::<AliasSummary>(value)?,
11282                "alias_detail" => assert_fixture::<AliasDetail>(value)?,
11283                "data_stream_summary" => assert_fixture::<DataStreamSummary>(value)?,
11284                "component_template_binding" => assert_fixture::<ComponentTemplateBinding>(value)?,
11285                "index_template_binding" => assert_fixture::<IndexTemplateBinding>(value)?,
11286                "lifecycle_policy_binding" => assert_fixture::<LifecyclePolicyBinding>(value)?,
11287                "data_stream_detail" => assert_fixture::<DataStreamDetail>(value)?,
11288                "component_template_summary" => assert_fixture::<ComponentTemplateSummary>(value)?,
11289                "component_template_detail" => assert_fixture::<ComponentTemplateDetail>(value)?,
11290                "index_template_summary" => assert_fixture::<IndexTemplateSummary>(value)?,
11291                "index_template_detail" => assert_fixture::<IndexTemplateDetail>(value)?,
11292                "ingest_pipeline_summary" => assert_fixture::<IngestPipelineSummary>(value)?,
11293                "ingest_pipeline_detail" => assert_fixture::<IngestPipelineDetail>(value)?,
11294                "ingest_pipeline_selection" => assert_fixture::<IngestPipelineSelection>(value)?,
11295                "lifecycle_policy_summary" => assert_fixture::<LifecyclePolicySummary>(value)?,
11296                "rollover_thresholds" => assert_fixture::<RolloverThresholds>(value)?,
11297                "retention_policy" => assert_fixture::<RetentionPolicy>(value)?,
11298                "lifecycle_policy_detail" => assert_fixture::<LifecyclePolicyDetail>(value)?,
11299                "text_query_operator" => assert_fixture::<TextQueryOperator>(value)?,
11300                "text_query_analyzer" => assert_fixture::<TextQueryAnalyzer>(value)?,
11301                "zero_terms_query" => assert_fixture::<ZeroTermsQuery>(value)?,
11302                "text_query_options" => assert_fixture::<TextQueryOptions>(value)?,
11303                "multi_match_mode" => assert_fixture::<MultiMatchMode>(value)?,
11304                "multi_match_field" => assert_fixture::<MultiMatchField>(value)?,
11305                "multi_match_options" => assert_fixture::<MultiMatchOptions>(value)?,
11306                "sort_order" => assert_fixture::<SortOrder>(value)?,
11307                "sort_mode" => assert_fixture::<SortMode>(value)?,
11308                "missing_order" => assert_fixture::<MissingOrder>(value)?,
11309                "nested_score_mode" => assert_fixture::<NestedScoreMode>(value)?,
11310                "nested_inner_hits" => assert_fixture::<NestedInnerHits>(value)?,
11311                "sort_spec" => assert_fixture::<SortSpec>(value)?,
11312                "query" => assert_fixture::<Query>(value)?,
11313                "histogram_bounds" => assert_fixture::<HistogramBounds>(value)?,
11314                "date_histogram_bounds" => assert_fixture::<DateHistogramBounds>(value)?,
11315                "approximation_algorithm" => assert_fixture::<ApproximationAlgorithm>(value)?,
11316                "approximation" => assert_fixture::<Approximation>(value)?,
11317                "percentile_value" => assert_fixture::<PercentileValue>(value)?,
11318                "approximate_percentile_value" => assert_fixture::<ApproximatePercentileValue>(value)?,
11319                "aggregation" => assert_fixture::<Aggregation>(value)?,
11320                "nested_search_hit" => assert_fixture::<NestedSearchHit>(value)?,
11321                "named_nested_inner_hits_result" => assert_fixture::<NamedNestedInnerHitsResult>(value)?,
11322                "search_hit" => assert_fixture::<SearchHit>(value)?,
11323                "aggregation_bucket" => assert_fixture::<AggregationBucket>(value)?,
11324                "aggregation_result" => assert_fixture::<AggregationResult>(value)?,
11325                "shard_counts" => assert_fixture::<ShardCounts>(value)?,
11326                "total_hits_relation" => assert_fixture::<TotalHitsRelation>(value)?,
11327                "search_total" => assert_fixture::<SearchTotal>(value)?,
11328                "artifact" => assert_fixture::<Artifact>(value)?,
11329                "operation" => assert_fixture::<Operation>(value)?,
11330                "submission_state" => assert_fixture::<SubmissionState>(value)?,
11331                "expected_binding" => assert_fixture::<ExpectedBinding>(value)?,
11332                "administration_alias_action" => assert_fixture::<AdministrationAliasAction>(value)?,
11333                "administration_mutation" => assert_fixture::<AdministrationMutation>(value)?,
11334                "administration_outcome" => assert_fixture::<AdministrationOutcome>(value)?,
11335                "index_change_apply_receipt" => assert_fixture::<IndexChangeApplyReceipt>(value)?,
11336                "backup_encryption_policy" => assert_fixture::<BackupEncryptionPolicy>(value)?,
11337                "backup_create_outcome" => assert_fixture::<BackupCreateOutcome>(value)?,
11338                "bulk_document_item" => assert_fixture::<BulkDocumentItem>(value)?,
11339                "bulk_document_item_outcome" => assert_fixture::<BulkDocumentItemOutcome>(value)?,
11340                "bulk_document_outcome" => assert_fixture::<BulkDocumentOutcome>(value)?,
11341                "retained_append_item" => assert_fixture::<RetainedAppendItem>(value)?,
11342                "retained_append_state" => assert_fixture::<RetainedAppendState>(value)?,
11343                "retained_append_retry_safety" => assert_fixture::<RetainedAppendRetrySafety>(value)?,
11344                "retained_append_item_outcome" => assert_fixture::<RetainedAppendItemOutcome>(value)?,
11345                "retained_append_bulk_outcome" => assert_fixture::<RetainedAppendBulkOutcome>(value)?,
11346                "retained_append_observation_state" => assert_fixture::<RetainedAppendObservationState>(value)?,
11347                "retained_append_observation_outcome" => assert_fixture::<RetainedAppendObservationOutcome>(value)?,
11348                "binary_value" => assert_fixture::<BinaryValue>(value)?,
11349                "state_hash_field" => assert_fixture::<StateHashField>(value)?,
11350                "state_set_entry" => assert_fixture::<StateSetEntry>(value)?,
11351                "state_set_condition" => assert_fixture::<StateSetCondition>(value)?,
11352                "state_operation" => assert_fixture::<StateOperation>(value)?,
11353                "state_optional_value" => assert_fixture::<StateOptionalValue>(value)?,
11354                "state_command_result" => assert_fixture::<StateCommandResult>(value)?,
11355                "state_write_resolution" => assert_fixture::<StateWriteResolution>(value)?,
11356                "service_credential_reservation" => assert_fixture::<ServiceCredentialReservation>(value)?,
11357                "subscription_metadata_field" => assert_fixture::<SubscriptionMetadataField>(value)?,
11358                "subscription_field" => assert_fixture::<SubscriptionField>(value)?,
11359                "subscription_filter" => assert_fixture::<SubscriptionFilter>(value)?,
11360                "subscription_cursor_entry" => assert_fixture::<SubscriptionCursorEntry>(value)?,
11361                "subscription_route" => assert_fixture::<SubscriptionRoute>(value)?,
11362                "subscription_start_position" => assert_fixture::<SubscriptionStartPosition>(value)?,
11363                "subscription_start" => assert_fixture::<SubscriptionStart>(value)?,
11364                "subscription_accepted" => assert_fixture::<SubscriptionAccepted>(value)?,
11365                "subscription_writer_fence" => assert_fixture::<SubscriptionWriterFence>(value)?,
11366                "subscription_event" => assert_fixture::<SubscriptionEvent>(value)?,
11367                "subscription_heartbeat" => assert_fixture::<SubscriptionHeartbeat>(value)?,
11368                "subscription_gap" => assert_fixture::<SubscriptionGap>(value)?,
11369                "subscription_terminal" => assert_fixture::<SubscriptionTerminal>(value)?,
11370                "subscription_frame" => assert_fixture::<SubscriptionFrame>(value)?,
11371                "stream_binding" => assert_fixture::<StreamBinding>(value)?,
11372                "capability_grant" => assert_fixture::<CapabilityGrant>(value)?,
11373                "protocol_limit" => assert_fixture::<ProtocolLimit>(value)?,
11374                "document_mutation_condition" => assert_fixture::<DocumentMutationCondition>(value)?,
11375                "audit_event" => assert_fixture::<AuditEvent>(value)?,
11376                "audit_gap" => assert_fixture::<AuditGap>(value)?,
11377                "service_credential_grant" => assert_fixture::<ServiceCredentialGrant>(value)?,
11378                "service_credential_summary" => assert_fixture::<ServiceCredentialSummary>(value)?,
11379                "security_role" => assert_fixture::<SecurityRole>(value)?,
11380                "role_append_scope_change" => assert_fixture::<RoleAppendScopeChange>(value)?,
11381                "role_append_access_preparation" => assert_fixture::<RoleAppendAccessPreparation>(value)?,
11382                "security_action_outcome" => assert_fixture::<SecurityActionOutcome>(value)?,
11383                "maintenance_work_state" => assert_fixture::<MaintenanceWorkState>(value)?,
11384                "maintenance_attempt_state" => assert_fixture::<MaintenanceAttemptState>(value)?,
11385                "maintenance_failure_class" => assert_fixture::<MaintenanceFailureClass>(value)?,
11386                "maintenance_failure_class_count" => assert_fixture::<MaintenanceFailureClassCount>(value)?,
11387                "maintenance_attempt_observation" => assert_fixture::<MaintenanceAttemptObservation>(value)?,
11388                "maintenance_task_scope" => assert_fixture::<MaintenanceTaskScope>(value)?,
11389                "maintenance_task_status" => assert_fixture::<MaintenanceTaskStatus>(value)?,
11390                "maintenance_status_aggregate" => assert_fixture::<MaintenanceStatusAggregate>(value)?,
11391                "runtime_status_detail" => assert_fixture::<RuntimeStatusDetail>(value)?,
11392                "result_cache_status" => assert_fixture::<ResultCacheStatus>(value)?,
11393                "field_promotion_status" => assert_fixture::<FieldPromotionStatus>(value)?,
11394                "overload_shard_status" => assert_fixture::<OverloadShardStatus>(value)?,
11395                "external_key_binding" => assert_fixture::<ExternalKeyBinding>(value)?,
11396                "rollup_measure" => assert_fixture::<RollupMeasure>(value)?,
11397                "aggregate_then_delete_policy" => assert_fixture::<AggregateThenDeletePolicy>(value)?,
11398                "lifecycle_binding_status" => assert_fixture::<LifecycleBindingStatus>(value)?,
11399                "lifecycle_rollup_status" => assert_fixture::<LifecycleRollupStatus>(value)?,
11400                "lifecycle_status" => assert_fixture::<LifecycleStatus>(value)?,
11401                "quota_limit" => assert_fixture::<QuotaLimit>(value)?,
11402                "quota_consumption" => assert_fixture::<QuotaConsumption>(value)?,
11403                "quota_update" => assert_fixture::<QuotaUpdate>(value)?,
11404                "core_binding" => assert_fixture::<CoreBinding>(value)?,
11405                "readiness_observation" => assert_fixture::<ReadinessObservation>(value)?,
11406                "usage_dimension" => assert_fixture::<UsageDimension>(value)?,
11407                "physical_usage_value" => assert_fixture::<PhysicalUsageValue>(value)?,
11408                "core_usage_units" => assert_fixture::<CoreUsageUnits>(value)?,
11409                "core_usage_correction" => assert_fixture::<CoreUsageCorrection>(value)?,
11410                "error_detail" => assert_fixture::<ErrorDetail>(value)?,
11411                "connection_profile" => assert_fixture::<ConnectionProfile>(value)?,
11412                _ => return Err("fixture names an unknown generated type".into()),
11413            }
11414        }
11415        Ok(())
11416    }
11417    #[test]
11418    fn every_aggregation_variant_has_a_canonical_fixture() -> Result<(), Box<dyn std::error::Error>> {
11419        let document: serde_json::Value =
11420            serde_json::from_str(include_str!("../../../tests/p10/lodestone-api-closed-schema.json"))?;
11421        let fixtures = document["aggregation_variants"]
11422            .as_object()
11423            .ok_or("aggregation fixtures are not an object")?;
11424        assert_eq!(fixtures.len(), 16);
11425        for value in fixtures.values() {
11426            assert_fixture::<Aggregation>(value)?;
11427        }
11428        Ok(())
11429    }
11430    #[test]
11431    fn exact_scalar_canonicality_is_closed() {
11432        assert_eq!(
11433            U64 {
11434                value: u64::MAX.to_string()
11435            }
11436            .validate(),
11437            Ok(())
11438        );
11439        assert_eq!(
11440            I64 {
11441                value: i64::MIN.to_string()
11442            }
11443            .validate(),
11444            Ok(())
11445        );
11446        assert_eq!(U64 { value: "01".to_owned() }.validate(), Err(ScalarError::InvalidU64));
11447        assert_eq!(
11448            ExactDecimal {
11449                coefficient: "12345".to_owned(),
11450                scale: 2
11451            }
11452            .validate(),
11453            Ok(())
11454        );
11455        assert_eq!(
11456            ExactDecimal {
11457                coefficient: "123450".to_owned(),
11458                scale: 3
11459            }
11460            .validate(),
11461            Err(ScalarError::InvalidDecimal)
11462        );
11463        assert_eq!(
11464            ExactDecimal {
11465                coefficient: "1".to_owned(),
11466                scale: 1_025
11467            }
11468            .validate(),
11469            Err(ScalarError::InvalidDecimal)
11470        );
11471    }
11472    #[test]
11473    fn scalar_decoders_refuse_numbers_and_noncanonical_strings() {
11474        assert!(serde_json::from_str::<U64>("9007199254740993").is_err());
11475        assert!(serde_json::from_str::<U64>(r#""01""#).is_err());
11476        assert!(serde_json::from_str::<Identity>(r#""0123456789ABCDEF0123456789ABCDEF""#).is_err());
11477        assert!(serde_json::from_str::<Digest>(r#""0123456789abcdef0123456789abcdef""#).is_err());
11478        assert!(serde_json::from_str::<ExactDecimal>(r#"{"coefficient":"123450","scale":3}"#).is_err());
11479        assert!(serde_json::from_str::<ApproximateNumber>(r#""1.0""#).is_err());
11480    }
11481    #[test]
11482    fn semantic_json_rejects_duplicate_fields() {
11483        let value = JsonValue::Object(vec![
11484            JsonField {
11485                name: "x".to_owned(),
11486                value: JsonValue::Null,
11487            },
11488            JsonField {
11489                name: "x".to_owned(),
11490                value: JsonValue::Bool(true),
11491            },
11492        ]);
11493        assert_eq!(validate_semantic_json(&value), Err(JsonError::DuplicateObjectField));
11494    }
11495    #[test]
11496    fn strict_generated_shapes_refuse_malformed_duplicate_unknown_field_and_tag() {
11497        assert!(serde_json::from_str::<DiscoverRequest>(r#"{"unexpected":true}"#).is_err());
11498        assert!(serde_json::from_str::<Cursor>(r#"{"value":"a","value":"b"}"#).is_err());
11499        assert!(serde_json::from_str::<Query>(r#"{"kind":"future_query"}"#).is_err());
11500        assert!(serde_json::from_str::<Cursor>(r#"{"value":1}"#).is_err());
11501    }
11502    #[test]
11503    fn registries_match_the_idl() {
11504        assert_eq!(LODESTONE_API_COMMAND_CONTRACTS.len(), 95);
11505        assert_eq!(LODESTONE_API_COMMAND_SEMANTICS.len(), 95);
11506        assert_eq!(LODESTONE_API_COMMAND_OUTCOMES.len(), 95);
11507        assert_eq!(LODESTONE_API_ERROR_OUTCOMES.len(), 21);
11508        assert_eq!(LODESTONE_API_TYPE_CONTRACTS.len(), 172);
11509        assert_eq!(LODESTONE_API_STREAM_CONTRACTS.len(), 1);
11510        assert_eq!(LODESTONE_API_LIMITS.len(), 44);
11511    }
11512    #[test]
11513    fn mutation_outcome_metadata_matches_submission_boundaries() {
11514        for (command, outcome) in LODESTONE_API_COMMAND_CONTRACTS
11515            .iter()
11516            .zip(LODESTONE_API_COMMAND_OUTCOMES)
11517        {
11518            assert_eq!(command.command, outcome.command);
11519            let submits = !matches!(command.mutation, "read_only" | "read_only_prepare" | "catalog_prepare");
11520            assert_eq!(outcome.possible_submission_states.contains(&"submitted"), submits);
11521            assert_eq!(outcome.possible_submission_states.contains(&"indeterminate"), submits);
11522            assert_eq!(
11523                outcome.cancellation == "per_call_until_submission_then_resolve",
11524                submits
11525            );
11526        }
11527        for command in [
11528            Command::ReserveServiceCredential,
11529            Command::ReserveServiceCredentialRotation,
11530        ] {
11531            let outcome = LODESTONE_API_COMMAND_OUTCOMES
11532                .iter()
11533                .find(|outcome| outcome.command == command);
11534            assert!(
11535                matches!(outcome, Some(value) if value.identity_requirement == "caller_action_id" && value.resolver_command == Some(Command::ResolveServiceCredentialReservation))
11536            );
11537        }
11538    }
11539}