setup some more deployment reqs

This commit is contained in:
mbecker20
2023-06-30 05:41:32 +00:00
parent fe6c371a9f
commit b5179e443b
2 changed files with 71 additions and 3 deletions

View File

@@ -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<ListDeployments, RequestUser> for State {
}
}
#[async_trait]
impl Resolve<GetLog, RequestUser> for State {
async fn resolve(
&self,
GetLog { deployment_id }: GetLog,
user: RequestUser,
) -> anyhow::Result<Log> {
todo!()
}
}
#[async_trait]
impl Resolve<GetDeployedVersion, RequestUser> for State {
async fn resolve(
&self,
GetDeployedVersion { deployment_id }: GetDeployedVersion,
user: RequestUser,
) -> anyhow::Result<GetDeployedVersionResponse> {
todo!()
}
}
#[async_trait]
impl Resolve<GetDeploymentStats, RequestUser> for State {
async fn resolve(
&self,
GetDeploymentStats { id }: GetDeploymentStats,
user: RequestUser,
) -> anyhow::Result<DockerContainerStats> {
todo!()
}
}
#[async_trait]
impl Resolve<CreateDeployment, RequestUser> for State {
async fn resolve(

View File

@@ -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)]