1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* Orvanta API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 6.5.0
* Contact: contact@orvanta.cloud
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// 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.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DataMigrationRunSummary {
#[serde(rename = "id")]
pub id: i64,
/// 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.
#[serde(rename = "job_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub job_id: Option<Option<String>>,
#[serde(rename = "created_by")]
pub created_by: String,
#[serde(rename = "created_at")]
pub created_at: String,
#[serde(rename = "started_at")]
pub started_at: String,
/// 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.
#[serde(rename = "updated_at")]
pub updated_at: String,
#[serde(rename = "completed_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub completed_at: Option<Option<String>>,
#[serde(rename = "status")]
pub status: Status,
#[serde(rename = "source_resource_path")]
pub source_resource_path: String,
#[serde(rename = "target_resource_path")]
pub target_resource_path: String,
#[serde(rename = "source_table")]
pub source_table: String,
#[serde(rename = "target_table")]
pub target_table: String,
/// Cumulative across attempts when the run was resumed: \"how much of this migration is done\", not \"how much did the last attempt do\".
#[serde(rename = "rows_migrated")]
pub rows_migrated: i64,
#[serde(rename = "batches")]
pub batches: i32,
#[serde(rename = "conflict_mode")]
pub conflict_mode: models::ConflictMode,
/// how many times this run has been picked up again after stopping.
#[serde(rename = "resume_count")]
pub resume_count: i32,
/// 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.
#[serde(rename = "has_checkpoint")]
pub has_checkpoint: bool,
/// A batch was handed to the target and its outcome was never recorded. Resume across it is only safe under `conflict_mode = skip`.
#[serde(rename = "has_pending_batch")]
pub has_pending_batch: bool,
/// 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).
#[serde(rename = "failed")]
pub failed: bool,
}
impl 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.
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 {
DataMigrationRunSummary {
id,
job_id: None,
created_by,
created_at,
started_at,
updated_at,
completed_at: None,
status,
source_resource_path,
target_resource_path,
source_table,
target_table,
rows_migrated,
batches,
conflict_mode,
resume_count,
has_checkpoint,
has_pending_batch,
failed,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "running")]
Running,
#[serde(rename = "completed")]
Completed,
#[serde(rename = "failed")]
Failed,
#[serde(rename = "cancelled")]
Cancelled,
}
impl Default for Status {
fn default() -> Status {
Self::Running
}
}