mirror of
https://github.com/moghtech/komodo.git
synced 2026-08-20 16:01:09 +00:00
rename deployment func
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::{anyhow, Context};
|
||||
use collections::{
|
||||
actions_collection, builds_collection, deployments_collection, groups_collection,
|
||||
|
||||
@@ -124,6 +124,15 @@ impl MonitorClient {
|
||||
.context("failed at updating deployment")
|
||||
}
|
||||
|
||||
pub async fn rename_deployment(&self, id: &str, new_name: &str) -> anyhow::Result<Update> {
|
||||
self.patch(
|
||||
&format!("/api/deployment/{id}/rename"),
|
||||
json!({ "new_name": new_name }),
|
||||
)
|
||||
.await
|
||||
.context("failed at renaming deployment")
|
||||
}
|
||||
|
||||
pub async fn reclone_deployment(&self, id: &str) -> anyhow::Result<Update> {
|
||||
self.post::<(), _>(&format!("/api/deployment/{id}/reclone"), None)
|
||||
.await
|
||||
|
||||
@@ -70,6 +70,21 @@ impl PeripheryClient {
|
||||
.context("failed to remove container on periphery")
|
||||
}
|
||||
|
||||
pub async fn container_rename(
|
||||
&self,
|
||||
server: &Server,
|
||||
curr_name: &str,
|
||||
new_name: &str,
|
||||
) -> anyhow::Result<Log> {
|
||||
self.post_json(
|
||||
server,
|
||||
"/container/rename",
|
||||
&json!({ "curr_name": curr_name, "new_name": new_name }),
|
||||
)
|
||||
.await
|
||||
.context("failed to rename container on periphery")
|
||||
}
|
||||
|
||||
pub async fn deploy(&self, server: &Server, deployment: &Deployment) -> anyhow::Result<Log> {
|
||||
self.post_json(server, "/container/deploy", deployment)
|
||||
.await
|
||||
|
||||
@@ -107,6 +107,7 @@ pub struct DeploymentActionState {
|
||||
pub pulling: bool,
|
||||
pub recloning: bool,
|
||||
pub updating: bool,
|
||||
pub renaming: bool,
|
||||
}
|
||||
|
||||
#[typeshare]
|
||||
|
||||
@@ -100,6 +100,7 @@ pub enum Operation {
|
||||
PruneImagesServer,
|
||||
PruneContainersServer,
|
||||
PruneNetworksServer,
|
||||
RenameServer,
|
||||
|
||||
// build
|
||||
CreateBuild,
|
||||
@@ -117,6 +118,7 @@ pub enum Operation {
|
||||
RemoveContainer,
|
||||
PullDeployment,
|
||||
RecloneDeployment,
|
||||
RenameDeployment,
|
||||
|
||||
// procedure
|
||||
CreateProcedure,
|
||||
|
||||
@@ -60,6 +60,7 @@ impl Busy for DeploymentActionState {
|
||||
|| self.starting
|
||||
|| self.stopping
|
||||
|| self.updating
|
||||
|| self.renaming
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user