forked from github-starred/komodo
* consolidate deserializers * key value list doc * use string list deserializers for all entity Vec<String> * add additional env files support * plumbing for Action resource * js client readme indentation * regen lock * add action UI * action backend * start on action frontend * update lock * get up to speed * get action started * clean up default action file * seems to work * toml export include action * action works * action works part 2 * bump rust version to 1.82.0 * copy deno bin from bin image * action use local dir * update not having changes doesn't return error * format with prettier * support yaml formatting with prettier * variable no change is Ok
123 lines
2.9 KiB
Rust
123 lines
2.9 KiB
Rust
use anyhow::anyhow;
|
|
use komodo_client::{
|
|
api::write::{UpdateDescription, UpdateDescriptionResponse},
|
|
entities::{
|
|
action::Action, alerter::Alerter, build::Build, builder::Builder,
|
|
deployment::Deployment, procedure::Procedure, repo::Repo,
|
|
server::Server, server_template::ServerTemplate, stack::Stack,
|
|
sync::ResourceSync, user::User, ResourceTarget,
|
|
},
|
|
};
|
|
use resolver_api::Resolve;
|
|
|
|
use crate::{resource, state::State};
|
|
|
|
impl Resolve<UpdateDescription, User> for State {
|
|
#[instrument(name = "UpdateDescription", skip(self, user))]
|
|
async fn resolve(
|
|
&self,
|
|
UpdateDescription {
|
|
target,
|
|
description,
|
|
}: UpdateDescription,
|
|
user: User,
|
|
) -> anyhow::Result<UpdateDescriptionResponse> {
|
|
match target {
|
|
ResourceTarget::System(_) => {
|
|
return Err(anyhow!(
|
|
"cannot update description of System resource target"
|
|
))
|
|
}
|
|
ResourceTarget::Server(id) => {
|
|
resource::update_description::<Server>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::Deployment(id) => {
|
|
resource::update_description::<Deployment>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::Build(id) => {
|
|
resource::update_description::<Build>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::Repo(id) => {
|
|
resource::update_description::<Repo>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::Builder(id) => {
|
|
resource::update_description::<Builder>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::Alerter(id) => {
|
|
resource::update_description::<Alerter>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::Procedure(id) => {
|
|
resource::update_description::<Procedure>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::Action(id) => {
|
|
resource::update_description::<Action>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::ServerTemplate(id) => {
|
|
resource::update_description::<ServerTemplate>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::ResourceSync(id) => {
|
|
resource::update_description::<ResourceSync>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
ResourceTarget::Stack(id) => {
|
|
resource::update_description::<Stack>(
|
|
&id,
|
|
&description,
|
|
&user,
|
|
)
|
|
.await?;
|
|
}
|
|
}
|
|
Ok(UpdateDescriptionResponse {})
|
|
}
|
|
}
|