Move `WorkspaceClient` to `libs/command` (#2444)

## Changes
Move the WorkspaceClient reader and setter from the root package to
`libs/command`.

## Why
This allows us to read the workspace client set in the context in all
CLI packages. This was not possible before because using
`root.WorkspaceClient` would often result in an import cycle.

This would also allow us to standardise reads of the workspace client to
be from the context in bundle commands. Today those are read from the
bundle object tree instead.

This is a natural followup to
https://github.com/databricks/cli/pull/2440.

## Tests
Existing tests and one new unit test.

NO_CHANGELOG=true
This commit is contained in:
shreyas-goenka 2025-03-07 22:17:19 +05:30 committed by GitHub
parent 0225c77b68
commit af3914db61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
123 changed files with 829 additions and 669 deletions

View File

@ -4,6 +4,7 @@ package {{(.TrimPrefix "account").SnakeName}}
import ( import (
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/cli/libs/diag" "github.com/databricks/cli/libs/diag"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
@ -240,7 +241,7 @@ func new{{.PascalName}}() *cobra.Command {
cmd.PreRunE = root.Must{{if .Service.IsAccounts}}Account{{else}}Workspace{{end}}Client cmd.PreRunE = root.Must{{if .Service.IsAccounts}}Account{{else}}Workspace{{end}}Client
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
{{if .Service.IsAccounts}}a := root.AccountClient(ctx){{else}}w := root.WorkspaceClient(ctx){{end}} {{if .Service.IsAccounts}}a := root.AccountClient(ctx){{else}}w := command.WorkspaceClient(ctx){{end}}
{{- if .Request }} {{- if .Request }}
{{ if $canUseJson }} {{ if $canUseJson }}
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {

View File

@ -110,7 +110,7 @@ func getAuthStatus(cmd *cobra.Command, args []string, showSensitive bool, fn try
return &status, nil return &status, nil
} }
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
me, err := w.CurrentUser.Me(ctx) me, err := w.CurrentUser.Me(ctx)
if err != nil { if err != nil {
return &authStatus{ return &authStatus{

View File

@ -6,6 +6,7 @@ import (
"testing" "testing"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/config"
"github.com/databricks/databricks-sdk-go/experimental/mocks" "github.com/databricks/databricks-sdk-go/experimental/mocks"
"github.com/databricks/databricks-sdk-go/service/iam" "github.com/databricks/databricks-sdk-go/service/iam"
@ -17,7 +18,7 @@ import (
func TestGetWorkspaceAuthStatus(t *testing.T) { func TestGetWorkspaceAuthStatus(t *testing.T) {
ctx := context.Background() ctx := context.Background()
m := mocks.NewMockWorkspaceClient(t) m := mocks.NewMockWorkspaceClient(t)
ctx = root.SetWorkspaceClient(ctx, m.WorkspaceClient) ctx = command.SetWorkspaceClient(ctx, m.WorkspaceClient)
cmd := &cobra.Command{} cmd := &cobra.Command{}
cmd.SetContext(ctx) cmd.SetContext(ctx)
@ -75,7 +76,7 @@ func TestGetWorkspaceAuthStatus(t *testing.T) {
func TestGetWorkspaceAuthStatusError(t *testing.T) { func TestGetWorkspaceAuthStatusError(t *testing.T) {
ctx := context.Background() ctx := context.Background()
m := mocks.NewMockWorkspaceClient(t) m := mocks.NewMockWorkspaceClient(t)
ctx = root.SetWorkspaceClient(ctx, m.WorkspaceClient) ctx = command.SetWorkspaceClient(ctx, m.WorkspaceClient)
cmd := &cobra.Command{} cmd := &cobra.Command{}
cmd.SetContext(ctx) cmd.SetContext(ctx)
@ -124,7 +125,7 @@ func TestGetWorkspaceAuthStatusError(t *testing.T) {
func TestGetWorkspaceAuthStatusSensitive(t *testing.T) { func TestGetWorkspaceAuthStatusSensitive(t *testing.T) {
ctx := context.Background() ctx := context.Background()
m := mocks.NewMockWorkspaceClient(t) m := mocks.NewMockWorkspaceClient(t)
ctx = root.SetWorkspaceClient(ctx, m.WorkspaceClient) ctx = command.SetWorkspaceClient(ctx, m.WorkspaceClient)
cmd := &cobra.Command{} cmd := &cobra.Command{}
cmd.SetContext(ctx) cmd.SetContext(ctx)

View File

@ -7,6 +7,7 @@ import (
"strings" "strings"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/filer" "github.com/databricks/cli/libs/filer"
"github.com/databricks/cli/libs/filer/completer" "github.com/databricks/cli/libs/filer/completer"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -35,7 +36,7 @@ func filerForPath(ctx context.Context, fullPath string) (filer.Filer, string, er
} }
path := parts[1] path := parts[1]
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
// If the specified path has the "Volumes" prefix, use the Files API. // If the specified path has the "Volumes" prefix, use the Files API.
if strings.HasPrefix(path, "/Volumes/") { if strings.HasPrefix(path, "/Volumes/") {

View File

@ -6,7 +6,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/fakefs" "github.com/databricks/cli/libs/fakefs"
"github.com/databricks/cli/libs/filer" "github.com/databricks/cli/libs/filer"
"github.com/databricks/databricks-sdk-go/experimental/mocks" "github.com/databricks/databricks-sdk-go/experimental/mocks"
@ -73,7 +73,7 @@ func mockMustWorkspaceClientFunc(cmd *cobra.Command, args []string) error {
func setupCommand(t *testing.T) (*cobra.Command, *mocks.MockWorkspaceClient) { func setupCommand(t *testing.T) (*cobra.Command, *mocks.MockWorkspaceClient) {
m := mocks.NewMockWorkspaceClient(t) m := mocks.NewMockWorkspaceClient(t)
ctx := context.Background() ctx := context.Background()
ctx = root.SetWorkspaceClient(ctx, m.WorkspaceClient) ctx = command.SetWorkspaceClient(ctx, m.WorkspaceClient)
cmd := &cobra.Command{} cmd := &cobra.Command{}
cmd.SetContext(ctx) cmd.SetContext(ctx)

View File

@ -17,7 +17,6 @@ import (
// Placeholders to use as unique keys in context.Context. // Placeholders to use as unique keys in context.Context.
var ( var (
workspaceClient int
accountClient int accountClient int
) )
@ -229,15 +228,11 @@ func MustWorkspaceClient(cmd *cobra.Command, args []string) error {
return err return err
} }
ctx = context.WithValue(ctx, &workspaceClient, w) ctx = command.SetWorkspaceClient(ctx, w)
cmd.SetContext(ctx) cmd.SetContext(ctx)
return nil return nil
} }
func SetWorkspaceClient(ctx context.Context, w *databricks.WorkspaceClient) context.Context {
return context.WithValue(ctx, &workspaceClient, w)
}
func SetAccountClient(ctx context.Context, a *databricks.AccountClient) context.Context { func SetAccountClient(ctx context.Context, a *databricks.AccountClient) context.Context {
return context.WithValue(ctx, &accountClient, a) return context.WithValue(ctx, &accountClient, a)
} }
@ -321,14 +316,6 @@ func emptyHttpRequest(ctx context.Context) *http.Request {
return req return req
} }
func WorkspaceClient(ctx context.Context) *databricks.WorkspaceClient {
w, ok := ctx.Value(&workspaceClient).(*databricks.WorkspaceClient)
if !ok {
panic("cannot get *databricks.WorkspaceClient. Please report it as a bug")
}
return w
}
func AccountClient(ctx context.Context) *databricks.AccountClient { func AccountClient(ctx context.Context) *databricks.AccountClient {
a, ok := ctx.Value(&accountClient).(*databricks.AccountClient) a, ok := ctx.Value(&accountClient).(*databricks.AccountClient)
if !ok { if !ok {

View File

@ -9,6 +9,7 @@ import (
"github.com/databricks/cli/internal/testutil" "github.com/databricks/cli/internal/testutil"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/config" "github.com/databricks/databricks-sdk-go/config"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -263,7 +264,7 @@ func TestMustAnyClientCanCreateWorkspaceClient(t *testing.T) {
require.False(t, isAccount) require.False(t, isAccount)
require.NoError(t, err) require.NoError(t, err)
w := WorkspaceClient(cmd.Context()) w := command.WorkspaceClient(cmd.Context())
require.NotNil(t, w) require.NotNil(t, w)
} }

View File

@ -12,6 +12,7 @@ import (
"github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/deploy/files" "github.com/databricks/cli/bundle/deploy/files"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/cli/libs/git" "github.com/databricks/cli/libs/git"
"github.com/databricks/cli/libs/log" "github.com/databricks/cli/libs/log"
@ -65,7 +66,7 @@ func (f *syncFlags) syncOptionsFromArgs(cmd *cobra.Command, args []string) (*syn
} }
ctx := cmd.Context() ctx := cmd.Context()
client := root.WorkspaceClient(ctx) client := command.WorkspaceClient(ctx)
localRoot := vfs.MustNew(args[0]) localRoot := vfs.MustNew(args[0])
info, err := git.FetchRepositoryInfo(ctx, localRoot.Native(), client) info, err := git.FetchRepositoryInfo(ctx, localRoot.Native(), client)
@ -186,7 +187,7 @@ func New() *cobra.Command {
case 0: case 0:
return nil, cobra.ShellCompDirectiveFilterDirs return nil, cobra.ShellCompDirectiveFilterDirs
case 1: case 1:
wsc := root.WorkspaceClient(cmd.Context()) wsc := command.WorkspaceClient(cmd.Context())
return completeRemotePath(cmd.Context(), wsc, toComplete) return completeRemotePath(cmd.Context(), wsc, toComplete)
default: default:
return nil, cobra.ShellCompDirectiveNoFileComp return nil, cobra.ShellCompDirectiveNoFileComp

View File

@ -8,7 +8,7 @@ import (
"github.com/databricks/cli/bundle" "github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/config" "github.com/databricks/cli/bundle/config"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/vfs" "github.com/databricks/cli/libs/vfs"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -58,7 +58,7 @@ func TestSyncOptionsFromArgs(t *testing.T) {
f := syncFlags{} f := syncFlags{}
cmd := New() cmd := New()
cmd.SetContext(root.SetWorkspaceClient(context.Background(), nil)) cmd.SetContext(command.SetWorkspaceClient(context.Background(), nil))
opts, err := f.syncOptionsFromArgs(cmd, []string{local, remote}) opts, err := f.syncOptionsFromArgs(cmd, []string{local, remote})
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, local, opts.LocalRoot.Native()) assert.Equal(t, local, opts.LocalRoot.Native())

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/iam" "github.com/databricks/databricks-sdk-go/service/iam"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -70,7 +71,7 @@ func newCheckPolicy() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := checkPolicyJson.Unmarshal(&checkPolicyReq) diags := checkPolicyJson.Unmarshal(&checkPolicyReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -73,7 +74,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.AibiDashboardEmbeddingAccessPolicy().Delete(ctx, deleteReq) response, err := w.Settings.AibiDashboardEmbeddingAccessPolicy().Delete(ctx, deleteReq)
if err != nil { if err != nil {
@ -130,7 +131,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.AibiDashboardEmbeddingAccessPolicy().Get(ctx, getReq) response, err := w.Settings.AibiDashboardEmbeddingAccessPolicy().Get(ctx, getReq)
if err != nil { if err != nil {
@ -180,7 +181,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -73,7 +74,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.AibiDashboardEmbeddingApprovedDomains().Delete(ctx, deleteReq) response, err := w.Settings.AibiDashboardEmbeddingApprovedDomains().Delete(ctx, deleteReq)
if err != nil { if err != nil {
@ -128,7 +129,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.AibiDashboardEmbeddingApprovedDomains().Get(ctx, getReq) response, err := w.Settings.AibiDashboardEmbeddingApprovedDomains().Get(ctx, getReq)
if err != nil { if err != nil {
@ -180,7 +181,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -90,7 +91,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -160,7 +161,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -232,7 +233,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -299,7 +300,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.AlertsLegacy.List(ctx) response, err := w.AlertsLegacy.List(ctx)
if err != nil { if err != nil {
return err return err
@ -360,7 +361,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -82,7 +83,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -145,7 +146,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -212,7 +213,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -289,7 +290,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Alerts.List(ctx, listReq) response := w.Alerts.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -364,7 +365,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/apps" "github.com/databricks/databricks-sdk-go/service/apps"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -114,7 +115,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq.App) diags := createJson.Unmarshal(&createReq.App)
@ -205,7 +206,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Name = args[0] deleteReq.Name = args[0]
@ -277,7 +278,7 @@ func newDeploy() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deployJson.Unmarshal(&deployReq.AppDeployment) diags := deployJson.Unmarshal(&deployReq.AppDeployment)
@ -366,7 +367,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]
@ -426,7 +427,7 @@ func newGetDeployment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getDeploymentReq.AppName = args[0] getDeploymentReq.AppName = args[0]
getDeploymentReq.DeploymentId = args[1] getDeploymentReq.DeploymentId = args[1]
@ -485,7 +486,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionLevelsReq.AppName = args[0] getPermissionLevelsReq.AppName = args[0]
@ -544,7 +545,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionsReq.AppName = args[0] getPermissionsReq.AppName = args[0]
@ -602,7 +603,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Apps.List(ctx, listReq) response := w.Apps.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -658,7 +659,7 @@ func newListDeployments() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listDeploymentsReq.AppName = args[0] listDeploymentsReq.AppName = args[0]
@ -719,7 +720,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -794,7 +795,7 @@ func newStart() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
startReq.Name = args[0] startReq.Name = args[0]
@ -876,7 +877,7 @@ func newStop() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
stopReq.Name = args[0] stopReq.Name = args[0]
@ -965,7 +966,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq.App) diags := updateJson.Unmarshal(&updateReq.App)
@ -1040,7 +1041,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -77,7 +78,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
_, err = fmt.Sscan(args[0], &getReq.ArtifactType) _, err = fmt.Sscan(args[0], &getReq.ArtifactType)
if err != nil { if err != nil {
@ -142,7 +143,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -70,7 +71,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.AutomaticClusterUpdate().Get(ctx, getReq) response, err := w.Settings.AutomaticClusterUpdate().Get(ctx, getReq)
if err != nil { if err != nil {
@ -124,7 +125,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -102,7 +103,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -177,7 +178,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Name = args[0] deleteReq.Name = args[0]
@ -239,7 +240,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]
@ -302,7 +303,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Catalogs.List(ctx, listReq) response := w.Catalogs.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -367,7 +368,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/cleanrooms" "github.com/databricks/databricks-sdk-go/service/cleanrooms"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -96,7 +97,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq.Asset) diags := createJson.Unmarshal(&createReq.Asset)
@ -169,7 +170,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.CleanRoomName = args[0] deleteReq.CleanRoomName = args[0]
_, err = fmt.Sscan(args[1], &deleteReq.AssetType) _, err = fmt.Sscan(args[1], &deleteReq.AssetType)
@ -235,7 +236,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.CleanRoomName = args[0] getReq.CleanRoomName = args[0]
_, err = fmt.Sscan(args[1], &getReq.AssetType) _, err = fmt.Sscan(args[1], &getReq.AssetType)
@ -298,7 +299,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.CleanRoomName = args[0] listReq.CleanRoomName = args[0]
@ -376,7 +377,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq.Asset) diags := updateJson.Unmarshal(&updateReq.Asset)

View File

@ -5,6 +5,7 @@ package clean_room_task_runs
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/cleanrooms" "github.com/databricks/databricks-sdk-go/service/cleanrooms"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -74,7 +75,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.CleanRoomName = args[0] listReq.CleanRoomName = args[0]

View File

@ -5,6 +5,7 @@ package clean_rooms
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/cleanrooms" "github.com/databricks/databricks-sdk-go/service/cleanrooms"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -92,7 +93,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq.CleanRoom) diags := createJson.Unmarshal(&createReq.CleanRoom)
@ -166,7 +167,7 @@ func newCreateOutputCatalog() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createOutputCatalogJson.Unmarshal(&createOutputCatalogReq.OutputCatalog) diags := createOutputCatalogJson.Unmarshal(&createOutputCatalogReq.OutputCatalog)
@ -239,7 +240,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Name = args[0] deleteReq.Name = args[0]
@ -294,7 +295,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]
@ -353,7 +354,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.CleanRooms.List(ctx, listReq) response := w.CleanRooms.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -413,7 +414,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -110,7 +111,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -188,7 +189,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteJson.Unmarshal(&deleteReq) diags := deleteJson.Unmarshal(&deleteReq)
@ -293,7 +294,7 @@ func newEdit() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := editJson.Unmarshal(&editReq) diags := editJson.Unmarshal(&editReq)
@ -376,7 +377,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -446,7 +447,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -517,7 +518,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -592,7 +593,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ClusterPolicies.List(ctx, listReq) response := w.ClusterPolicies.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -646,7 +647,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -733,7 +734,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -131,7 +132,7 @@ func newChangeOwner() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := changeOwnerJson.Unmarshal(&changeOwnerReq) diags := changeOwnerJson.Unmarshal(&changeOwnerReq)
@ -277,7 +278,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -377,7 +378,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteJson.Unmarshal(&deleteReq) diags := deleteJson.Unmarshal(&deleteReq)
@ -546,7 +547,7 @@ func newEdit() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := editJson.Unmarshal(&editReq) diags := editJson.Unmarshal(&editReq)
@ -650,7 +651,7 @@ func newEvents() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := eventsJson.Unmarshal(&eventsReq) diags := eventsJson.Unmarshal(&eventsReq)
@ -736,7 +737,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -806,7 +807,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -877,7 +878,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -956,7 +957,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Clusters.List(ctx, listReq) response := w.Clusters.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -997,7 +998,7 @@ func newListNodeTypes() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Clusters.ListNodeTypes(ctx) response, err := w.Clusters.ListNodeTypes(ctx)
if err != nil { if err != nil {
return err return err
@ -1040,7 +1041,7 @@ func newListZones() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Clusters.ListZones(ctx) response, err := w.Clusters.ListZones(ctx)
if err != nil { if err != nil {
return err return err
@ -1108,7 +1109,7 @@ func newPermanentDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := permanentDeleteJson.Unmarshal(&permanentDeleteReq) diags := permanentDeleteJson.Unmarshal(&permanentDeleteReq)
@ -1206,7 +1207,7 @@ func newPin() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := pinJson.Unmarshal(&pinReq) diags := pinJson.Unmarshal(&pinReq)
@ -1311,7 +1312,7 @@ func newResize() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := resizeJson.Unmarshal(&resizeReq) diags := resizeJson.Unmarshal(&resizeReq)
@ -1427,7 +1428,7 @@ func newRestart() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := restartJson.Unmarshal(&restartReq) diags := restartJson.Unmarshal(&restartReq)
@ -1528,7 +1529,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -1603,7 +1604,7 @@ func newSparkVersions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Clusters.SparkVersions(ctx) response, err := w.Clusters.SparkVersions(ctx)
if err != nil { if err != nil {
return err return err
@ -1678,7 +1679,7 @@ func newStart() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := startJson.Unmarshal(&startReq) diags := startJson.Unmarshal(&startReq)
@ -1788,7 +1789,7 @@ func newUnpin() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := unpinJson.Unmarshal(&unpinReq) diags := unpinJson.Unmarshal(&unpinReq)
@ -1906,7 +1907,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)
@ -1993,7 +1994,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -73,7 +74,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.ComplianceSecurityProfile().Get(ctx, getReq) response, err := w.Settings.ComplianceSecurityProfile().Get(ctx, getReq)
if err != nil { if err != nil {
@ -127,7 +128,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -89,7 +90,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -155,7 +156,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -225,7 +226,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -300,7 +301,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Connections.List(ctx, listReq) response := w.Connections.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -358,7 +359,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -5,6 +5,7 @@ package consumer_fulfillments
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -71,7 +72,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.ListingId = args[0] getReq.ListingId = args[0]
@ -130,7 +131,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.ListingId = args[0] listReq.ListingId = args[0]

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -83,7 +84,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -150,7 +151,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.ListingId = args[0] deleteReq.ListingId = args[0]
deleteReq.InstallationId = args[1] deleteReq.InstallationId = args[1]
@ -209,7 +210,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ConsumerInstallations.List(ctx, listReq) response := w.ConsumerInstallations.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -262,7 +263,7 @@ func newListListingInstallations() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listListingInstallationsReq.ListingId = args[0] listListingInstallationsReq.ListingId = args[0]
@ -322,7 +323,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -76,7 +77,7 @@ func newBatchGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.ConsumerListings.BatchGet(ctx, batchGetReq) response, err := w.ConsumerListings.BatchGet(ctx, batchGetReq)
if err != nil { if err != nil {
@ -125,7 +126,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -208,7 +209,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ConsumerListings.List(ctx, listReq) response := w.ConsumerListings.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -266,7 +267,7 @@ func newSearch() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -82,7 +83,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -152,7 +153,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.ListingId = args[0] getReq.ListingId = args[0]
@ -210,7 +211,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ConsumerPersonalizationRequests.List(ctx, listReq) response := w.ConsumerPersonalizationRequests.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -74,7 +75,7 @@ func newBatchGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.ConsumerProviders.BatchGet(ctx, batchGetReq) response, err := w.ConsumerProviders.BatchGet(ctx, batchGetReq)
if err != nil { if err != nil {
@ -123,7 +124,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -200,7 +201,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ConsumerProviders.List(ctx, listReq) response := w.ConsumerProviders.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -72,7 +73,7 @@ func newExchangeToken() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := exchangeTokenJson.Unmarshal(&exchangeTokenReq) diags := exchangeTokenJson.Unmarshal(&exchangeTokenReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -110,7 +111,7 @@ func newCreateCredential() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createCredentialJson.Unmarshal(&createCredentialReq) diags := createCredentialJson.Unmarshal(&createCredentialReq)
@ -185,7 +186,7 @@ func newDeleteCredential() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteCredentialReq.NameArg = args[0] deleteCredentialReq.NameArg = args[0]
@ -257,7 +258,7 @@ func newGenerateTemporaryServiceCredential() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := generateTemporaryServiceCredentialJson.Unmarshal(&generateTemporaryServiceCredentialReq) diags := generateTemporaryServiceCredentialJson.Unmarshal(&generateTemporaryServiceCredentialReq)
@ -331,7 +332,7 @@ func newGetCredential() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getCredentialReq.NameArg = args[0] getCredentialReq.NameArg = args[0]
@ -395,7 +396,7 @@ func newListCredentials() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Credentials.ListCredentials(ctx, listCredentialsReq) response := w.Credentials.ListCredentials(ctx, listCredentialsReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -466,7 +467,7 @@ func newUpdateCredential() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateCredentialJson.Unmarshal(&updateCredentialReq) diags := updateCredentialJson.Unmarshal(&updateCredentialReq)
@ -558,7 +559,7 @@ func newValidateCredential() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := validateCredentialJson.Unmarshal(&validateCredentialReq) diags := validateCredentialJson.Unmarshal(&validateCredentialReq)

View File

@ -5,6 +5,7 @@ package current_user
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -57,7 +58,7 @@ func newMe() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.CurrentUser.Me(ctx) response, err := w.CurrentUser.Me(ctx)
if err != nil { if err != nil {
return err return err

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -72,7 +73,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -141,7 +142,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Id = args[0] deleteReq.Id = args[0]
@ -199,7 +200,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -75,7 +76,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -139,7 +140,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -207,7 +208,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -287,7 +288,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Dashboards.List(ctx, listReq) response := w.Dashboards.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -332,7 +333,7 @@ func newRestore() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -408,7 +409,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -5,6 +5,7 @@ package data_sources
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -77,7 +78,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.DataSources.List(ctx) response, err := w.DataSources.List(ctx)
if err != nil { if err != nil {
return err return err

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -85,7 +86,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.DefaultNamespace().Delete(ctx, deleteReq) response, err := w.Settings.DefaultNamespace().Delete(ctx, deleteReq)
if err != nil { if err != nil {
@ -140,7 +141,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.DefaultNamespace().Get(ctx, getReq) response, err := w.Settings.DefaultNamespace().Get(ctx, getReq)
if err != nil { if err != nil {
@ -196,7 +197,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -79,7 +80,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.DisableLegacyAccess().Delete(ctx, deleteReq) response, err := w.Settings.DisableLegacyAccess().Delete(ctx, deleteReq)
if err != nil { if err != nil {
@ -134,7 +135,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.DisableLegacyAccess().Get(ctx, getReq) response, err := w.Settings.DisableLegacyAccess().Get(ctx, getReq)
if err != nil { if err != nil {
@ -184,7 +185,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -76,7 +77,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.DisableLegacyDbfs().Delete(ctx, deleteReq) response, err := w.Settings.DisableLegacyDbfs().Delete(ctx, deleteReq)
if err != nil { if err != nil {
@ -131,7 +132,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.DisableLegacyDbfs().Get(ctx, getReq) response, err := w.Settings.DisableLegacyDbfs().Get(ctx, getReq)
if err != nil { if err != nil {
@ -181,7 +182,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -75,7 +76,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.EnhancedSecurityMonitoring().Get(ctx, getReq) response, err := w.Settings.EnhancedSecurityMonitoring().Get(ctx, getReq)
if err != nil { if err != nil {
@ -129,7 +130,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/ml" "github.com/databricks/databricks-sdk-go/service/ml"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -127,7 +128,7 @@ func newCreateExperiment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createExperimentJson.Unmarshal(&createExperimentReq) diags := createExperimentJson.Unmarshal(&createExperimentReq)
@ -207,7 +208,7 @@ func newCreateRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createRunJson.Unmarshal(&createRunReq) diags := createRunJson.Unmarshal(&createRunReq)
@ -287,7 +288,7 @@ func newDeleteExperiment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteExperimentJson.Unmarshal(&deleteExperimentReq) diags := deleteExperimentJson.Unmarshal(&deleteExperimentReq)
@ -368,7 +369,7 @@ func newDeleteRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteRunJson.Unmarshal(&deleteRunReq) diags := deleteRunJson.Unmarshal(&deleteRunReq)
@ -456,7 +457,7 @@ func newDeleteRuns() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteRunsJson.Unmarshal(&deleteRunsReq) diags := deleteRunsJson.Unmarshal(&deleteRunsReq)
@ -545,7 +546,7 @@ func newDeleteTag() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteTagJson.Unmarshal(&deleteTagReq) diags := deleteTagJson.Unmarshal(&deleteTagReq)
@ -628,7 +629,7 @@ func newGetByName() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getByNameReq.ExperimentName = args[0] getByNameReq.ExperimentName = args[0]
@ -686,7 +687,7 @@ func newGetExperiment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getExperimentReq.ExperimentId = args[0] getExperimentReq.ExperimentId = args[0]
@ -749,7 +750,7 @@ func newGetHistory() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getHistoryReq.MetricKey = args[0] getHistoryReq.MetricKey = args[0]
@ -804,7 +805,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionLevelsReq.ExperimentId = args[0] getPermissionLevelsReq.ExperimentId = args[0]
@ -863,7 +864,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionsReq.ExperimentId = args[0] getPermissionsReq.ExperimentId = args[0]
@ -928,7 +929,7 @@ func newGetRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getRunReq.RunId = args[0] getRunReq.RunId = args[0]
@ -993,7 +994,7 @@ func newListArtifacts() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Experiments.ListArtifacts(ctx, listArtifactsReq) response := w.Experiments.ListArtifacts(ctx, listArtifactsReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -1047,7 +1048,7 @@ func newListExperiments() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Experiments.ListExperiments(ctx, listExperimentsReq) response := w.Experiments.ListExperiments(ctx, listExperimentsReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -1146,7 +1147,7 @@ func newLogBatch() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := logBatchJson.Unmarshal(&logBatchReq) diags := logBatchJson.Unmarshal(&logBatchReq)
@ -1229,7 +1230,7 @@ func newLogInputs() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := logInputsJson.Unmarshal(&logInputsReq) diags := logInputsJson.Unmarshal(&logInputsReq)
@ -1318,7 +1319,7 @@ func newLogMetric() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := logMetricJson.Unmarshal(&logMetricReq) diags := logMetricJson.Unmarshal(&logMetricReq)
@ -1405,7 +1406,7 @@ func newLogModel() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := logModelJson.Unmarshal(&logModelReq) diags := logModelJson.Unmarshal(&logModelReq)
@ -1490,7 +1491,7 @@ func newLogParam() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := logParamJson.Unmarshal(&logParamReq) diags := logParamJson.Unmarshal(&logParamReq)
@ -1579,7 +1580,7 @@ func newRestoreExperiment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := restoreExperimentJson.Unmarshal(&restoreExperimentReq) diags := restoreExperimentJson.Unmarshal(&restoreExperimentReq)
@ -1664,7 +1665,7 @@ func newRestoreRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := restoreRunJson.Unmarshal(&restoreRunReq) diags := restoreRunJson.Unmarshal(&restoreRunReq)
@ -1752,7 +1753,7 @@ func newRestoreRuns() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := restoreRunsJson.Unmarshal(&restoreRunsReq) diags := restoreRunsJson.Unmarshal(&restoreRunsReq)
@ -1835,7 +1836,7 @@ func newSearchExperiments() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := searchExperimentsJson.Unmarshal(&searchExperimentsReq) diags := searchExperimentsJson.Unmarshal(&searchExperimentsReq)
@ -1909,7 +1910,7 @@ func newSearchRuns() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := searchRunsJson.Unmarshal(&searchRunsReq) diags := searchRunsJson.Unmarshal(&searchRunsReq)
@ -1987,7 +1988,7 @@ func newSetExperimentTag() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setExperimentTagJson.Unmarshal(&setExperimentTagReq) diags := setExperimentTagJson.Unmarshal(&setExperimentTagReq)
@ -2071,7 +2072,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -2156,7 +2157,7 @@ func newSetTag() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setTagJson.Unmarshal(&setTagReq) diags := setTagJson.Unmarshal(&setTagReq)
@ -2242,7 +2243,7 @@ func newUpdateExperiment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateExperimentJson.Unmarshal(&updateExperimentReq) diags := updateExperimentJson.Unmarshal(&updateExperimentReq)
@ -2319,7 +2320,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
@ -2394,7 +2395,7 @@ func newUpdateRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateRunJson.Unmarshal(&updateRunReq) diags := updateRunJson.Unmarshal(&updateRunReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -109,7 +110,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -190,7 +191,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Name = args[0] deleteReq.Name = args[0]
@ -252,7 +253,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]
@ -314,7 +315,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ExternalLocations.List(ctx, listReq) response := w.ExternalLocations.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -384,7 +385,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -82,7 +83,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -156,7 +157,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -235,7 +236,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -321,7 +322,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.CatalogName = args[0] listReq.CatalogName = args[0]
listReq.SchemaName = args[1] listReq.SchemaName = args[1]
@ -384,7 +385,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/dashboards" "github.com/databricks/databricks-sdk-go/service/dashboards"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -105,7 +106,7 @@ func newCreateMessage() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createMessageJson.Unmarshal(&createMessageReq) diags := createMessageJson.Unmarshal(&createMessageReq)
@ -194,7 +195,7 @@ func newExecuteMessageQuery() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
executeMessageQueryReq.SpaceId = args[0] executeMessageQueryReq.SpaceId = args[0]
executeMessageQueryReq.ConversationId = args[1] executeMessageQueryReq.ConversationId = args[1]
@ -258,7 +259,7 @@ func newGetMessage() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getMessageReq.SpaceId = args[0] getMessageReq.SpaceId = args[0]
getMessageReq.ConversationId = args[1] getMessageReq.ConversationId = args[1]
@ -322,7 +323,7 @@ func newGetMessageQueryResult() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getMessageQueryResultReq.SpaceId = args[0] getMessageQueryResultReq.SpaceId = args[0]
getMessageQueryResultReq.ConversationId = args[1] getMessageQueryResultReq.ConversationId = args[1]
@ -387,7 +388,7 @@ func newGetMessageQueryResultByAttachment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getMessageQueryResultByAttachmentReq.SpaceId = args[0] getMessageQueryResultByAttachmentReq.SpaceId = args[0]
getMessageQueryResultByAttachmentReq.ConversationId = args[1] getMessageQueryResultByAttachmentReq.ConversationId = args[1]
@ -448,7 +449,7 @@ func newGetSpace() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getSpaceReq.SpaceId = args[0] getSpaceReq.SpaceId = args[0]
@ -522,7 +523,7 @@ func newStartConversation() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := startConversationJson.Unmarshal(&startConversationReq) diags := startConversationJson.Unmarshal(&startConversationReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/workspace" "github.com/databricks/databricks-sdk-go/service/workspace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -100,7 +101,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -167,7 +168,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -240,7 +241,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -306,7 +307,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.GitCredentials.List(ctx) response := w.GitCredentials.List(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -374,7 +375,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -98,7 +99,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -168,7 +169,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -238,7 +239,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -303,7 +304,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.GlobalInitScripts.List(ctx) response := w.GlobalInitScripts.List(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -370,7 +371,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -88,7 +89,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
_, err = fmt.Sscan(args[0], &getReq.SecurableType) _, err = fmt.Sscan(args[0], &getReq.SecurableType)
if err != nil { if err != nil {
@ -153,7 +154,7 @@ func newGetEffective() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
_, err = fmt.Sscan(args[0], &getEffectiveReq.SecurableType) _, err = fmt.Sscan(args[0], &getEffectiveReq.SecurableType)
if err != nil { if err != nil {
@ -220,7 +221,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/iam" "github.com/databricks/databricks-sdk-go/service/iam"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -94,7 +95,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -158,7 +159,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -228,7 +229,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -308,7 +309,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Groups.List(ctx, listReq) response := w.Groups.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -361,7 +362,7 @@ func newPatch() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := patchJson.Unmarshal(&patchReq) diags := patchJson.Unmarshal(&patchReq)
@ -455,7 +456,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -125,7 +126,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -209,7 +210,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteJson.Unmarshal(&deleteReq) diags := deleteJson.Unmarshal(&deleteReq)
@ -318,7 +319,7 @@ func newEdit() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := editJson.Unmarshal(&editReq) diags := editJson.Unmarshal(&editReq)
@ -391,7 +392,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -461,7 +462,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -532,7 +533,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -594,7 +595,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.InstancePools.List(ctx) response := w.InstancePools.List(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -647,7 +648,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -734,7 +735,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -96,7 +97,7 @@ func newAdd() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := addJson.Unmarshal(&addReq) diags := addJson.Unmarshal(&addReq)
@ -195,7 +196,7 @@ func newEdit() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := editJson.Unmarshal(&editReq) diags := editJson.Unmarshal(&editReq)
@ -256,7 +257,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.InstanceProfiles.List(ctx) response := w.InstanceProfiles.List(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -320,7 +321,7 @@ func newRemove() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := removeJson.Unmarshal(&removeReq) diags := removeJson.Unmarshal(&removeReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -130,7 +131,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -203,7 +204,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -273,7 +274,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -335,7 +336,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.IpAccessLists.List(ctx) response := w.IpAccessLists.List(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -417,7 +418,7 @@ func newReplace() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := replaceJson.Unmarshal(&replaceReq) diags := replaceJson.Unmarshal(&replaceReq)
@ -519,7 +520,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/jobs" "github.com/databricks/databricks-sdk-go/service/jobs"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -113,7 +114,7 @@ func newCancelAllRuns() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := cancelAllRunsJson.Unmarshal(&cancelAllRunsReq) diags := cancelAllRunsJson.Unmarshal(&cancelAllRunsReq)
@ -196,7 +197,7 @@ func newCancelRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := cancelRunJson.Unmarshal(&cancelRunReq) diags := cancelRunJson.Unmarshal(&cancelRunReq)
@ -300,7 +301,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -379,7 +380,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteJson.Unmarshal(&deleteReq) diags := deleteJson.Unmarshal(&deleteReq)
@ -478,7 +479,7 @@ func newDeleteRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteRunJson.Unmarshal(&deleteRunReq) diags := deleteRunJson.Unmarshal(&deleteRunReq)
@ -566,7 +567,7 @@ func newExportRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -648,7 +649,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -721,7 +722,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -792,7 +793,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -878,7 +879,7 @@ func newGetRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -960,7 +961,7 @@ func newGetRunOutput() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -1041,7 +1042,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Jobs.List(ctx, listReq) response := w.Jobs.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -1102,7 +1103,7 @@ func newListRuns() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Jobs.ListRuns(ctx, listRunsReq) response := w.Jobs.ListRuns(ctx, listRunsReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -1184,7 +1185,7 @@ func newRepairRun() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := repairRunJson.Unmarshal(&repairRunReq) diags := repairRunJson.Unmarshal(&repairRunReq)
@ -1289,7 +1290,7 @@ func newReset() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := resetJson.Unmarshal(&resetReq) diags := resetJson.Unmarshal(&resetReq)
@ -1387,7 +1388,7 @@ func newRunNow() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := runNowJson.Unmarshal(&runNowReq) diags := runNowJson.Unmarshal(&runNowReq)
@ -1498,7 +1499,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -1607,7 +1608,7 @@ func newSubmit() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := submitJson.Unmarshal(&submitReq) diags := submitJson.Unmarshal(&submitReq)
@ -1707,7 +1708,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)
@ -1798,7 +1799,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -4,6 +4,7 @@ package lakeview_embedded
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/dashboards" "github.com/databricks/databricks-sdk-go/service/dashboards"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -72,7 +73,7 @@ func newGetPublishedDashboardEmbedded() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPublishedDashboardEmbeddedReq.DashboardId = args[0] getPublishedDashboardEmbeddedReq.DashboardId = args[0]

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/dashboards" "github.com/databricks/databricks-sdk-go/service/dashboards"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -96,7 +97,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq.Dashboard) diags := createJson.Unmarshal(&createReq.Dashboard)
@ -170,7 +171,7 @@ func newCreateSchedule() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createScheduleJson.Unmarshal(&createScheduleReq.Schedule) diags := createScheduleJson.Unmarshal(&createScheduleReq.Schedule)
@ -242,7 +243,7 @@ func newCreateSubscription() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createSubscriptionJson.Unmarshal(&createSubscriptionReq.Subscription) diags := createSubscriptionJson.Unmarshal(&createSubscriptionReq.Subscription)
@ -312,7 +313,7 @@ func newDeleteSchedule() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteScheduleReq.DashboardId = args[0] deleteScheduleReq.DashboardId = args[0]
deleteScheduleReq.ScheduleId = args[1] deleteScheduleReq.ScheduleId = args[1]
@ -371,7 +372,7 @@ func newDeleteSubscription() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteSubscriptionReq.DashboardId = args[0] deleteSubscriptionReq.DashboardId = args[0]
deleteSubscriptionReq.ScheduleId = args[1] deleteSubscriptionReq.ScheduleId = args[1]
@ -431,7 +432,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.DashboardId = args[0] getReq.DashboardId = args[0]
@ -489,7 +490,7 @@ func newGetPublished() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPublishedReq.DashboardId = args[0] getPublishedReq.DashboardId = args[0]
@ -546,7 +547,7 @@ func newGetSchedule() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getScheduleReq.DashboardId = args[0] getScheduleReq.DashboardId = args[0]
getScheduleReq.ScheduleId = args[1] getScheduleReq.ScheduleId = args[1]
@ -605,7 +606,7 @@ func newGetSubscription() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getSubscriptionReq.DashboardId = args[0] getSubscriptionReq.DashboardId = args[0]
getSubscriptionReq.ScheduleId = args[1] getSubscriptionReq.ScheduleId = args[1]
@ -664,7 +665,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Lakeview.List(ctx, listReq) response := w.Lakeview.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -717,7 +718,7 @@ func newListSchedules() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listSchedulesReq.DashboardId = args[0] listSchedulesReq.DashboardId = args[0]
@ -773,7 +774,7 @@ func newListSubscriptions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listSubscriptionsReq.DashboardId = args[0] listSubscriptionsReq.DashboardId = args[0]
listSubscriptionsReq.ScheduleId = args[1] listSubscriptionsReq.ScheduleId = args[1]
@ -842,7 +843,7 @@ func newMigrate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := migrateJson.Unmarshal(&migrateReq) diags := migrateJson.Unmarshal(&migrateReq)
@ -919,7 +920,7 @@ func newPublish() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := publishJson.Unmarshal(&publishReq) diags := publishJson.Unmarshal(&publishReq)
@ -989,7 +990,7 @@ func newTrash() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
trashReq.DashboardId = args[0] trashReq.DashboardId = args[0]
@ -1047,7 +1048,7 @@ func newUnpublish() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
unpublishReq.DashboardId = args[0] unpublishReq.DashboardId = args[0]
@ -1112,7 +1113,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq.Dashboard) diags := updateJson.Unmarshal(&updateReq.Dashboard)
@ -1188,7 +1189,7 @@ func newUpdateSchedule() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateScheduleJson.Unmarshal(&updateScheduleReq.Schedule) diags := updateScheduleJson.Unmarshal(&updateScheduleReq.Schedule)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -79,7 +80,7 @@ func newAllClusterStatuses() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Libraries.AllClusterStatuses(ctx) response := w.Libraries.AllClusterStatuses(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -137,7 +138,7 @@ func newClusterStatus() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
clusterStatusReq.ClusterId = args[0] clusterStatusReq.ClusterId = args[0]
@ -187,7 +188,7 @@ func newInstall() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := installJson.Unmarshal(&installReq) diags := installJson.Unmarshal(&installReq)
@ -254,7 +255,7 @@ func newUninstall() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := uninstallJson.Unmarshal(&uninstallReq) diags := uninstallJson.Unmarshal(&uninstallReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -109,7 +110,7 @@ func newAssign() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := assignJson.Unmarshal(&assignReq) diags := assignJson.Unmarshal(&assignReq)
@ -204,7 +205,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -263,7 +264,7 @@ func newCurrent() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Metastores.Current(ctx) response, err := w.Metastores.Current(ctx)
if err != nil { if err != nil {
return err return err
@ -315,7 +316,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -386,7 +387,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -450,7 +451,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Metastores.List(ctx) response := w.Metastores.List(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -490,7 +491,7 @@ func newSummary() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Metastores.Summary(ctx) response, err := w.Metastores.Summary(ctx)
if err != nil { if err != nil {
return err return err
@ -546,7 +547,7 @@ func newUnassign() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
_, err = fmt.Sscan(args[0], &unassignReq.WorkspaceId) _, err = fmt.Sscan(args[0], &unassignReq.WorkspaceId)
if err != nil { if err != nil {
@ -615,7 +616,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)
@ -705,7 +706,7 @@ func newUpdateAssignment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateAssignmentJson.Unmarshal(&updateAssignmentReq) diags := updateAssignmentJson.Unmarshal(&updateAssignmentReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/ml" "github.com/databricks/databricks-sdk-go/service/ml"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -138,7 +139,7 @@ func newApproveTransitionRequest() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := approveTransitionRequestJson.Unmarshal(&approveTransitionRequestReq) diags := approveTransitionRequestJson.Unmarshal(&approveTransitionRequestReq)
@ -238,7 +239,7 @@ func newCreateComment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createCommentJson.Unmarshal(&createCommentReq) diags := createCommentJson.Unmarshal(&createCommentReq)
@ -331,7 +332,7 @@ func newCreateModel() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createModelJson.Unmarshal(&createModelReq) diags := createModelJson.Unmarshal(&createModelReq)
@ -418,7 +419,7 @@ func newCreateModelVersion() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createModelVersionJson.Unmarshal(&createModelVersionReq) diags := createModelVersionJson.Unmarshal(&createModelVersionReq)
@ -514,7 +515,7 @@ func newCreateTransitionRequest() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createTransitionRequestJson.Unmarshal(&createTransitionRequestReq) diags := createTransitionRequestJson.Unmarshal(&createTransitionRequestReq)
@ -597,7 +598,7 @@ func newCreateWebhook() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createWebhookJson.Unmarshal(&createWebhookReq) diags := createWebhookJson.Unmarshal(&createWebhookReq)
@ -665,7 +666,7 @@ func newDeleteComment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteCommentReq.Id = args[0] deleteCommentReq.Id = args[0]
@ -723,7 +724,7 @@ func newDeleteModel() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteModelReq.Name = args[0] deleteModelReq.Name = args[0]
@ -783,7 +784,7 @@ func newDeleteModelTag() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteModelTagReq.Name = args[0] deleteModelTagReq.Name = args[0]
deleteModelTagReq.Key = args[1] deleteModelTagReq.Key = args[1]
@ -843,7 +844,7 @@ func newDeleteModelVersion() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteModelVersionReq.Name = args[0] deleteModelVersionReq.Name = args[0]
deleteModelVersionReq.Version = args[1] deleteModelVersionReq.Version = args[1]
@ -905,7 +906,7 @@ func newDeleteModelVersionTag() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteModelVersionTagReq.Name = args[0] deleteModelVersionTagReq.Name = args[0]
deleteModelVersionTagReq.Version = args[1] deleteModelVersionTagReq.Version = args[1]
@ -980,7 +981,7 @@ func newDeleteTransitionRequest() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteTransitionRequestReq.Name = args[0] deleteTransitionRequestReq.Name = args[0]
deleteTransitionRequestReq.Version = args[1] deleteTransitionRequestReq.Version = args[1]
@ -1045,7 +1046,7 @@ func newDeleteWebhook() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
err = w.ModelRegistry.DeleteWebhook(ctx, deleteWebhookReq) err = w.ModelRegistry.DeleteWebhook(ctx, deleteWebhookReq)
if err != nil { if err != nil {
@ -1112,7 +1113,7 @@ func newGetLatestVersions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := getLatestVersionsJson.Unmarshal(&getLatestVersionsReq) diags := getLatestVersionsJson.Unmarshal(&getLatestVersionsReq)
@ -1185,7 +1186,7 @@ func newGetModel() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getModelReq.Name = args[0] getModelReq.Name = args[0]
@ -1244,7 +1245,7 @@ func newGetModelVersion() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getModelVersionReq.Name = args[0] getModelVersionReq.Name = args[0]
getModelVersionReq.Version = args[1] getModelVersionReq.Version = args[1]
@ -1304,7 +1305,7 @@ func newGetModelVersionDownloadUri() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getModelVersionDownloadUriReq.Name = args[0] getModelVersionDownloadUriReq.Name = args[0]
getModelVersionDownloadUriReq.Version = args[1] getModelVersionDownloadUriReq.Version = args[1]
@ -1363,7 +1364,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionLevelsReq.RegisteredModelId = args[0] getPermissionLevelsReq.RegisteredModelId = args[0]
@ -1422,7 +1423,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionsReq.RegisteredModelId = args[0] getPermissionsReq.RegisteredModelId = args[0]
@ -1481,7 +1482,7 @@ func newListModels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ModelRegistry.ListModels(ctx, listModelsReq) response := w.ModelRegistry.ListModels(ctx, listModelsReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -1535,7 +1536,7 @@ func newListTransitionRequests() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listTransitionRequestsReq.Name = args[0] listTransitionRequestsReq.Name = args[0]
listTransitionRequestsReq.Version = args[1] listTransitionRequestsReq.Version = args[1]
@ -1594,7 +1595,7 @@ func newListWebhooks() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ModelRegistry.ListWebhooks(ctx, listWebhooksReq) response := w.ModelRegistry.ListWebhooks(ctx, listWebhooksReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -1668,7 +1669,7 @@ func newRejectTransitionRequest() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := rejectTransitionRequestJson.Unmarshal(&rejectTransitionRequestReq) diags := rejectTransitionRequestJson.Unmarshal(&rejectTransitionRequestReq)
@ -1760,7 +1761,7 @@ func newRenameModel() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := renameModelJson.Unmarshal(&renameModelReq) diags := renameModelJson.Unmarshal(&renameModelReq)
@ -1834,7 +1835,7 @@ func newSearchModelVersions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ModelRegistry.SearchModelVersions(ctx, searchModelVersionsReq) response := w.ModelRegistry.SearchModelVersions(ctx, searchModelVersionsReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -1889,7 +1890,7 @@ func newSearchModels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ModelRegistry.SearchModels(ctx, searchModelsReq) response := w.ModelRegistry.SearchModels(ctx, searchModelsReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -1958,7 +1959,7 @@ func newSetModelTag() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setModelTagJson.Unmarshal(&setModelTagReq) diags := setModelTagJson.Unmarshal(&setModelTagReq)
@ -2053,7 +2054,7 @@ func newSetModelVersionTag() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setModelVersionTagJson.Unmarshal(&setModelVersionTagReq) diags := setModelVersionTagJson.Unmarshal(&setModelVersionTagReq)
@ -2140,7 +2141,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -2236,7 +2237,7 @@ func newTestRegistryWebhook() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := testRegistryWebhookJson.Unmarshal(&testRegistryWebhookReq) diags := testRegistryWebhookJson.Unmarshal(&testRegistryWebhookReq)
@ -2335,7 +2336,7 @@ func newTransitionStage() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := transitionStageJson.Unmarshal(&transitionStageReq) diags := transitionStageJson.Unmarshal(&transitionStageReq)
@ -2432,7 +2433,7 @@ func newUpdateComment() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateCommentJson.Unmarshal(&updateCommentReq) diags := updateCommentJson.Unmarshal(&updateCommentReq)
@ -2518,7 +2519,7 @@ func newUpdateModel() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateModelJson.Unmarshal(&updateModelReq) diags := updateModelJson.Unmarshal(&updateModelReq)
@ -2602,7 +2603,7 @@ func newUpdateModelVersion() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateModelVersionJson.Unmarshal(&updateModelVersionReq) diags := updateModelVersionJson.Unmarshal(&updateModelVersionReq)
@ -2682,7 +2683,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
@ -2769,7 +2770,7 @@ func newUpdateWebhook() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateWebhookJson.Unmarshal(&updateWebhookReq) diags := updateWebhookJson.Unmarshal(&updateWebhookReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -90,7 +91,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.FullName = args[0] deleteReq.FullName = args[0]
_, err = fmt.Sscan(args[1], &deleteReq.Version) _, err = fmt.Sscan(args[1], &deleteReq.Version)
@ -161,7 +162,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.FullName = args[0] getReq.FullName = args[0]
_, err = fmt.Sscan(args[1], &getReq.Version) _, err = fmt.Sscan(args[1], &getReq.Version)
@ -231,7 +232,7 @@ func newGetByAlias() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getByAliasReq.FullName = args[0] getByAliasReq.FullName = args[0]
getByAliasReq.Alias = args[1] getByAliasReq.Alias = args[1]
@ -307,7 +308,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.FullName = args[0] listReq.FullName = args[0]
@ -374,7 +375,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -5,6 +5,7 @@ package notification_destinations
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -81,7 +82,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -147,7 +148,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Id = args[0] deleteReq.Id = args[0]
@ -202,7 +203,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Id = args[0] getReq.Id = args[0]
@ -260,7 +261,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.NotificationDestinations.List(ctx, listReq) response := w.NotificationDestinations.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -319,7 +320,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -86,7 +87,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq.Table) diags := createJson.Unmarshal(&createReq.Table)
@ -170,7 +171,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Name = args[0] deleteReq.Name = args[0]
@ -228,7 +229,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/iam" "github.com/databricks/databricks-sdk-go/service/iam"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -89,7 +90,7 @@ func newMigratePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := migratePermissionsJson.Unmarshal(&migratePermissionsReq) diags := migratePermissionsJson.Unmarshal(&migratePermissionsReq)

View File

@ -5,6 +5,7 @@ package permissions
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/iam" "github.com/databricks/databricks-sdk-go/service/iam"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -133,7 +134,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.RequestObjectType = args[0] getReq.RequestObjectType = args[0]
getReq.RequestObjectId = args[1] getReq.RequestObjectId = args[1]
@ -193,7 +194,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionLevelsReq.RequestObjectType = args[0] getPermissionLevelsReq.RequestObjectType = args[0]
getPermissionLevelsReq.RequestObjectId = args[1] getPermissionLevelsReq.RequestObjectId = args[1]
@ -263,7 +264,7 @@ func newSet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setJson.Unmarshal(&setReq) diags := setJson.Unmarshal(&setReq)
@ -344,7 +345,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/pipelines" "github.com/databricks/databricks-sdk-go/service/pipelines"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -95,7 +96,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -158,7 +159,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -228,7 +229,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -298,7 +299,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -369,7 +370,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -445,7 +446,7 @@ func newGetUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getUpdateReq.PipelineId = args[0] getUpdateReq.PipelineId = args[0]
getUpdateReq.UpdateId = args[1] getUpdateReq.UpdateId = args[1]
@ -501,7 +502,7 @@ func newListPipelineEvents() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -575,7 +576,7 @@ func newListPipelines() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Pipelines.ListPipelines(ctx, listPipelinesReq) response := w.Pipelines.ListPipelines(ctx, listPipelinesReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -627,7 +628,7 @@ func newListUpdates() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -703,7 +704,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -798,7 +799,7 @@ func newStartUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := startUpdateJson.Unmarshal(&startUpdateReq) diags := startUpdateJson.Unmarshal(&startUpdateReq)
@ -883,7 +884,7 @@ func newStop() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -995,7 +996,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)
@ -1082,7 +1083,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -107,7 +108,7 @@ func newEnforceCompliance() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := enforceComplianceJson.Unmarshal(&enforceComplianceReq) diags := enforceComplianceJson.Unmarshal(&enforceComplianceReq)
@ -180,7 +181,7 @@ func newGetCompliance() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getComplianceReq.ClusterId = args[0] getComplianceReq.ClusterId = args[0]
@ -243,7 +244,7 @@ func newListCompliance() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listComplianceReq.PolicyId = args[0] listComplianceReq.PolicyId = args[0]

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/jobs" "github.com/databricks/databricks-sdk-go/service/jobs"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -101,7 +102,7 @@ func newEnforceCompliance() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := enforceComplianceJson.Unmarshal(&enforceComplianceReq) diags := enforceComplianceJson.Unmarshal(&enforceComplianceReq)
@ -178,7 +179,7 @@ func newGetCompliance() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
_, err = fmt.Sscan(args[0], &getComplianceReq.JobId) _, err = fmt.Sscan(args[0], &getComplianceReq.JobId)
if err != nil { if err != nil {
@ -245,7 +246,7 @@ func newListCompliance() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listComplianceReq.PolicyId = args[0] listComplianceReq.PolicyId = args[0]

View File

@ -5,6 +5,7 @@ package policy_families
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/compute" "github.com/databricks/databricks-sdk-go/service/compute"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -82,7 +83,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.PolicyFamilyId = args[0] getReq.PolicyFamilyId = args[0]
@ -141,7 +142,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.PolicyFamilies.List(ctx, listReq) response := w.PolicyFamilies.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -70,7 +71,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -133,7 +134,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -208,7 +209,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.ExchangeId = args[0] listReq.ExchangeId = args[0]
@ -262,7 +263,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -88,7 +89,7 @@ func newAddListingToExchange() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := addListingToExchangeJson.Unmarshal(&addListingToExchangeReq) diags := addListingToExchangeJson.Unmarshal(&addListingToExchangeReq)
@ -157,7 +158,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -225,7 +226,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Id = args[0] deleteReq.Id = args[0]
@ -280,7 +281,7 @@ func newDeleteListingFromExchange() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteListingFromExchangeReq.Id = args[0] deleteListingFromExchangeReq.Id = args[0]
@ -335,7 +336,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Id = args[0] getReq.Id = args[0]
@ -393,7 +394,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ProviderExchanges.List(ctx, listReq) response := w.ProviderExchanges.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -446,7 +447,7 @@ func newListExchangesForListing() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listExchangesForListingReq.ListingId = args[0] listExchangesForListingReq.ListingId = args[0]
@ -501,7 +502,7 @@ func newListListingsForExchange() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listListingsForExchangeReq.ExchangeId = args[0] listListingsForExchangeReq.ExchangeId = args[0]
@ -555,7 +556,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -74,7 +75,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -137,7 +138,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -204,7 +205,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -276,7 +277,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := listJson.Unmarshal(&listReq) diags := listJson.Unmarshal(&listReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -72,7 +73,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -135,7 +136,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -202,7 +203,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -277,7 +278,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ProviderListings.List(ctx, listReq) response := w.ProviderListings.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -329,7 +330,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -76,7 +77,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ProviderPersonalizationRequests.List(ctx, listReq) response := w.ProviderPersonalizationRequests.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -139,7 +140,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -5,6 +5,7 @@ package provider_provider_analytics_dashboards
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -62,7 +63,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.ProviderProviderAnalyticsDashboards.Create(ctx) response, err := w.ProviderProviderAnalyticsDashboards.Create(ctx)
if err != nil { if err != nil {
return err return err
@ -104,7 +105,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.ProviderProviderAnalyticsDashboards.Get(ctx) response, err := w.ProviderProviderAnalyticsDashboards.Get(ctx)
if err != nil { if err != nil {
return err return err
@ -146,7 +147,7 @@ func newGetLatestVersion() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.ProviderProviderAnalyticsDashboards.GetLatestVersion(ctx) response, err := w.ProviderProviderAnalyticsDashboards.GetLatestVersion(ctx)
if err != nil { if err != nil {
return err return err
@ -205,7 +206,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace" "github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -71,7 +72,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -134,7 +135,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -201,7 +202,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -276,7 +277,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ProviderProviders.List(ctx, listReq) response := w.ProviderProviders.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -328,7 +329,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/databricks-sdk-go/service/sharing"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -95,7 +96,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -169,7 +170,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -241,7 +242,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -320,7 +321,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Providers.List(ctx, listReq) response := w.Providers.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -380,7 +381,7 @@ func newListProviderShareAssets() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listProviderShareAssetsReq.ProviderName = args[0] listProviderShareAssetsReq.ProviderName = args[0]
listProviderShareAssetsReq.ShareName = args[1] listProviderShareAssetsReq.ShareName = args[1]
@ -439,7 +440,7 @@ func newListShares() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -516,7 +517,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -101,7 +102,7 @@ func newCancelRefresh() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
cancelRefreshReq.TableName = args[0] cancelRefreshReq.TableName = args[0]
cancelRefreshReq.RefreshId = args[1] cancelRefreshReq.RefreshId = args[1]
@ -193,7 +194,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -281,7 +282,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.TableName = args[0] deleteReq.TableName = args[0]
@ -350,7 +351,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.TableName = args[0] getReq.TableName = args[0]
@ -418,7 +419,7 @@ func newGetRefresh() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getRefreshReq.TableName = args[0] getRefreshReq.TableName = args[0]
getRefreshReq.RefreshId = args[1] getRefreshReq.RefreshId = args[1]
@ -487,7 +488,7 @@ func newListRefreshes() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listRefreshesReq.TableName = args[0] listRefreshesReq.TableName = args[0]
@ -562,7 +563,7 @@ func newRegenerateDashboard() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := regenerateDashboardJson.Unmarshal(&regenerateDashboardReq) diags := regenerateDashboardJson.Unmarshal(&regenerateDashboardReq)
@ -642,7 +643,7 @@ func newRunRefresh() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
runRefreshReq.TableName = args[0] runRefreshReq.TableName = args[0]
@ -733,7 +734,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -93,7 +94,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -163,7 +164,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -236,7 +237,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -322,7 +323,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.QueriesLegacy.List(ctx, listReq) response := w.QueriesLegacy.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -373,7 +374,7 @@ func newRestore() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -457,7 +458,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -82,7 +83,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -146,7 +147,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -213,7 +214,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -290,7 +291,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Queries.List(ctx, listReq) response := w.Queries.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -341,7 +342,7 @@ func newListVisualizations() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -435,7 +436,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/dashboards" "github.com/databricks/databricks-sdk-go/service/dashboards"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -75,7 +76,7 @@ func newCancelPublishedQueryExecution() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
cancelPublishedQueryExecutionReq.DashboardName = args[0] cancelPublishedQueryExecutionReq.DashboardName = args[0]
cancelPublishedQueryExecutionReq.DashboardRevisionId = args[1] cancelPublishedQueryExecutionReq.DashboardRevisionId = args[1]
@ -146,7 +147,7 @@ func newExecutePublishedDashboardQuery() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := executePublishedDashboardQueryJson.Unmarshal(&executePublishedDashboardQueryReq) diags := executePublishedDashboardQueryJson.Unmarshal(&executePublishedDashboardQueryReq)
@ -218,7 +219,7 @@ func newPollPublishedQueryStatus() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
pollPublishedQueryStatusReq.DashboardName = args[0] pollPublishedQueryStatusReq.DashboardName = args[0]
pollPublishedQueryStatusReq.DashboardRevisionId = args[1] pollPublishedQueryStatusReq.DashboardRevisionId = args[1]

View File

@ -5,6 +5,7 @@ package query_history
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -78,7 +79,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.QueryHistory.List(ctx, listReq) response, err := w.QueryHistory.List(ctx, listReq)
if err != nil { if err != nil {

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -84,7 +85,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -160,7 +161,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Id = args[0] deleteReq.Id = args[0]
@ -225,7 +226,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sql" "github.com/databricks/databricks-sdk-go/service/sql"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -81,7 +82,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -147,7 +148,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Id = args[0] deleteReq.Id = args[0]
@ -227,7 +228,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -5,6 +5,7 @@ package recipient_activation
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/databricks-sdk-go/service/sharing"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -80,7 +81,7 @@ func newGetActivationUrlInfo() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getActivationUrlInfoReq.ActivationUrl = args[0] getActivationUrlInfoReq.ActivationUrl = args[0]
@ -139,7 +140,7 @@ func newRetrieveToken() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
retrieveTokenReq.ActivationUrl = args[0] retrieveTokenReq.ActivationUrl = args[0]

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/databricks-sdk-go/service/sharing"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -115,7 +116,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -194,7 +195,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Name = args[0] deleteReq.Name = args[0]
@ -254,7 +255,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]
@ -316,7 +317,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Recipients.List(ctx, listReq) response := w.Recipients.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -383,7 +384,7 @@ func newRotateToken() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := rotateTokenJson.Unmarshal(&rotateTokenReq) diags := rotateTokenJson.Unmarshal(&rotateTokenReq)
@ -463,7 +464,7 @@ func newSharePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
sharePermissionsReq.Name = args[0] sharePermissionsReq.Name = args[0]
@ -532,7 +533,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -5,6 +5,7 @@ package redash_config
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -57,7 +58,7 @@ func newGetConfig() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.RedashConfig.GetConfig(ctx) response, err := w.RedashConfig.GetConfig(ctx)
if err != nil { if err != nil {
return err return err

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -132,7 +133,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -211,7 +212,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -292,7 +293,7 @@ func newDeleteAlias() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteAliasReq.FullName = args[0] deleteAliasReq.FullName = args[0]
deleteAliasReq.Alias = args[1] deleteAliasReq.Alias = args[1]
@ -354,7 +355,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -443,7 +444,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.RegisteredModels.List(ctx, listReq) response := w.RegisteredModels.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -512,7 +513,7 @@ func newSetAlias() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setAliasJson.Unmarshal(&setAliasReq) diags := setAliasJson.Unmarshal(&setAliasReq)
@ -598,7 +599,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/diag" "github.com/databricks/cli/libs/diag"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go" "github.com/databricks/databricks-sdk-go"
@ -35,7 +36,7 @@ func createOverride(createCmd *cobra.Command, createReq *workspace.CreateRepoReq
createJson := createCmd.Flag("json").Value.(*flags.JsonFlag) createJson := createCmd.Flag("json").Value.(*flags.JsonFlag)
createCmd.RunE = func(cmd *cobra.Command, args []string) (err error) { createCmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(createReq) diags := createJson.Unmarshal(createReq)
if diags.HasError() { if diags.HasError() {
@ -71,7 +72,7 @@ func deleteOverride(deleteCmd *cobra.Command, deleteReq *workspace.DeleteRepoReq
deleteCmd.Use = "delete REPO_ID_OR_PATH" deleteCmd.Use = "delete REPO_ID_OR_PATH"
deleteCmd.RunE = func(cmd *cobra.Command, args []string) (err error) { deleteCmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.RepoId, err = repoArgumentToRepoID(ctx, w, args) deleteReq.RepoId, err = repoArgumentToRepoID(ctx, w, args)
if err != nil { if err != nil {
@ -89,7 +90,7 @@ func getOverride(getCmd *cobra.Command, getReq *workspace.GetRepoRequest) {
getCmd.Use = "get REPO_ID_OR_PATH" getCmd.Use = "get REPO_ID_OR_PATH"
getCmd.RunE = func(cmd *cobra.Command, args []string) (err error) { getCmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.RepoId, err = repoArgumentToRepoID(ctx, w, args) getReq.RepoId, err = repoArgumentToRepoID(ctx, w, args)
if err != nil { if err != nil {
return err return err
@ -110,7 +111,7 @@ func updateOverride(updateCmd *cobra.Command, updateReq *workspace.UpdateRepoReq
updateCmd.RunE = func(cmd *cobra.Command, args []string) (err error) { updateCmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
var diags diag.Diagnostics var diags diag.Diagnostics
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags = updateJson.Unmarshal(&updateReq) diags = updateJson.Unmarshal(&updateReq)
if diags.HasError() { if diags.HasError() {

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/workspace" "github.com/databricks/databricks-sdk-go/service/workspace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -108,7 +109,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -178,7 +179,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -251,7 +252,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -324,7 +325,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -395,7 +396,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -471,7 +472,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Repos.List(ctx, listReq) response := w.Repos.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -525,7 +526,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -614,7 +615,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)
@ -704,7 +705,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -5,6 +5,7 @@ package resource_quotas
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -85,7 +86,7 @@ func newGetQuota() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getQuotaReq.ParentSecurableType = args[0] getQuotaReq.ParentSecurableType = args[0]
getQuotaReq.ParentFullName = args[1] getQuotaReq.ParentFullName = args[1]
@ -147,7 +148,7 @@ func newListQuotas() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ResourceQuotas.ListQuotas(ctx, listQuotasReq) response := w.ResourceQuotas.ListQuotas(ctx, listQuotasReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings" "github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -85,7 +86,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.RestrictWorkspaceAdmins().Delete(ctx, deleteReq) response, err := w.Settings.RestrictWorkspaceAdmins().Delete(ctx, deleteReq)
if err != nil { if err != nil {
@ -140,7 +141,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response, err := w.Settings.RestrictWorkspaceAdmins().Get(ctx, getReq) response, err := w.Settings.RestrictWorkspaceAdmins().Get(ctx, getReq)
if err != nil { if err != nil {
@ -194,7 +195,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -97,7 +98,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -170,7 +171,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -244,7 +245,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -327,7 +328,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.CatalogName = args[0] listReq.CatalogName = args[0]
@ -389,7 +390,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/diag" "github.com/databricks/cli/libs/diag"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/workspace" "github.com/databricks/databricks-sdk-go/service/workspace"
@ -62,7 +63,7 @@ func newPutSecret() *cobra.Command {
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
var diags diag.Diagnostics var diags diag.Diagnostics
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
bytesValueChanged := cmd.Flags().Changed("bytes-value") bytesValueChanged := cmd.Flags().Changed("bytes-value")
stringValueChanged := cmd.Flags().Changed("string-value") stringValueChanged := cmd.Flags().Changed("string-value")

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/workspace" "github.com/databricks/databricks-sdk-go/service/workspace"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -107,7 +108,7 @@ func newCreateScope() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createScopeJson.Unmarshal(&createScopeReq) diags := createScopeJson.Unmarshal(&createScopeReq)
@ -194,7 +195,7 @@ func newDeleteAcl() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteAclJson.Unmarshal(&deleteAclReq) diags := deleteAclJson.Unmarshal(&deleteAclReq)
@ -282,7 +283,7 @@ func newDeleteScope() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteScopeJson.Unmarshal(&deleteScopeReq) diags := deleteScopeJson.Unmarshal(&deleteScopeReq)
@ -369,7 +370,7 @@ func newDeleteSecret() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := deleteSecretJson.Unmarshal(&deleteSecretReq) diags := deleteSecretJson.Unmarshal(&deleteSecretReq)
@ -450,7 +451,7 @@ func newGetAcl() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getAclReq.Scope = args[0] getAclReq.Scope = args[0]
getAclReq.Principal = args[1] getAclReq.Principal = args[1]
@ -521,7 +522,7 @@ func newGetSecret() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getSecretReq.Scope = args[0] getSecretReq.Scope = args[0]
getSecretReq.Key = args[1] getSecretReq.Key = args[1]
@ -585,7 +586,7 @@ func newListAcls() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listAclsReq.Scope = args[0] listAclsReq.Scope = args[0]
@ -630,7 +631,7 @@ func newListScopes() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Secrets.ListScopes(ctx) response := w.Secrets.ListScopes(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -689,7 +690,7 @@ func newListSecrets() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listSecretsReq.Scope = args[0] listSecretsReq.Scope = args[0]
@ -780,7 +781,7 @@ func newPutAcl() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := putAclJson.Unmarshal(&putAclReq) diags := putAclJson.Unmarshal(&putAclReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/iam" "github.com/databricks/databricks-sdk-go/service/iam"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -92,7 +93,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -156,7 +157,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -227,7 +228,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -307,7 +308,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ServicePrincipals.List(ctx, listReq) response := w.ServicePrincipals.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -361,7 +362,7 @@ func newPatch() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := patchJson.Unmarshal(&patchReq) diags := patchJson.Unmarshal(&patchReq)
@ -457,7 +458,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -8,6 +8,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/serving" "github.com/databricks/databricks-sdk-go/service/serving"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -106,7 +107,7 @@ func newBuildLogs() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
buildLogsReq.Name = args[0] buildLogsReq.Name = args[0]
buildLogsReq.ServedModelName = args[1] buildLogsReq.ServedModelName = args[1]
@ -185,7 +186,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -265,7 +266,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Name = args[0] deleteReq.Name = args[0]
@ -325,7 +326,7 @@ func newExportMetrics() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
exportMetricsReq.Name = args[0] exportMetricsReq.Name = args[0]
@ -384,7 +385,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]
@ -445,7 +446,7 @@ func newGetOpenApi() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getOpenApiReq.Name = args[0] getOpenApiReq.Name = args[0]
@ -504,7 +505,7 @@ func newGetPermissionLevels() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionLevelsReq.ServingEndpointId = args[0] getPermissionLevelsReq.ServingEndpointId = args[0]
@ -563,7 +564,7 @@ func newGetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getPermissionsReq.ServingEndpointId = args[0] getPermissionsReq.ServingEndpointId = args[0]
@ -629,7 +630,7 @@ func newHttpRequest() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
httpRequestReq.ConnectionName = args[0] httpRequestReq.ConnectionName = args[0]
_, err = fmt.Sscan(args[1], &httpRequestReq.Method) _, err = fmt.Sscan(args[1], &httpRequestReq.Method)
@ -678,7 +679,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.ServingEndpoints.List(ctx) response := w.ServingEndpoints.List(ctx)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
} }
@ -733,7 +734,7 @@ func newLogs() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
logsReq.Name = args[0] logsReq.Name = args[0]
logsReq.ServedModelName = args[1] logsReq.ServedModelName = args[1]
@ -799,7 +800,7 @@ func newPatch() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := patchJson.Unmarshal(&patchReq) diags := patchJson.Unmarshal(&patchReq)
@ -876,7 +877,7 @@ func newPut() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := putJson.Unmarshal(&putReq) diags := putJson.Unmarshal(&putReq)
@ -955,7 +956,7 @@ func newPutAiGateway() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := putAiGatewayJson.Unmarshal(&putAiGatewayReq) diags := putAiGatewayJson.Unmarshal(&putAiGatewayReq)
@ -1039,7 +1040,7 @@ func newQuery() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := queryJson.Unmarshal(&queryReq) diags := queryJson.Unmarshal(&queryReq)
@ -1115,7 +1116,7 @@ func newSetPermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := setPermissionsJson.Unmarshal(&setPermissionsReq) diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
@ -1200,7 +1201,7 @@ func newUpdateConfig() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateConfigJson.Unmarshal(&updateConfigReq) diags := updateConfigJson.Unmarshal(&updateConfigReq)
@ -1288,7 +1289,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/sharing" "github.com/databricks/databricks-sdk-go/service/sharing"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -97,7 +98,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -170,7 +171,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.Name = args[0] deleteReq.Name = args[0]
@ -231,7 +232,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]
@ -291,7 +292,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.Shares.List(ctx, listReq) response := w.Shares.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -348,7 +349,7 @@ func newSharePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
sharePermissionsReq.Name = args[0] sharePermissionsReq.Name = args[0]
@ -430,7 +431,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)
@ -508,7 +509,7 @@ func newUpdatePermissions() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq) diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -108,7 +109,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -178,7 +179,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -255,7 +256,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
getReq.Name = args[0] getReq.Name = args[0]
@ -317,7 +318,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
response := w.StorageCredentials.List(ctx, listReq) response := w.StorageCredentials.List(ctx, listReq)
return cmdio.RenderIterator(ctx, response) return cmdio.RenderIterator(ctx, response)
@ -380,7 +381,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)
@ -487,7 +488,7 @@ func newValidate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := validateJson.Unmarshal(&validateReq) diags := validateJson.Unmarshal(&validateReq)

View File

@ -5,6 +5,7 @@ package system_schemas
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -76,7 +77,7 @@ func newDisable() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
disableReq.MetastoreId = args[0] disableReq.MetastoreId = args[0]
disableReq.SchemaName = args[1] disableReq.SchemaName = args[1]
@ -137,7 +138,7 @@ func newEnable() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
enableReq.MetastoreId = args[0] enableReq.MetastoreId = args[0]
enableReq.SchemaName = args[1] enableReq.SchemaName = args[1]
@ -200,7 +201,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.MetastoreId = args[0] listReq.MetastoreId = args[0]

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -89,7 +90,7 @@ func newCreate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := createJson.Unmarshal(&createReq) diags := createJson.Unmarshal(&createReq)
@ -172,7 +173,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
deleteReq.FullName = args[0] deleteReq.FullName = args[0]
deleteReq.ConstraintName = args[1] deleteReq.ConstraintName = args[1]

View File

@ -7,6 +7,7 @@ import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -85,7 +86,7 @@ func newDelete() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -162,7 +163,7 @@ func newExists() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -242,7 +243,7 @@ func newGet() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -332,7 +333,7 @@ func newList() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
listReq.CatalogName = args[0] listReq.CatalogName = args[0]
listReq.SchemaName = args[1] listReq.SchemaName = args[1]
@ -399,7 +400,7 @@ func newListSummaries() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if len(args) == 0 { if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx) promptSpinner := cmdio.Spinner(ctx)
@ -477,7 +478,7 @@ func newUpdate() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq) diags := updateJson.Unmarshal(&updateReq)

View File

@ -5,6 +5,7 @@ package temporary_table_credentials
import ( import (
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/command"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/catalog" "github.com/databricks/databricks-sdk-go/service/catalog"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -91,7 +92,7 @@ func newGenerateTemporaryTableCredentials() *cobra.Command {
cmd.PreRunE = root.MustWorkspaceClient cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context() ctx := cmd.Context()
w := root.WorkspaceClient(ctx) w := command.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
diags := generateTemporaryTableCredentialsJson.Unmarshal(&generateTemporaryTableCredentialsReq) diags := generateTemporaryTableCredentialsJson.Unmarshal(&generateTemporaryTableCredentialsReq)

Some files were not shown because too many files have changed in this diff Show More