diff options
author | PradeepKiruvale <PRADEEPKIRUVALE@gmail.com> | 2022-01-11 19:11:07 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-11 19:11:07 +0530 |
commit | 141e93c03c8f9d9a9dd7076830445b3fd9cd5154 (patch) | |
tree | 794582fdad064c6021fb02db200f8a7d00260d67 /crates/core/c8y_smartrest | |
parent | 1f41ff7f0909cee0452801f31ab983a581abfd8d (diff) |
[663] agent topics (#731)
* move topics to json_sm crate
* rename json_sm to sm_interface
* format
* rename agent interface
* fix order of crates
* rename crate
* rename topics enum
* refactor downloader code
* move topicerror to error.rs
* trigger wf
* cargo fmt
* address review comments
* separate c8y topics
* add tests
* cargo fmt
* change match cases
* use download from common crate
* update test names
* fix the match issue
* fix the topic matching
* address review comments
* remove mqtt dependancy
* simplify try_from
Co-authored-by: Pradeep Kumar K J <pradeepkumar.kj@sofwareag.com>
Diffstat (limited to 'crates/core/c8y_smartrest')
-rw-r--r-- | crates/core/c8y_smartrest/Cargo.toml | 3 | ||||
-rw-r--r-- | crates/core/c8y_smartrest/src/error.rs | 2 | ||||
-rw-r--r-- | crates/core/c8y_smartrest/src/smartrest_deserializer.rs | 5 | ||||
-rw-r--r-- | crates/core/c8y_smartrest/src/smartrest_serializer.rs | 4 |
4 files changed, 8 insertions, 6 deletions
diff --git a/crates/core/c8y_smartrest/Cargo.toml b/crates/core/c8y_smartrest/Cargo.toml index 3b2b24fe..14dfdff4 100644 --- a/crates/core/c8y_smartrest/Cargo.toml +++ b/crates/core/c8y_smartrest/Cargo.toml @@ -5,11 +5,12 @@ authors = ["thin-edge.io team <info@thin-edge.io>"] edition = "2018" [dependencies] +agent_interface = { path = "../agent_interface" } +download = { path = "../../common/download" } thin_edge_json = { path = "../thin_edge_json" } time = { version = "0.3", features = ["macros"] } chrono = { version = "0.4", features = ["serde"] } csv = "1.1" -json_sm = { path = "../json_sm" } serde = { version = "1.0", features = ["derive"] } thiserror = "1.0" diff --git a/crates/core/c8y_smartrest/src/error.rs b/crates/core/c8y_smartrest/src/error.rs index d7463c1a..ee52f984 100644 --- a/crates/core/c8y_smartrest/src/error.rs +++ b/crates/core/c8y_smartrest/src/error.rs @@ -1,4 +1,4 @@ -use json_sm::SoftwareUpdateResponse; +use agent_interface::SoftwareUpdateResponse; #[derive(thiserror::Error, Debug)] pub enum SmartRestSerializerError { diff --git a/crates/core/c8y_smartrest/src/smartrest_deserializer.rs b/crates/core/c8y_smartrest/src/smartrest_deserializer.rs index 49638301..f6809569 100644 --- a/crates/core/c8y_smartrest/src/smartrest_deserializer.rs +++ b/crates/core/c8y_smartrest/src/smartrest_deserializer.rs @@ -1,7 +1,8 @@ use crate::error::SmartRestDeserializerError; +use agent_interface::{SoftwareModule, SoftwareModuleUpdate, SoftwareUpdateRequest}; use chrono::{DateTime, FixedOffset}; use csv::ReaderBuilder; -use json_sm::{DownloadInfo, SoftwareModule, SoftwareModuleUpdate, SoftwareUpdateRequest}; +use download::DownloadInfo; use serde::de::Error; use serde::{Deserialize, Deserializer, Serialize}; use std::convert::{TryFrom, TryInto}; @@ -290,8 +291,8 @@ impl SmartRestJwtResponse { #[cfg(test)] mod tests { use super::*; + use agent_interface::*; use assert_json_diff::*; - use json_sm::*; use serde_json::json; use test_case::test_case; diff --git a/crates/core/c8y_smartrest/src/smartrest_serializer.rs b/crates/core/c8y_smartrest/src/smartrest_serializer.rs index e7934d7f..7f548d74 100644 --- a/crates/core/c8y_smartrest/src/smartrest_serializer.rs +++ b/crates/core/c8y_smartrest/src/smartrest_serializer.rs @@ -1,6 +1,6 @@ use crate::error::SmartRestSerializerError; +use agent_interface::{OperationStatus, SoftwareUpdateResponse}; use csv::{QuoteStyle, WriterBuilder}; -use json_sm::{OperationStatus, SoftwareUpdateResponse}; use serde::{Deserialize, Serialize, Serializer}; type SmartRest = String; @@ -208,7 +208,7 @@ fn serialize_smartrest<S: Serialize>(record: S) -> Result<String, SmartRestSeria #[cfg(test)] mod tests { use super::*; - use json_sm::*; + use agent_interface::*; #[test] fn serialize_smartrest_supported_operations() { |