-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
72 lines (66 loc) · 2.16 KB
/
Copy pathmod.rs
File metadata and controls
72 lines (66 loc) · 2.16 KB
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
use crate::analyser::core::Analyser;
use crate::command::push::data_type_client_impl::SagittariusDataTypeServiceClient;
use crate::command::push::flow_type_client_impl::SagittariusFlowTypeServiceClient;
use crate::command::push::function_client_impl::SagittariusRuntimeFunctionServiceClient;
mod auth;
mod data_type_client_impl;
mod flow_type_client_impl;
mod function_client_impl;
pub async fn push(
token: String,
url: String,
version_option: Option<String>,
path: Option<String>,
) {
let dir_path = path.unwrap_or_else(|| "./definitions".to_string());
let version = match version_option {
None => String::from("0.0.0"),
Some(v) => v,
};
let mut analyzer = Analyser::new(dir_path.as_str());
let mut data_type_client =
SagittariusDataTypeServiceClient::new(url.clone(), token.clone()).await;
let mut flow_type_client =
SagittariusFlowTypeServiceClient::new(url.clone(), token.clone()).await;
let mut function_client = SagittariusRuntimeFunctionServiceClient::new(url, token).await;
analyzer.report(false, true);
data_type_client
.update_data_types(
analyzer
.data_types
.iter()
.map(|d| {
let mut def = d.definition_data_type.clone();
def.version = version.clone();
return def;
})
.collect(),
)
.await;
flow_type_client
.update_flow_types(
analyzer
.flow_types
.iter()
.map(|d| {
let mut def = d.flow_type.clone();
def.version = version.clone();
return def;
})
.collect(),
)
.await;
function_client
.update_runtime_function_definitions(
analyzer
.functions
.iter()
.map(|d| {
let mut def = d.function.clone();
def.version = version.clone();
return def;
})
.collect(),
)
.await;
}