forked from github-starred/komodo
derive EnumVariant enum
This commit is contained in:
@@ -21,6 +21,7 @@ async_timing_util.workspace = true
|
||||
resolver_api.workspace = true
|
||||
derive_builder.workspace = true
|
||||
bollard.workspace = true
|
||||
derive_variants.workspace = true
|
||||
partial_derive2.workspace = true
|
||||
make_option.workspace = true
|
||||
mungos.workspace = true
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
use bson::{doc, serde_helpers::hex_string_as_object_id};
|
||||
use derive_builder::Builder;
|
||||
use derive_variants::EnumVariants;
|
||||
use mungos::MungosIndexed;
|
||||
use partial_derive2::Partial;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum_macros::{Display, EnumString};
|
||||
use typeshare::typeshare;
|
||||
|
||||
use crate::{i64_is_zero, I64, MongoId};
|
||||
use crate::{i64_is_zero, MongoId, I64};
|
||||
|
||||
use super::{EnvironmentVar, PermissionsMap, SystemCommand, Version};
|
||||
|
||||
@@ -155,7 +157,8 @@ pub struct BuildActionState {
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed, EnumVariants)]
|
||||
#[variant_derive(Serialize, Deserialize, Debug, Clone, Copy, Display, EnumString)]
|
||||
#[serde(tag = "type", content = "params")]
|
||||
pub enum BuildBuilderConfig {
|
||||
Server { server_id: String },
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
use bson::serde_helpers::hex_string_as_object_id;
|
||||
use derive_builder::Builder;
|
||||
use derive_variants::EnumVariants;
|
||||
use mungos::MungosIndexed;
|
||||
use partial_derive2::Partial;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum_macros::{Display, EnumString};
|
||||
use typeshare::typeshare;
|
||||
|
||||
use crate::{i64_is_zero, I64, MongoId};
|
||||
use crate::{i64_is_zero, MongoId, I64};
|
||||
|
||||
use super::PermissionsMap;
|
||||
|
||||
@@ -44,14 +46,16 @@ pub struct Builder {
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed, EnumVariants)]
|
||||
#[variant_derive(Serialize, Deserialize, Debug, Clone, Copy, Display, EnumString)]
|
||||
#[serde(tag = "type", content = "params")]
|
||||
pub enum BuilderConfig {
|
||||
AwsBuilder(AwsBuilder),
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed, EnumVariants)]
|
||||
#[variant_derive(Serialize, Deserialize, Debug, Clone, Copy, Display, EnumString)]
|
||||
#[serde(tag = "type", content = "params")]
|
||||
pub enum PartialBuilderConfig {
|
||||
AwsBuilder(PartialAwsBuilder),
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
use bson::{doc, serde_helpers::hex_string_as_object_id};
|
||||
use derive_builder::Builder;
|
||||
use derive_variants::EnumVariants;
|
||||
use mungos::MungosIndexed;
|
||||
use partial_derive2::Partial;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum_macros::{Display, EnumString};
|
||||
use typeshare::typeshare;
|
||||
|
||||
use crate::{i64_is_zero, I64, MongoId};
|
||||
use crate::{i64_is_zero, MongoId, I64};
|
||||
|
||||
use super::{EnvironmentVar, PermissionsMap, Version};
|
||||
|
||||
@@ -161,7 +162,8 @@ impl From<PartialDeploymentConfig> for DeploymentConfig {
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, MungosIndexed, EnumVariants)]
|
||||
#[variant_derive(Serialize, Deserialize, Debug, Clone, Copy, Display, EnumString)]
|
||||
#[serde(tag = "type", content = "params")]
|
||||
pub enum DeploymentImage {
|
||||
Image { image: String },
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::{collections::HashMap, path::PathBuf};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum_macros::{Display, EnumString};
|
||||
use typeshare::typeshare;
|
||||
|
||||
use crate::{entities::Timelength, I64};
|
||||
@@ -122,7 +123,7 @@ pub struct SystemComponent {
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, Display, EnumString)]
|
||||
pub enum StatsState {
|
||||
#[default]
|
||||
Ok,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use async_timing_util::unix_timestamp_ms;
|
||||
use bson::serde_helpers::hex_string_as_object_id;
|
||||
use derive_variants::EnumVariants;
|
||||
use mungos::MungosIndexed;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum_macros::{Display, EnumString};
|
||||
@@ -7,7 +8,7 @@ use typeshare::typeshare;
|
||||
|
||||
use crate::{entities::Operation, monitor_timestamp, I64, MongoId};
|
||||
|
||||
use super::Version;
|
||||
use super::{Version, build::Build, deployment::Deployment, server::Server, repo::Repo, builder::Builder};
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, MungosIndexed)]
|
||||
@@ -86,7 +87,8 @@ impl Log {
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, MungosIndexed)]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, MungosIndexed, EnumVariants)]
|
||||
#[variant_derive(Serialize, Deserialize, Debug, Clone, Copy, Display, EnumString)]
|
||||
#[serde(tag = "type", content = "id")]
|
||||
pub enum ResourceTarget {
|
||||
#[default]
|
||||
@@ -96,70 +98,37 @@ pub enum ResourceTarget {
|
||||
Deployment(String),
|
||||
Server(String),
|
||||
Repo(String),
|
||||
// Procedure(String),
|
||||
// Group(String),
|
||||
// Command(String),
|
||||
}
|
||||
|
||||
// impl From<&Build> for UpdateTarget {
|
||||
// fn from(build: &Build) -> Self {
|
||||
// Self::Build(build.id.clone())
|
||||
// }
|
||||
// }
|
||||
impl From<&Build> for ResourceTarget {
|
||||
fn from(build: &Build) -> Self {
|
||||
Self::Build(build.id.clone())
|
||||
}
|
||||
}
|
||||
|
||||
// impl From<&Build> for Option<UpdateTarget> {
|
||||
// fn from(build: &Build) -> Self {
|
||||
// Some(UpdateTarget::Build(build.id.clone()))
|
||||
// }
|
||||
// }
|
||||
impl From<&Deployment> for ResourceTarget {
|
||||
fn from(deployment: &Deployment) -> Self {
|
||||
Self::Deployment(deployment.id.clone())
|
||||
}
|
||||
}
|
||||
|
||||
// impl From<&Deployment> for UpdateTarget {
|
||||
// fn from(deployment: &Deployment) -> Self {
|
||||
// Self::Deployment(deployment.id.clone())
|
||||
// }
|
||||
// }
|
||||
impl From<&Server> for ResourceTarget {
|
||||
fn from(server: &Server) -> Self {
|
||||
Self::Server(server.id.clone())
|
||||
}
|
||||
}
|
||||
|
||||
// impl From<&Deployment> for Option<UpdateTarget> {
|
||||
// fn from(deployment: &Deployment) -> Self {
|
||||
// Some(UpdateTarget::Deployment(deployment.id.clone()))
|
||||
// }
|
||||
// }
|
||||
impl From<&Repo> for ResourceTarget {
|
||||
fn from(repo: &Repo) -> Self {
|
||||
Self::Repo(repo.id.clone())
|
||||
}
|
||||
}
|
||||
|
||||
// impl From<&Server> for UpdateTarget {
|
||||
// fn from(server: &Server) -> Self {
|
||||
// Self::Server(server.id.clone())
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl From<&Server> for Option<UpdateTarget> {
|
||||
// fn from(server: &Server) -> Self {
|
||||
// Some(UpdateTarget::Server(server.id.clone()))
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl From<&Procedure> for UpdateTarget {
|
||||
// fn from(procedure: &Procedure) -> Self {
|
||||
// Self::Procedure(procedure.id.clone())
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl From<&Procedure> for Option<UpdateTarget> {
|
||||
// fn from(procedure: &Procedure) -> Self {
|
||||
// Some(UpdateTarget::Procedure(procedure.id.clone()))
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl From<&Group> for UpdateTarget {
|
||||
// fn from(group: &Group) -> Self {
|
||||
// Self::Group(group.id.clone())
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl From<&Group> for Option<UpdateTarget> {
|
||||
// fn from(group: &Group) -> Self {
|
||||
// Some(UpdateTarget::Group(group.id.clone()))
|
||||
// }
|
||||
// }
|
||||
impl From<&Builder> for ResourceTarget {
|
||||
fn from(builder: &Builder) -> Self {
|
||||
Self::Builder(builder.id.clone())
|
||||
}
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
#[derive(
|
||||
|
||||
Reference in New Issue
Block a user