From b5179e443bbfc9fab32a6d93a3d888643d65d35e Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Fri, 30 Jun 2023 05:41:32 +0000 Subject: [PATCH] setup some more deployment reqs --- core/src/requests/api/deployment.rs | 35 ++++++++++++++++++++- lib/types/src/requests/api/deployment.rs | 39 ++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/core/src/requests/api/deployment.rs b/core/src/requests/api/deployment.rs index 26231172c..f686a8dfc 100644 --- a/core/src/requests/api/deployment.rs +++ b/core/src/requests/api/deployment.rs @@ -3,7 +3,7 @@ use async_trait::async_trait; use monitor_types::{ all_logs_success, entities::{ - deployment::{Deployment, DeploymentImage, DockerContainerState}, + deployment::{Deployment, DeploymentImage, DockerContainerState, DockerContainerStats}, server::ServerStatus, update::{Log, Update, UpdateStatus, UpdateTarget}, Operation, PermissionLevel, Version, @@ -60,6 +60,39 @@ impl Resolve for State { } } +#[async_trait] +impl Resolve for State { + async fn resolve( + &self, + GetLog { deployment_id }: GetLog, + user: RequestUser, + ) -> anyhow::Result { + todo!() + } +} + +#[async_trait] +impl Resolve for State { + async fn resolve( + &self, + GetDeployedVersion { deployment_id }: GetDeployedVersion, + user: RequestUser, + ) -> anyhow::Result { + todo!() + } +} + +#[async_trait] +impl Resolve for State { + async fn resolve( + &self, + GetDeploymentStats { id }: GetDeploymentStats, + user: RequestUser, + ) -> anyhow::Result { + todo!() + } +} + #[async_trait] impl Resolve for State { async fn resolve( diff --git a/lib/types/src/requests/api/deployment.rs b/lib/types/src/requests/api/deployment.rs index 3a09def80..e8266e794 100644 --- a/lib/types/src/requests/api/deployment.rs +++ b/lib/types/src/requests/api/deployment.rs @@ -6,8 +6,8 @@ use typeshare::typeshare; use crate::{ entities::{ - deployment::{Deployment, PartialDeploymentConfig, TerminationSignal}, - update::Update, + deployment::{Deployment, PartialDeploymentConfig, TerminationSignal, DockerContainerStats}, + update::{Update, Log}, }, MongoDocument, }; @@ -30,6 +30,39 @@ pub struct ListDeployments { // +#[typeshare] +#[derive(Serialize, Deserialize, Debug, Clone, Request)] +#[response(Log)] +pub struct GetLog { + pub deployment_id: String, +} + +// + +#[typeshare] +#[derive(Serialize, Deserialize, Debug, Clone, Request)] +#[response(GetDeployedVersionResponse)] +pub struct GetDeployedVersion { + pub deployment_id: String, +} + +#[typeshare] +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct GetDeployedVersionResponse { + pub version: String, +} + +// + +#[typeshare] +#[derive(Serialize, Deserialize, Debug, Clone, Request)] +#[response(DockerContainerStats)] +pub struct GetDeploymentStats { + pub id: String, +} + +// + #[typeshare] #[derive(Serialize, Deserialize, Debug, Clone, Request)] #[response(Deployment)] @@ -77,6 +110,8 @@ pub struct RenameDeployment { pub name: String, } +// + #[typeshare] #[derive(Serialize, Deserialize, Debug, Clone, Request)] #[response(Update)]