mirror of https://github.com/databricks/cli.git
Move AccountClient to libs/command
This commit is contained in:
parent
1a02422d56
commit
010ea442d0
|
@ -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 := command.AccountClient(ctx){{else}}w := root.WorkspaceClient(ctx){{end}}
|
||||||
{{- if .Request }}
|
{{- if .Request }}
|
||||||
{{ if $canUseJson }}
|
{{ if $canUseJson }}
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -79,7 +80,7 @@ func newGetAssignableRolesForResource() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getAssignableRolesForResourceReq.Resource = args[0]
|
getAssignableRolesForResourceReq.Resource = args[0]
|
||||||
|
|
||||||
|
@ -147,7 +148,7 @@ func newGetRuleSet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getRuleSetReq.Name = args[0]
|
getRuleSetReq.Name = args[0]
|
||||||
getRuleSetReq.Etag = args[1]
|
getRuleSetReq.Etag = args[1]
|
||||||
|
@ -202,7 +203,7 @@ func newUpdateRuleSet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateRuleSetJson.Unmarshal(&updateRuleSetReq)
|
diags := updateRuleSetJson.Unmarshal(&updateRuleSetReq)
|
||||||
|
|
|
@ -5,6 +5,7 @@ package billable_usage
|
||||||
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/billing"
|
"github.com/databricks/databricks-sdk-go/service/billing"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -85,7 +86,7 @@ func newDownload() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
downloadReq.StartMonth = args[0]
|
downloadReq.StartMonth = args[0]
|
||||||
downloadReq.EndMonth = args[1]
|
downloadReq.EndMonth = args[1]
|
||||||
|
|
|
@ -5,6 +5,7 @@ package budget_policy
|
||||||
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/billing"
|
"github.com/databricks/databricks-sdk-go/service/billing"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -77,7 +78,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteReq.PolicyId = args[0]
|
deleteReq.PolicyId = args[0]
|
||||||
|
|
||||||
|
@ -204,7 +205,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getReq.PolicyId = args[0]
|
getReq.PolicyId = args[0]
|
||||||
|
|
||||||
|
@ -265,7 +266,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.BudgetPolicy.List(ctx, listReq)
|
response := a.BudgetPolicy.List(ctx, listReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -327,7 +328,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq.Policy)
|
diags := updateJson.Unmarshal(&updateReq.Policy)
|
||||||
|
|
|
@ -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/billing"
|
"github.com/databricks/databricks-sdk-go/service/billing"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -75,7 +76,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteReq.BudgetId = args[0]
|
deleteReq.BudgetId = args[0]
|
||||||
|
|
||||||
|
@ -206,7 +207,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getReq.BudgetId = args[0]
|
getReq.BudgetId = args[0]
|
||||||
|
|
||||||
|
@ -263,7 +264,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.Budgets.List(ctx, listReq)
|
response := a.Budgets.List(ctx, listReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -319,7 +320,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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/provisioning"
|
"github.com/databricks/databricks-sdk-go/service/provisioning"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -87,7 +88,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -226,7 +227,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response, err := a.Credentials.List(ctx)
|
response, err := a.Credentials.List(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.Settings.CspEnablementAccount().Get(ctx, getReq)
|
response, err := a.Settings.CspEnablementAccount().Get(ctx, getReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -126,7 +127,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -5,6 +5,7 @@ package custom_app_integration
|
||||||
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/oauth2"
|
"github.com/databricks/databricks-sdk-go/service/oauth2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -86,7 +87,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -153,7 +154,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteReq.IntegrationId = args[0]
|
deleteReq.IntegrationId = args[0]
|
||||||
|
|
||||||
|
@ -211,7 +212,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getReq.IntegrationId = args[0]
|
getReq.IntegrationId = args[0]
|
||||||
|
|
||||||
|
@ -271,7 +272,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.CustomAppIntegration.List(ctx, listReq)
|
response := a.CustomAppIntegration.List(ctx, listReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -329,7 +330,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -77,7 +78,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.Settings.DisableLegacyFeatures().Delete(ctx, deleteReq)
|
response, err := a.Settings.DisableLegacyFeatures().Delete(ctx, deleteReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -132,7 +133,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.Settings.DisableLegacyFeatures().Get(ctx, getReq)
|
response, err := a.Settings.DisableLegacyFeatures().Get(ctx, getReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -182,7 +183,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -74,7 +75,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.Settings.EnableIpAccessLists().Delete(ctx, deleteReq)
|
response, err := a.Settings.EnableIpAccessLists().Delete(ctx, deleteReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -129,7 +130,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.Settings.EnableIpAccessLists().Get(ctx, getReq)
|
response, err := a.Settings.EnableIpAccessLists().Get(ctx, getReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -179,7 +180,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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/provisioning"
|
"github.com/databricks/databricks-sdk-go/service/provisioning"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -104,7 +105,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -176,7 +177,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteReq.CustomerManagedKeyId = args[0]
|
deleteReq.CustomerManagedKeyId = args[0]
|
||||||
|
|
||||||
|
@ -248,7 +249,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getReq.CustomerManagedKeyId = args[0]
|
getReq.CustomerManagedKeyId = args[0]
|
||||||
|
|
||||||
|
@ -305,7 +306,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response, err := a.EncryptionKeys.List(ctx)
|
response, err := a.EncryptionKeys.List(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.Settings.EsmEnablementAccount().Get(ctx, getReq)
|
response, err := a.Settings.EsmEnablementAccount().Get(ctx, getReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -124,7 +125,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -5,6 +5,7 @@ package federation_policy
|
||||||
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/oauth2"
|
"github.com/databricks/databricks-sdk-go/service/oauth2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -126,7 +127,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq.Policy)
|
diags := createJson.Unmarshal(&createReq.Policy)
|
||||||
|
@ -193,7 +194,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteReq.PolicyId = args[0]
|
deleteReq.PolicyId = args[0]
|
||||||
|
|
||||||
|
@ -249,7 +250,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getReq.PolicyId = args[0]
|
getReq.PolicyId = args[0]
|
||||||
|
|
||||||
|
@ -305,7 +306,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.FederationPolicy.List(ctx, listReq)
|
response := a.FederationPolicy.List(ctx, listReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -364,7 +365,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq.Policy)
|
diags := updateJson.Unmarshal(&updateReq.Policy)
|
||||||
|
|
|
@ -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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.Groups.List(ctx, listReq)
|
response := a.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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -129,7 +130,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -202,7 +203,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -272,7 +273,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -334,7 +335,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response := a.IpAccessLists.List(ctx)
|
response := a.IpAccessLists.List(ctx)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
}
|
}
|
||||||
|
@ -414,7 +415,7 @@ func newReplace() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := replaceJson.Unmarshal(&replaceReq)
|
diags := replaceJson.Unmarshal(&replaceReq)
|
||||||
|
@ -514,7 +515,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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/billing"
|
"github.com/databricks/databricks-sdk-go/service/billing"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -159,7 +160,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -224,7 +225,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -301,7 +302,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.LogDelivery.List(ctx, listReq)
|
response := a.LogDelivery.List(ctx, listReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -372,7 +373,7 @@ func newPatchStatus() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchStatusJson.Unmarshal(&patchStatusReq)
|
diags := patchStatusJson.Unmarshal(&patchStatusReq)
|
||||||
|
|
|
@ -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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &deleteReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &deleteReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -223,7 +224,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &getReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &getReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -285,7 +286,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
listReq.MetastoreId = args[0]
|
listReq.MetastoreId = args[0]
|
||||||
|
|
||||||
|
@ -346,7 +347,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -5,6 +5,7 @@ package metastores
|
||||||
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"
|
||||||
|
@ -77,7 +78,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -148,7 +149,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteReq.MetastoreId = args[0]
|
deleteReq.MetastoreId = args[0]
|
||||||
|
|
||||||
|
@ -206,7 +207,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getReq.MetastoreId = args[0]
|
getReq.MetastoreId = args[0]
|
||||||
|
|
||||||
|
@ -251,7 +252,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response := a.Metastores.List(ctx)
|
response := a.Metastores.List(ctx)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
}
|
}
|
||||||
|
@ -307,7 +308,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -93,7 +94,7 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createNetworkConnectivityConfigurationJson.Unmarshal(&createNetworkConnectivityConfigurationReq)
|
diags := createNetworkConnectivityConfigurationJson.Unmarshal(&createNetworkConnectivityConfigurationReq)
|
||||||
|
@ -190,7 +191,7 @@ func newCreatePrivateEndpointRule() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createPrivateEndpointRuleJson.Unmarshal(&createPrivateEndpointRuleReq)
|
diags := createPrivateEndpointRuleJson.Unmarshal(&createPrivateEndpointRuleReq)
|
||||||
|
@ -269,7 +270,7 @@ func newDeleteNetworkConnectivityConfiguration() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteNetworkConnectivityConfigurationReq.NetworkConnectivityConfigId = args[0]
|
deleteNetworkConnectivityConfigurationReq.NetworkConnectivityConfigId = args[0]
|
||||||
|
|
||||||
|
@ -333,7 +334,7 @@ func newDeletePrivateEndpointRule() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deletePrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0]
|
deletePrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0]
|
||||||
deletePrivateEndpointRuleReq.PrivateEndpointRuleId = args[1]
|
deletePrivateEndpointRuleReq.PrivateEndpointRuleId = args[1]
|
||||||
|
@ -392,7 +393,7 @@ func newGetNetworkConnectivityConfiguration() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getNetworkConnectivityConfigurationReq.NetworkConnectivityConfigId = args[0]
|
getNetworkConnectivityConfigurationReq.NetworkConnectivityConfigId = args[0]
|
||||||
|
|
||||||
|
@ -451,7 +452,7 @@ func newGetPrivateEndpointRule() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getPrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0]
|
getPrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0]
|
||||||
getPrivateEndpointRuleReq.PrivateEndpointRuleId = args[1]
|
getPrivateEndpointRuleReq.PrivateEndpointRuleId = args[1]
|
||||||
|
@ -509,7 +510,7 @@ func newListNetworkConnectivityConfigurations() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.NetworkConnectivity.ListNetworkConnectivityConfigurations(ctx, listNetworkConnectivityConfigurationsReq)
|
response := a.NetworkConnectivity.ListNetworkConnectivityConfigurations(ctx, listNetworkConnectivityConfigurationsReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -564,7 +565,7 @@ func newListPrivateEndpointRules() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
listPrivateEndpointRulesReq.NetworkConnectivityConfigId = args[0]
|
listPrivateEndpointRulesReq.NetworkConnectivityConfigId = args[0]
|
||||||
|
|
||||||
|
|
|
@ -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/provisioning"
|
"github.com/databricks/databricks-sdk-go/service/provisioning"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -94,7 +95,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -166,7 +167,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -237,7 +238,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response, err := a.Networks.List(ctx)
|
response, err := a.Networks.List(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -5,6 +5,7 @@ package o_auth_published_apps
|
||||||
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/oauth2"
|
"github.com/databricks/databricks-sdk-go/service/oauth2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -73,7 +74,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.OAuthPublishedApps.List(ctx, listReq)
|
response := a.OAuthPublishedApps.List(ctx, listReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -81,7 +82,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.Settings.PersonalCompute().Delete(ctx, deleteReq)
|
response, err := a.Settings.PersonalCompute().Delete(ctx, deleteReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -136,7 +137,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.Settings.PersonalCompute().Get(ctx, getReq)
|
response, err := a.Settings.PersonalCompute().Get(ctx, getReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -186,7 +187,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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/provisioning"
|
"github.com/databricks/databricks-sdk-go/service/provisioning"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -106,7 +107,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -183,7 +184,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -260,7 +261,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -323,7 +324,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response, err := a.PrivateAccess.List(ctx)
|
response, err := a.PrivateAccess.List(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -414,7 +415,7 @@ func newReplace() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := replaceJson.Unmarshal(&replaceReq)
|
diags := replaceJson.Unmarshal(&replaceReq)
|
||||||
|
|
|
@ -5,6 +5,7 @@ package published_app_integration
|
||||||
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/oauth2"
|
"github.com/databricks/databricks-sdk-go/service/oauth2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -82,7 +83,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -149,7 +150,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteReq.IntegrationId = args[0]
|
deleteReq.IntegrationId = args[0]
|
||||||
|
|
||||||
|
@ -204,7 +205,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getReq.IntegrationId = args[0]
|
getReq.IntegrationId = args[0]
|
||||||
|
|
||||||
|
@ -263,7 +264,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.PublishedAppIntegration.List(ctx, listReq)
|
response := a.PublishedAppIntegration.List(ctx, listReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -318,7 +319,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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/oauth2"
|
"github.com/databricks/databricks-sdk-go/service/oauth2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -136,7 +137,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq.Policy)
|
diags := createJson.Unmarshal(&createReq.Policy)
|
||||||
|
@ -208,7 +209,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &deleteReq.ServicePrincipalId)
|
_, err = fmt.Sscan(args[0], &deleteReq.ServicePrincipalId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -269,7 +270,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &getReq.ServicePrincipalId)
|
_, err = fmt.Sscan(args[0], &getReq.ServicePrincipalId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -332,7 +333,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &listReq.ServicePrincipalId)
|
_, err = fmt.Sscan(args[0], &listReq.ServicePrincipalId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -397,7 +398,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq.Policy)
|
diags := updateJson.Unmarshal(&updateReq.Policy)
|
||||||
|
|
|
@ -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/oauth2"
|
"github.com/databricks/databricks-sdk-go/service/oauth2"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -91,7 +92,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -165,7 +166,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &deleteReq.ServicePrincipalId)
|
_, err = fmt.Sscan(args[0], &deleteReq.ServicePrincipalId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -231,7 +232,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &listReq.ServicePrincipalId)
|
_, err = fmt.Sscan(args[0], &listReq.ServicePrincipalId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.ServicePrincipals.List(ctx, listReq)
|
response := a.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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(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.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -5,6 +5,7 @@ package storage_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"
|
||||||
|
@ -85,7 +86,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -159,7 +160,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
deleteReq.MetastoreId = args[0]
|
deleteReq.MetastoreId = args[0]
|
||||||
deleteReq.StorageCredentialName = args[1]
|
deleteReq.StorageCredentialName = args[1]
|
||||||
|
@ -221,7 +222,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
getReq.MetastoreId = args[0]
|
getReq.MetastoreId = args[0]
|
||||||
getReq.StorageCredentialName = args[1]
|
getReq.StorageCredentialName = args[1]
|
||||||
|
@ -281,7 +282,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
listReq.MetastoreId = args[0]
|
listReq.MetastoreId = args[0]
|
||||||
|
|
||||||
|
@ -343,7 +344,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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/provisioning"
|
"github.com/databricks/databricks-sdk-go/service/provisioning"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -84,7 +85,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -151,7 +152,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -221,7 +222,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -284,7 +285,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response, err := a.Storage.List(ctx)
|
response, err := a.Storage.List(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -5,6 +5,7 @@ package usage_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/billing"
|
"github.com/databricks/databricks-sdk-go/service/billing"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -77,7 +78,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -146,7 +147,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response, err := a.UsageDashboards.Get(ctx, getReq)
|
response, err := a.UsageDashboards.Get(ctx, getReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -100,7 +101,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -165,7 +166,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -243,7 +244,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -323,7 +324,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
response := a.Users.List(ctx, listReq)
|
response := a.Users.List(ctx, listReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -377,7 +378,7 @@ func newPatch() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchJson.Unmarshal(&patchReq)
|
diags := patchJson.Unmarshal(&patchReq)
|
||||||
|
@ -474,7 +475,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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/provisioning"
|
"github.com/databricks/databricks-sdk-go/service/provisioning"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -101,7 +102,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -176,7 +177,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -250,7 +251,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -317,7 +318,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response, err := a.VpcEndpoints.List(ctx)
|
response, err := a.VpcEndpoints.List(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -79,7 +80,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &deleteReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &deleteReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -144,7 +145,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &getReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &getReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -206,7 +207,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
_, err = fmt.Sscan(args[0], &listReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &listReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -270,7 +271,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -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/provisioning"
|
"github.com/databricks/databricks-sdk-go/service/provisioning"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -131,7 +132,7 @@ func newCreate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
diags := createJson.Unmarshal(&createReq)
|
||||||
|
@ -217,7 +218,7 @@ func newDelete() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -303,7 +304,7 @@ func newGet() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -372,7 +373,7 @@ func newList() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
response, err := a.Workspaces.List(ctx)
|
response, err := a.Workspaces.List(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -556,7 +557,7 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustAccountClient
|
cmd.PreRunE = root.MustAccountClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
diags := updateJson.Unmarshal(&updateReq)
|
||||||
|
|
|
@ -88,7 +88,7 @@ func getAuthStatus(cmd *cobra.Command, args []string, showSensitive bool, fn try
|
||||||
}
|
}
|
||||||
|
|
||||||
if isAccount {
|
if isAccount {
|
||||||
a := root.AccountClient(ctx)
|
a := command.AccountClient(ctx)
|
||||||
|
|
||||||
// Doing a simple API call to check if the auth is valid
|
// Doing a simple API call to check if the auth is valid
|
||||||
_, err := a.Workspaces.List(ctx)
|
_, err := a.Workspaces.List(ctx)
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -169,7 +170,7 @@ func TestGetWorkspaceAuthStatusSensitive(t *testing.T) {
|
||||||
func TestGetAccountAuthStatus(t *testing.T) {
|
func TestGetAccountAuthStatus(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
m := mocks.NewMockAccountClient(t)
|
m := mocks.NewMockAccountClient(t)
|
||||||
ctx = root.SetAccountClient(ctx, m.AccountClient)
|
ctx = command.SetAccountClient(ctx, m.AccountClient)
|
||||||
|
|
||||||
cmd := &cobra.Command{}
|
cmd := &cobra.Command{}
|
||||||
cmd.SetContext(ctx)
|
cmd.SetContext(ctx)
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
// Placeholders to use as unique keys in context.Context.
|
// Placeholders to use as unique keys in context.Context.
|
||||||
var (
|
var (
|
||||||
workspaceClient int
|
workspaceClient int
|
||||||
accountClient int
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ErrNoWorkspaceProfiles struct {
|
type ErrNoWorkspaceProfiles struct {
|
||||||
|
@ -146,7 +145,7 @@ func MustAccountClient(cmd *cobra.Command, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = context.WithValue(ctx, &accountClient, a)
|
ctx = command.SetAccountClient(ctx, a)
|
||||||
cmd.SetContext(ctx)
|
cmd.SetContext(ctx)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -238,10 +237,6 @@ func SetWorkspaceClient(ctx context.Context, w *databricks.WorkspaceClient) cont
|
||||||
return context.WithValue(ctx, &workspaceClient, w)
|
return context.WithValue(ctx, &workspaceClient, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetAccountClient(ctx context.Context, a *databricks.AccountClient) context.Context {
|
|
||||||
return context.WithValue(ctx, &accountClient, a)
|
|
||||||
}
|
|
||||||
|
|
||||||
func AskForWorkspaceProfile(ctx context.Context) (string, error) {
|
func AskForWorkspaceProfile(ctx context.Context) (string, error) {
|
||||||
profiler := profile.GetProfiler(ctx)
|
profiler := profile.GetProfiler(ctx)
|
||||||
path, err := profiler.GetPath(ctx)
|
path, err := profiler.GetPath(ctx)
|
||||||
|
@ -328,11 +323,3 @@ func WorkspaceClient(ctx context.Context) *databricks.WorkspaceClient {
|
||||||
}
|
}
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
||||||
func AccountClient(ctx context.Context) *databricks.AccountClient {
|
|
||||||
a, ok := ctx.Value(&accountClient).(*databricks.AccountClient)
|
|
||||||
if !ok {
|
|
||||||
panic("cannot get *databricks.AccountClient. Please report it as a bug")
|
|
||||||
}
|
|
||||||
return a
|
|
||||||
}
|
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -292,7 +293,7 @@ func TestMustAnyClientCanCreateAccountClient(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.True(t, isAccount)
|
require.True(t, isAccount)
|
||||||
|
|
||||||
a := AccountClient(cmd.Context())
|
a := command.AccountClient(cmd.Context())
|
||||||
require.NotNil(t, a)
|
require.NotNil(t, a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/databricks/databricks-sdk-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
// func SetWorkspaceClient(ctx context.Context, w *databricks.WorkspaceClient) context.Context {
|
||||||
|
// if v := ctx.Value(workspaceClientKey); v != nil {
|
||||||
|
// panic("command.SetWorkspaceClient called twice on the same context.")
|
||||||
|
// }
|
||||||
|
// return context.WithValue(ctx, workspaceClientKey, w)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// func WorkspaceClient(ctx context.Context) *databricks.WorkspaceClient {
|
||||||
|
// v := ctx.Value(workspaceClientKey)
|
||||||
|
// if v == nil {
|
||||||
|
// panic("command.WorkspaceClient called without calling command.SetWorkspaceClient first.")
|
||||||
|
// }
|
||||||
|
// return v.(*databricks.WorkspaceClient)
|
||||||
|
// }
|
||||||
|
|
||||||
|
func SetAccountClient(ctx context.Context, a *databricks.AccountClient) context.Context {
|
||||||
|
if v := ctx.Value(accountClientKey); v != nil {
|
||||||
|
panic("command.SetAccountClient called twice on the same context")
|
||||||
|
}
|
||||||
|
return context.WithValue(ctx, accountClientKey, a)
|
||||||
|
}
|
||||||
|
|
||||||
|
func AccountClient(ctx context.Context) *databricks.AccountClient {
|
||||||
|
a, ok := ctx.Value(accountClientKey).(*databricks.AccountClient)
|
||||||
|
if !ok {
|
||||||
|
panic("command.AccountClient called without calling command.SetAccountClient first")
|
||||||
|
}
|
||||||
|
return a
|
||||||
|
}
|
|
@ -10,4 +10,8 @@ const (
|
||||||
// configUsedKey is the context key for the auth configuration used to run the
|
// configUsedKey is the context key for the auth configuration used to run the
|
||||||
// command.
|
// command.
|
||||||
configUsedKey = key(2)
|
configUsedKey = key(2)
|
||||||
|
|
||||||
|
// accountClientKey is the context key for an already configured account
|
||||||
|
// client that can be used to make authenticated requests.
|
||||||
|
accountClientKey = key(4)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue