From 2e557fbfe3b465d51b5c8280ac2cca1e238ccd3c Mon Sep 17 00:00:00 2001 From: Pavel Tiunov Date: Sat, 25 Jul 2026 16:19:23 -0700 Subject: [PATCH] feat(cube-cli): add embed enable-dashboard / disable-dashboard commands (#11356) Wire the new admin-only PATCH /api/v1/embed/dashboard/{publicId} Cube Cloud endpoint into the CLI, so signed embedding can be toggled per dashboard without the console UI: cube embed enable-dashboard cube embed disable-dashboard Non-JSON mode prints a success line; --json echoes the endpoint's { publicId, allowEmbed } response. Claude-Session: https://claude.ai/code/session_01ErSCcNzYLYkCgKEuCe5bVh Co-authored-by: Claude --- rust/cube-cli/README.md | 2 +- rust/cube-cli/src/commands/embed.rs | 40 +++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/rust/cube-cli/README.md b/rust/cube-cli/README.md index 04e822fcbd989..b5cefd81e612f 100644 --- a/rust/cube-cli/README.md +++ b/rust/cube-cli/README.md @@ -145,7 +145,7 @@ Every endpoint of the Console Server public API is covered: | `attributes` | list, create, update, delete, values get/set | | `policies` | get, set-user, set-group | | `tenant` | settings, update | -| `embed` | generate-session, token, dashboard, tenant delete/groups/delete-group | +| `embed` | generate-session, token, dashboard, enable-dashboard, disable-dashboard, tenant delete/groups/delete-group | | `integrations` | list, get, create, update, delete, tokens list/get/revoke/initiate | | `oidc` | list, get, create, update, delete | | `agents` | list, skills | diff --git a/rust/cube-cli/src/commands/embed.rs b/rust/cube-cli/src/commands/embed.rs index ec647f85255f7..339f418eaef34 100644 --- a/rust/cube-cli/src/commands/embed.rs +++ b/rust/cube-cli/src/commands/embed.rs @@ -29,6 +29,16 @@ enum Cmd { /// Public id public_id: String, }, + /// Enable signed embedding for a dashboard (admin only) + EnableDashboard { + /// Public id + public_id: String, + }, + /// Disable signed embedding for a dashboard (admin only) + DisableDashboard { + /// Public id + public_id: String, + }, /// Manage embed tenants Tenant { #[command(subcommand)] @@ -97,6 +107,36 @@ pub async fn command(args: Args, ctx: &Ctx) -> Result<()> { .await?; output::print_json(&res); } + Cmd::EnableDashboard { public_id } => { + let res = api + .patch( + &format!("/api/v1/embed/dashboard/{public_id}"), + Some(&json!({ "allowEmbed": true })), + ) + .await?; + if ctx.json { + output::print_json(&res); + } else { + output::success(&format!( + "Enabled signed embedding for dashboard `{public_id}`" + )); + } + } + Cmd::DisableDashboard { public_id } => { + let res = api + .patch( + &format!("/api/v1/embed/dashboard/{public_id}"), + Some(&json!({ "allowEmbed": false })), + ) + .await?; + if ctx.json { + output::print_json(&res); + } else { + output::success(&format!( + "Disabled signed embedding for dashboard `{public_id}`" + )); + } + } Cmd::Tenant { cmd } => match cmd { TenantCmd::Delete { name } => { api.delete(&format!("/api/v1/embed-tenants/{name}/"), None)