Skip to main content

orvanta_api/models/
data_migration_run_detail.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.1.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// DataMigrationRunDetail : One run in full. The handler flattens `DataMigrationRunSummary` into this object, so the wire shape is the summary's fields plus `mapping` and `error`.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DataMigrationRunDetail {
17    #[serde(rename = "id")]
18    pub id: i64,
19    /// The queue job this run belongs to, once #1212 moves execution onto the job queue. `null` for a run executed inline in the API request task -- the one case with no SSE stream to watch and no job to cancel.
20    #[serde(rename = "job_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21    pub job_id: Option<Option<String>>,
22    #[serde(rename = "created_by")]
23    pub created_by: String,
24    #[serde(rename = "created_at")]
25    pub created_at: String,
26    #[serde(rename = "started_at")]
27    pub started_at: String,
28    /// Last write of any kind to the row. For a `running` run this is the liveness signal: a stale `updated_at` with no live job is how a crashed run is visible as crashed rather than simply absent.
29    #[serde(rename = "updated_at")]
30    pub updated_at: String,
31    #[serde(rename = "completed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub completed_at: Option<Option<String>>,
33    #[serde(rename = "status")]
34    pub status: Status,
35    #[serde(rename = "source_resource_path")]
36    pub source_resource_path: String,
37    #[serde(rename = "target_resource_path")]
38    pub target_resource_path: String,
39    #[serde(rename = "source_table")]
40    pub source_table: String,
41    #[serde(rename = "target_table")]
42    pub target_table: String,
43    /// Cumulative across attempts when the run was resumed: \"how much of this migration is done\", not \"how much did the last attempt do\".
44    #[serde(rename = "rows_migrated")]
45    pub rows_migrated: i64,
46    #[serde(rename = "batches")]
47    pub batches: i32,
48    #[serde(rename = "conflict_mode")]
49    pub conflict_mode: models::ConflictMode,
50    /// how many times this run has been picked up again after stopping.
51    #[serde(rename = "resume_count")]
52    pub resume_count: i32,
53    /// A batch has committed, so a resume has a checkpoint to start from. The cursor itself is not returned -- it is a list of source primary-key values, i.e. customer data.
54    #[serde(rename = "has_checkpoint")]
55    pub has_checkpoint: bool,
56    /// A batch was handed to the target and its outcome was never recorded. Resume across it is only safe under `conflict_mode = skip`.
57    #[serde(rename = "has_pending_batch")]
58    pub has_pending_batch: bool,
59    /// The run recorded an error. The text is deliberately not here: it is on the per-run route only, so a history listing cannot carry it (see #1406).
60    #[serde(rename = "failed")]
61    pub failed: bool,
62    /// The mapping this run was configured with. Returned because a resume is a fresh `POST /run` and the engine re-validates the mapping rather than trusting stored configuration -- so the caller has to send it back, and the run row is the only place it is kept.
63    #[serde(rename = "mapping")]
64    pub mapping: Vec<models::ColumnMapping>,
65    /// Backend-authored failure text. Render as escaped text, never as HTML: until #1406 is fixed this can still contain target row values.
66    #[serde(rename = "error", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
67    pub error: Option<Option<String>>,
68}
69
70impl DataMigrationRunDetail {
71    /// One run in full. The handler flattens `DataMigrationRunSummary` into this object, so the wire shape is the summary's fields plus `mapping` and `error`.
72    pub fn new(id: i64, created_by: String, created_at: String, started_at: String, updated_at: String, status: Status, source_resource_path: String, target_resource_path: String, source_table: String, target_table: String, rows_migrated: i64, batches: i32, conflict_mode: models::ConflictMode, resume_count: i32, has_checkpoint: bool, has_pending_batch: bool, failed: bool, mapping: Vec<models::ColumnMapping>) -> DataMigrationRunDetail {
73        DataMigrationRunDetail {
74            id,
75            job_id: None,
76            created_by,
77            created_at,
78            started_at,
79            updated_at,
80            completed_at: None,
81            status,
82            source_resource_path,
83            target_resource_path,
84            source_table,
85            target_table,
86            rows_migrated,
87            batches,
88            conflict_mode,
89            resume_count,
90            has_checkpoint,
91            has_pending_batch,
92            failed,
93            mapping,
94            error: None,
95        }
96    }
97}
98/// 
99#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
100pub enum Status {
101    #[serde(rename = "running")]
102    Running,
103    #[serde(rename = "completed")]
104    Completed,
105    #[serde(rename = "failed")]
106    Failed,
107    #[serde(rename = "cancelled")]
108    Cancelled,
109}
110
111impl Default for Status {
112    fn default() -> Status {
113        Self::Running
114    }
115}
116