Skip to main content

orvanta_api/models/
data_migration_run_summary.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/// DataMigrationRunSummary : One row of the run history (#1222). Carries no credentials and no migrated row data -- `data_migration_run` stores neither -- only resource *paths*, which are the same identifiers the connection picker already shows.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DataMigrationRunSummary {
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}
63
64impl DataMigrationRunSummary {
65    /// One row of the run history (#1222). Carries no credentials and no migrated row data -- `data_migration_run` stores neither -- only resource *paths*, which are the same identifiers the connection picker already shows.
66    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) -> DataMigrationRunSummary {
67        DataMigrationRunSummary {
68            id,
69            job_id: None,
70            created_by,
71            created_at,
72            started_at,
73            updated_at,
74            completed_at: None,
75            status,
76            source_resource_path,
77            target_resource_path,
78            source_table,
79            target_table,
80            rows_migrated,
81            batches,
82            conflict_mode,
83            resume_count,
84            has_checkpoint,
85            has_pending_batch,
86            failed,
87        }
88    }
89}
90/// 
91#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
92pub enum Status {
93    #[serde(rename = "running")]
94    Running,
95    #[serde(rename = "completed")]
96    Completed,
97    #[serde(rename = "failed")]
98    Failed,
99    #[serde(rename = "cancelled")]
100    Cancelled,
101}
102
103impl Default for Status {
104    fn default() -> Status {
105        Self::Running
106    }
107}
108