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)