From 0187674e7751138a43bc924000388091d712e322 Mon Sep 17 00:00:00 2001 From: Jessie Chatham Spencer Date: Thu, 30 Mar 2023 14:33:11 +0200 Subject: [PATCH] Remove proto crate issue: #121 The protobuf related functionality has been moved to the shared ame library and the proto crate was no longer in use. Therefore this commit removes it. --- proto/Cargo.toml | 19 ---------- proto/build.rs | 11 ------ proto/src/lib.rs | 90 ------------------------------------------------ 3 files changed, 120 deletions(-) delete mode 100644 proto/Cargo.toml delete mode 100644 proto/build.rs delete mode 100644 proto/src/lib.rs diff --git a/proto/Cargo.toml b/proto/Cargo.toml deleted file mode 100644 index d774d467..00000000 --- a/proto/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "proto" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -tonic = "0.8.3" -schemars = "0.8.11" -serde = "1.0" -serde_json = "1.0.91" -prost = "0.11.6" - -[build-dependencies] -tonic-build = "0.8.4" -prost-build = "0.11.2" -serde = "1.0" - diff --git a/proto/build.rs b/proto/build.rs deleted file mode 100644 index 73e05785..00000000 --- a/proto/build.rs +++ /dev/null @@ -1,11 +0,0 @@ -fn main() { - // TODO: evaluate state of optionals in protobuf. - tonic_build::configure() - .type_attribute( - ".", - "#[derive(serde::Serialize, serde::Deserialize, schemars::JsonSchema)]", - ) - .protoc_arg("--experimental_allow_proto3_optional") - .compile(&["./ame.proto"], &["."]) - .unwrap_or_else(|e| panic!("Failed to compile protos {e:?}")); -} diff --git a/proto/src/lib.rs b/proto/src/lib.rs deleted file mode 100644 index 76ef4d15..00000000 --- a/proto/src/lib.rs +++ /dev/null @@ -1,90 +0,0 @@ -mod grpc { - #![allow(clippy::all)] - - tonic::include_proto!("ame.v1"); -} - -pub use grpc::*; -pub use grpc::{LogEntry, TaskIdentifier, TaskLogRequest}; - -impl From<&str> for TaskIdentifier { - fn from(name: &str) -> Self { - Self { - name: name.to_string(), - } - } -} - -impl From for AmeSecretId { - fn from(key: String) -> Self { - AmeSecretId { key } - } -} - -impl From for ProjectSourceId { - fn from(name: String) -> Self { - Self { name } - } -} - -impl TaskLogRequest { - pub fn stream_from_beginning(task_name: &str, watch: bool) -> Self { - Self { - taskid: Some(TaskIdentifier::from(task_name)), - start_from: Some(1), - watch: Some(watch), - } - } -} - -impl CreateTaskRequest { - pub fn new(task_name: &str, task_template: TaskTemplate) -> Self { - Self { - id: Some(TaskIdentifier::from(task_name)), - template: Some(task_template), - } - } -} - -impl TaskProjectDirectoryStructure { - pub fn new(task_name: &str, project_id: &str, paths: Vec) -> Self { - Self { - taskid: Some(TaskIdentifier::from(task_name)), - projectid: project_id.to_string(), - paths, - } - } -} - -impl ProjectSourceCfg { - pub fn git_repository(&self) -> Option<&str> { - if let Some(GitProjectSource { ref repository, .. }) = self.git { - Some(repository) - } else { - None - } - } -} - -/* - -static AME_SECRET_STORE: &str = "ame"; -impl From for Secret { - fn from(ame_secret: AmeSecret) -> Self { - let mut secret_map = BTreeMap::new(); - secret_map.insert("secret".to_string(), ame_secret.value); - - let mut labels = BTreeMap::new(); - labels.insert("SECRET_STORE".to_string(), AME_SECRET_STORE.to_string()); - - let mut secret = Secret { - metadata: ObjectMeta { - name: Some(key.to_string()), - labels: Some(labels), - ..ObjectMeta::default() - }, - string_data: Some(secret_map), - ..Secret::default() - }; - } -}*/