rename deployment func

This commit is contained in:
mbecker20
2023-03-12 23:36:20 +00:00
parent c787984b77
commit 63444b089c
11 changed files with 238 additions and 12 deletions
-2
View File
@@ -1,5 +1,3 @@
use std::time::Duration;
use anyhow::{anyhow, Context};
use collections::{
actions_collection, builds_collection, deployments_collection, groups_collection,
+9
View File
@@ -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
+15
View File
@@ -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
+1
View File
@@ -107,6 +107,7 @@ pub struct DeploymentActionState {
pub pulling: bool,
pub recloning: bool,
pub updating: bool,
pub renaming: bool,
}
#[typeshare]
+2
View File
@@ -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,
+1
View File
@@ -60,6 +60,7 @@ impl Busy for DeploymentActionState {
|| self.starting
|| self.stopping
|| self.updating
|| self.renaming
}
}