diff --git a/Cargo.lock b/Cargo.lock index 41413d7499..67548344bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2673,7 +2673,7 @@ dependencies = [ [[package]] name = "dozer-cloud-client" version = "0.1.0" -source = "git+ssh://git@github.com/getdozer/dozer-cloud.git?rev=refs/pull/628/head#378abd949f4f62b42fd94ad795637a45a6f19349" +source = "git+ssh://git@github.com/getdozer/dozer-cloud.git?rev=refs/pull/628/head#6086abbb99526cf444f4542b17d12712b271cff5" dependencies = [ "camino", "chrono", @@ -2907,6 +2907,7 @@ dependencies = [ "bincode", "bytes", "chrono", + "dozer-cloud-client", "geo", "indexmap 1.9.2", "indicatif", @@ -2932,7 +2933,7 @@ dependencies = [ [[package]] name = "dozer-types" version = "0.1.39" -source = "git+ssh://git@github.com/getdozer/dozer-cloud.git?rev=refs/pull/628/head#378abd949f4f62b42fd94ad795637a45a6f19349" +source = "git+ssh://git@github.com/getdozer/dozer-cloud.git?rev=refs/pull/628/head#6086abbb99526cf444f4542b17d12712b271cff5" dependencies = [ "ahash 0.8.3", "arrow", @@ -8609,7 +8610,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "rand 0.8.5", + "rand 0.4.6", "static_assertions", ] diff --git a/dozer-cli/Cargo.toml b/dozer-cli/Cargo.toml index 16a4e5754e..675335462e 100644 --- a/dozer-cli/Cargo.toml +++ b/dozer-cli/Cargo.toml @@ -11,7 +11,7 @@ name = "dozer" [dependencies] -dozer-cloud-client = { git = "ssh://git@github.com/getdozer/dozer-cloud.git", rev = "refs/pull/628/head", optional = true } +dozer-cloud-client = { git = "ssh://git@github.com/getdozer/dozer-cloud.git", rev = "c0ff1cb" } dozer-api = { path = "../dozer-api" } dozer-ingestion = { path = "../dozer-ingestion" } dozer-core = { path = "../dozer-core" } @@ -59,5 +59,5 @@ path = "src/main.rs" snowflake = ["dozer-ingestion/snowflake"] mongodb = ["dozer-ingestion/mongodb"] onnx = ["dozer-sql/onnx"] -cloud = ["dozer-cloud-client"] +cloud = [] tokio-console = ["dozer-tracing/tokio-console"] diff --git a/dozer-cli/src/main.rs b/dozer-cli/src/main.rs index 7bd4969117..996fd8cb66 100644 --- a/dozer-cli/src/main.rs +++ b/dozer-cli/src/main.rs @@ -191,13 +191,8 @@ fn run() -> Result<(), OrchestrationError> { #[cfg(feature = "cloud")] Commands::Cloud(cloud) => { render_logo(); - run_cloud( - dozer.runtime.clone(), - dozer.config.clone(), - cloud, - cli.config_paths, - ) - .map_err(OrchestrationError::CloudError) + run_cloud(dozer.runtime.clone(), cloud, cli.config_paths) + .map_err(OrchestrationError::CloudError) } Commands::Init => { panic!("This should not happen as it is handled in parse_and_generate"); @@ -275,18 +270,14 @@ fn init_orchestrator(cli: &Cli) -> Result { } }) } -#[cfg(feature = "cloud")] + fn display_error(e: &OrchestrationError) { if let OrchestrationError::CloudError(e) = &e { - display_cloud_error(e); + dozer_cloud_client::errors::display_cloud_error(e); } else { error!("{}", e); } } -fn display_error(e: &OrchestrationError) { - error!("{}", e); -} - struct Telemetry(); impl Telemetry { diff --git a/dozer-types/Cargo.toml b/dozer-types/Cargo.toml index 5a8af1020d..5cdadc8f0a 100644 --- a/dozer-types/Cargo.toml +++ b/dozer-types/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +dozer-cloud-client = { git = "ssh://git@github.com/getdozer/dozer-cloud.git", rev = "c0ff1cb" } chrono = { version = "0.4.23", features = ["serde"] } serde = { version = "1.0.152", features = ["derive", "rc"] } serde_json = { version = "1.0.93", features = ["std"] } diff --git a/dozer-types/src/lib.rs b/dozer-types/src/lib.rs index 39a6bf18b4..f00624e8ab 100644 --- a/dozer-types/src/lib.rs +++ b/dozer-types/src/lib.rs @@ -47,6 +47,8 @@ pub use serde_yaml; pub use thiserror; pub use tracing; +pub use dozer_cloud_client; + // Types required by API and other clients pub mod api { use serde::{Deserialize, Serialize}; diff --git a/dozer-types/src/models/cloud.rs b/dozer-types/src/models/cloud.rs deleted file mode 100644 index 01f048e19f..0000000000 --- a/dozer-types/src/models/cloud.rs +++ /dev/null @@ -1,62 +0,0 @@ -use serde::{Deserialize, Serialize}; - -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, prost::Message)] -pub struct Cloud { - #[prost(oneof = "UpdateCurrentVersionStrategy", tags = "1,2")] - #[serde(skip_serializing_if = "Option::is_none")] - pub update_current_version_strategy: Option, - #[prost(optional, string, tag = "3")] - #[serde(skip_serializing_if = "Option::is_none")] - pub app_id: Option, - #[prost(optional, string, tag = "4")] - #[serde(skip_serializing_if = "Option::is_none")] - pub profile: Option, - #[prost(message, optional, tag = "5")] - #[serde(skip_serializing_if = "Option::is_none")] - pub app: Option, - #[prost(message, optional, tag = "6")] - #[serde(skip_serializing_if = "Option::is_none")] - pub api: Option, -} - -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, prost::Message)] -pub struct AppInstance { - #[prost(optional, string, tag = "1")] - #[serde(skip_serializing_if = "Option::is_none")] - pub instance_type: Option, -} - -#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, prost::Message)] -pub struct ApiInstance { - #[prost(optional, uint32, tag = "1")] - #[serde( - default = "default_num_api_instances", - skip_serializing_if = "Option::is_none" - )] - pub instances_count: Option, - #[prost(optional, string, tag = "2")] - #[serde(skip_serializing_if = "Option::is_none")] - pub instance_type: Option, - #[prost(optional, uint32, tag = "3")] - /// The size of the volume in GB - #[serde(skip_serializing_if = "Option::is_none")] - pub volume_size: Option, -} - -#[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize, prost::Oneof)] -pub enum UpdateCurrentVersionStrategy { - #[prost(message, tag = "1")] - OnCreate(()), - #[prost(message, tag = "2")] - Manual(()), -} - -impl Default for UpdateCurrentVersionStrategy { - fn default() -> Self { - UpdateCurrentVersionStrategy::OnCreate(()) - } -} - -fn default_num_api_instances() -> Option { - Some(2) -} diff --git a/dozer-types/src/models/config.rs b/dozer-types/src/models/config.rs index 719967be98..904d0571ae 100644 --- a/dozer-types/src/models/config.rs +++ b/dozer-types/src/models/config.rs @@ -1,7 +1,7 @@ use std::path::Path; use super::{ - api_config::ApiConfig, api_endpoint::ApiEndpoint, app_config::AppConfig, cloud::Cloud, + api_config::ApiConfig, api_endpoint::ApiEndpoint, app_config::AppConfig, connection::Connection, flags::Flags, source::Source, telemetry::TelemetryConfig, }; use crate::constants::DEFAULT_HOME_DIR; @@ -75,10 +75,11 @@ pub struct Config { /// Instrument using Dozer #[serde(skip_serializing_if = "Option::is_none")] pub telemetry: Option, - #[prost(message, optional, tag = "14")] + /// Dozer Cloud specific configuration + #[prost(message, optional, tag = "14")] #[serde(skip_serializing_if = "Option::is_none")] - pub cloud: Option, + pub cloud: Option, #[prost(message, repeated, tag = "15")] /// UDF specific configuration (eg. !Onnx) diff --git a/dozer-types/src/models/mod.rs b/dozer-types/src/models/mod.rs index 234d592741..e93413acca 100644 --- a/dozer-types/src/models/mod.rs +++ b/dozer-types/src/models/mod.rs @@ -2,7 +2,6 @@ pub mod api_config; pub mod api_endpoint; pub mod api_security; pub mod app_config; -pub mod cloud; pub mod config; pub mod connection; pub mod flags;