diff --git a/.codegen/cmds-account.go.tmpl b/.codegen/cmds-account.go.tmpl index 7eb09bb2..d3195924 100644 --- a/.codegen/cmds-account.go.tmpl +++ b/.codegen/cmds-account.go.tmpl @@ -18,6 +18,13 @@ var accountCmd = &cobra.Command{ func init() { root.RootCmd.AddCommand(accountCmd) - {{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) }} - accountCmd.AddCommand({{.SnakeName}}.Cmd){{end}}{{end}}{{end}} + + {{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) -}} + accountCmd.AddCommand({{.SnakeName}}.Cmd) + {{end}}{{end}}{{end}} + + // Register commands with groups + {{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) -}} + {{.SnakeName}}.Cmd.GroupID = "{{ .Package.Name }}" + {{end}}{{end}}{{end}} } diff --git a/.codegen/cmds-workspace.go.tmpl b/.codegen/cmds-workspace.go.tmpl index 6775aa6d..d7b3f539 100644 --- a/.codegen/cmds-workspace.go.tmpl +++ b/.codegen/cmds-workspace.go.tmpl @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -package cmd +package workspace {{$excludes := list "command-execution" "statement-execution" "dbfs" "dbsql-permissions"}} @@ -11,6 +11,12 @@ import ( ) func init() { - {{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) }} - root.RootCmd.AddCommand({{.SnakeName}}.Cmd){{end}}{{end}}{{end}} + {{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) -}} + root.RootCmd.AddCommand({{.SnakeName}}.Cmd) + {{end}}{{end}}{{end}} + + // Register commands with groups + {{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) -}} + {{.SnakeName}}.Cmd.GroupID = "{{ .Package.Name }}" + {{end}}{{end}}{{end}} } diff --git a/cmd/account/cmd.go b/cmd/account/cmd.go index 9fc5c366..923948b6 100644 --- a/cmd/account/cmd.go +++ b/cmd/account/cmd.go @@ -64,4 +64,31 @@ func init() { accountCmd.AddCommand(vpc_endpoints.Cmd) accountCmd.AddCommand(workspace_assignment.Cmd) accountCmd.AddCommand(workspaces.Cmd) + + // Register commands with groups + account_access_control.Cmd.GroupID = "iam" + billable_usage.Cmd.GroupID = "billing" + budgets.Cmd.GroupID = "billing" + credentials.Cmd.GroupID = "provisioning" + custom_app_integration.Cmd.GroupID = "oauth2" + encryption_keys.Cmd.GroupID = "provisioning" + account_groups.Cmd.GroupID = "iam" + account_ip_access_lists.Cmd.GroupID = "settings" + log_delivery.Cmd.GroupID = "billing" + account_metastore_assignments.Cmd.GroupID = "catalog" + account_metastores.Cmd.GroupID = "catalog" + networks.Cmd.GroupID = "provisioning" + o_auth_enrollment.Cmd.GroupID = "oauth2" + private_access.Cmd.GroupID = "provisioning" + published_app_integration.Cmd.GroupID = "oauth2" + service_principal_secrets.Cmd.GroupID = "oauth2" + account_service_principals.Cmd.GroupID = "iam" + account_settings.Cmd.GroupID = "settings" + storage.Cmd.GroupID = "provisioning" + account_storage_credentials.Cmd.GroupID = "catalog" + account_users.Cmd.GroupID = "iam" + vpc_endpoints.Cmd.GroupID = "provisioning" + workspace_assignment.Cmd.GroupID = "iam" + workspaces.Cmd.GroupID = "provisioning" + } diff --git a/cmd/account/groups.go b/cmd/account/groups.go new file mode 100644 index 00000000..7c9d70e3 --- /dev/null +++ b/cmd/account/groups.go @@ -0,0 +1,42 @@ +package account + +import "github.com/spf13/cobra" + +// Groups returns an ordered list of command groups. +// The order matches the order used in the Databricks API explorer. +func Groups() []cobra.Group { + return []cobra.Group{ + { + ID: "iam", + Title: "Identity and Access Management", + }, + { + ID: "catalog", + Title: "Unity Catalog", + }, + { + ID: "settings", + Title: "Settings", + }, + { + ID: "provisioning", + Title: "Provisioning", + }, + { + ID: "billing", + Title: "Billing", + }, + { + ID: "oauth2", + Title: "OAuth", + }, + } +} + +func init() { + // Register groups with parent command + groups := Groups() + for i := range groups { + accountCmd.AddGroup(&groups[i]) + } +} diff --git a/cmd/workspace/cmd.go b/cmd/workspace/cmd.go index 4bd0eb09..68ce3ef0 100755 --- a/cmd/workspace/cmd.go +++ b/cmd/workspace/cmd.go @@ -1,6 +1,6 @@ // Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. -package cmd +package workspace import ( "github.com/databricks/cli/cmd/root" @@ -56,7 +56,6 @@ import ( ) func init() { - root.RootCmd.AddCommand(alerts.Cmd) root.RootCmd.AddCommand(catalogs.Cmd) root.RootCmd.AddCommand(cluster_policies.Cmd) @@ -105,4 +104,55 @@ func init() { root.RootCmd.AddCommand(workspace.Cmd) root.RootCmd.AddCommand(workspace_bindings.Cmd) root.RootCmd.AddCommand(workspace_conf.Cmd) + + // Register commands with groups + alerts.Cmd.GroupID = "sql" + catalogs.Cmd.GroupID = "catalog" + cluster_policies.Cmd.GroupID = "compute" + clusters.Cmd.GroupID = "compute" + connections.Cmd.GroupID = "catalog" + current_user.Cmd.GroupID = "iam" + dashboards.Cmd.GroupID = "sql" + data_sources.Cmd.GroupID = "sql" + experiments.Cmd.GroupID = "ml" + external_locations.Cmd.GroupID = "catalog" + functions.Cmd.GroupID = "catalog" + git_credentials.Cmd.GroupID = "workspace" + global_init_scripts.Cmd.GroupID = "compute" + grants.Cmd.GroupID = "catalog" + groups.Cmd.GroupID = "iam" + instance_pools.Cmd.GroupID = "compute" + instance_profiles.Cmd.GroupID = "compute" + ip_access_lists.Cmd.GroupID = "settings" + jobs.Cmd.GroupID = "jobs" + libraries.Cmd.GroupID = "compute" + metastores.Cmd.GroupID = "catalog" + model_registry.Cmd.GroupID = "ml" + permissions.Cmd.GroupID = "iam" + pipelines.Cmd.GroupID = "pipelines" + policy_families.Cmd.GroupID = "compute" + providers.Cmd.GroupID = "sharing" + queries.Cmd.GroupID = "sql" + query_history.Cmd.GroupID = "sql" + recipient_activation.Cmd.GroupID = "sharing" + recipients.Cmd.GroupID = "sharing" + repos.Cmd.GroupID = "workspace" + schemas.Cmd.GroupID = "catalog" + secrets.Cmd.GroupID = "workspace" + service_principals.Cmd.GroupID = "iam" + serving_endpoints.Cmd.GroupID = "serving" + shares.Cmd.GroupID = "sharing" + storage_credentials.Cmd.GroupID = "catalog" + system_schemas.Cmd.GroupID = "catalog" + table_constraints.Cmd.GroupID = "catalog" + tables.Cmd.GroupID = "catalog" + token_management.Cmd.GroupID = "settings" + tokens.Cmd.GroupID = "settings" + users.Cmd.GroupID = "iam" + volumes.Cmd.GroupID = "catalog" + warehouses.Cmd.GroupID = "sql" + workspace.Cmd.GroupID = "workspace" + workspace_bindings.Cmd.GroupID = "catalog" + workspace_conf.Cmd.GroupID = "settings" + } diff --git a/cmd/workspace/groups.go b/cmd/workspace/groups.go new file mode 100644 index 00000000..92b9ae94 --- /dev/null +++ b/cmd/workspace/groups.go @@ -0,0 +1,65 @@ +package workspace + +import ( + "github.com/databricks/cli/cmd/root" + "github.com/spf13/cobra" +) + +// Groups returns an ordered list of command groups. +// The order matches the order used in the Databricks API explorer. +func Groups() []cobra.Group { + return []cobra.Group{ + { + ID: "workspace", + Title: "Databricks Workspace", + }, + { + ID: "compute", + Title: "Compute", + }, + { + ID: "jobs", + Title: "Jobs", + }, + { + ID: "pipelines", + Title: "Delta Live Tables", + }, + { + ID: "ml", + Title: "Machine Learning", + }, + { + ID: "serving", + Title: "Real-time Serving", + }, + { + ID: "iam", + Title: "Identity and Access Management", + }, + { + ID: "sql", + Title: "Databricks SQL", + }, + { + ID: "catalog", + Title: "Unity Catalog", + }, + { + ID: "sharing", + Title: "Delta Sharing", + }, + { + ID: "settings", + Title: "Settings", + }, + } +} + +func init() { + // Register groups with parent command + groups := Groups() + for i := range groups { + root.RootCmd.AddGroup(&groups[i]) + } +}