Skip to content

Commit 8584e59

Browse files
committed
misc: show route when deploying
Signed-off-by: Anthony Griffon <[email protected]>
1 parent 847e4cd commit 8584e59

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

cli/src/application/deploy/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl SwarmdCommand for DeployArg {
7979

8080
// Deploy worker with config
8181
let now = Instant::now();
82-
let _ = config
82+
let route_opt = config
8383
.deploy_worker(env, &auth, &project_id, worker_id_uploaded)
8484
.await?;
8585

@@ -92,6 +92,16 @@ impl SwarmdCommand for DeployArg {
9292
style(format!("{elapsed:?}")).bold().green()
9393
))?;
9494

95+
if let Some(route) = route_opt {
96+
env.println("")?;
97+
env.println(format!(
98+
"{} {}Worker deployed at {}",
99+
style("").bold().dim(),
100+
DELIVERY,
101+
style(route).bold().magenta(),
102+
))?;
103+
}
104+
95105
Ok(())
96106
}
97107
}

cli/src/domain/worker_config/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ impl WorkerConfig {
188188
auth: &AuthContext,
189189
project_id: &str,
190190
deployed_worker_id: String,
191-
) -> anyhow::Result<String> {
191+
) -> anyhow::Result<Option<String>> {
192192
let org_id = self.organization_id(auth);
193193

194194
let swarmd_client = env.swarmd_client()?;
195195

196-
let PublishWorkerResponse { id } =
196+
let PublishWorkerResponse { id: _, route } =
197197
swarmd_generated::apis::project_api::organization_id_project_project_id_publish_put(
198198
swarmd_client.as_ref(),
199199
&org_id,
@@ -205,6 +205,6 @@ impl WorkerConfig {
205205
.await?;
206206

207207
// Launch publish
208-
Ok(id)
208+
Ok(route)
209209
}
210210
}

lib/swarmd-generated/src/models/publish_worker_response.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
pub struct PublishWorkerResponse {
1313
#[serde(rename = "id")]
1414
pub id: String,
15+
#[serde(rename = "route")]
16+
pub route: Option<String>,
1517
}
1618

1719
impl PublishWorkerResponse {
18-
pub fn new(id: String) -> PublishWorkerResponse {
19-
PublishWorkerResponse { id }
20+
pub fn new(id: String, route: Option<String>) -> PublishWorkerResponse {
21+
PublishWorkerResponse { id, route }
2022
}
2123
}

0 commit comments

Comments
 (0)