mirror of https://github.com/databricks/cli.git
Merge remote-tracking branch 'upstream/main' into add-debug-runs
This commit is contained in:
commit
6414701b1c
|
@ -18,6 +18,13 @@ var accountCmd = &cobra.Command{
|
|||
|
||||
func init() {
|
||||
root.RootCmd.AddCommand(accountCmd)
|
||||
{{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) }}
|
||||
accountCmd.AddCommand({{.SnakeName}}.Cmd){{end}}{{end}}{{end}}
|
||||
|
||||
{{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) -}}
|
||||
accountCmd.AddCommand({{.SnakeName}}.Cmd)
|
||||
{{end}}{{end}}{{end}}
|
||||
|
||||
// Register commands with groups
|
||||
{{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) -}}
|
||||
{{.SnakeName}}.Cmd.GroupID = "{{ .Package.Name }}"
|
||||
{{end}}{{end}}{{end}}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
||||
|
||||
package cmd
|
||||
package workspace
|
||||
|
||||
{{$excludes := list "command-execution" "statement-execution" "dbfs" "dbsql-permissions"}}
|
||||
|
||||
|
@ -11,6 +11,12 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
{{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) }}
|
||||
root.RootCmd.AddCommand({{.SnakeName}}.Cmd){{end}}{{end}}{{end}}
|
||||
{{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) -}}
|
||||
root.RootCmd.AddCommand({{.SnakeName}}.Cmd)
|
||||
{{end}}{{end}}{{end}}
|
||||
|
||||
// Register commands with groups
|
||||
{{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) -}}
|
||||
{{.SnakeName}}.Cmd.GroupID = "{{ .Package.Name }}"
|
||||
{{end}}{{end}}{{end}}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,18 @@ import (
|
|||
{{define "service"}}
|
||||
var Cmd = &cobra.Command{
|
||||
Use: "{{(.TrimPrefix "account").KebabName}}",
|
||||
{{if .Description -}}
|
||||
Short: `{{.Summary | without "`"}}`,
|
||||
{{- if .Description }}
|
||||
Short: `{{.Summary | without "`"}}`,
|
||||
Long: `{{.Comment " " 80 | without "`"}}`,
|
||||
{{- end}}
|
||||
{{- end }}
|
||||
Annotations: map[string]string{
|
||||
"package": "{{ .Package.Name }}",
|
||||
},
|
||||
{{- if .IsPrivatePreview }}
|
||||
|
||||
// This service is being previewed; hide from help output.
|
||||
Hidden: true,
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
{{- $serviceName := .KebabName -}}
|
||||
|
@ -56,6 +64,7 @@ func init() {
|
|||
{{else if .Entity.IsAny }}// TODO: any: {{.Name}}
|
||||
{{else if .Entity.ArrayValue }}// TODO: array: {{.Name}}
|
||||
{{else if .Entity.MapValue }}// TODO: map via StringToStringVar: {{.Name}}
|
||||
{{else if .Entity.IsEmpty }}// TODO: output-only field
|
||||
{{else if .Entity.Enum }}{{$method.CamelName}}Cmd.Flags().Var(&{{$method.CamelName}}Req.{{.PascalName}}, "{{.KebabName}}", `{{.Summary | without "`"}}`)
|
||||
{{else}}{{$method.CamelName}}Cmd.Flags().{{template "arg-type" .Entity}}(&{{$method.CamelName}}Req.{{.PascalName}}, "{{.KebabName}}", {{$method.CamelName}}Req.{{.PascalName}}, `{{.Summary | without "`"}}`)
|
||||
{{end}}
|
||||
|
@ -75,10 +84,16 @@ func init() {
|
|||
{{- $hasRequiredArgs := and (not $hasIdPrompt) $hasPosArgs -}}
|
||||
var {{.CamelName}}Cmd = &cobra.Command{
|
||||
Use: "{{.KebabName}}{{if $hasPosArgs}}{{range .Request.RequiredFields}} {{.ConstantName}}{{end}}{{end}}",
|
||||
{{if .Description -}}
|
||||
Short: `{{.Summary | without "`"}}`,
|
||||
{{- if .Description }}
|
||||
Short: `{{.Summary | without "`"}}`,
|
||||
Long: `{{.Comment " " 80 | without "`"}}`,
|
||||
{{end}}
|
||||
{{- end }}
|
||||
{{- if .IsPrivatePreview }}
|
||||
|
||||
// This command is being previewed; hide from help output.
|
||||
Hidden: true,
|
||||
{{- end }}
|
||||
|
||||
Annotations: map[string]string{},{{if $hasRequiredArgs }}
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs({{len .Request.RequiredFields}})
|
||||
|
@ -118,46 +133,53 @@ var {{.CamelName}}Cmd = &cobra.Command{
|
|||
}
|
||||
{{- end -}}
|
||||
{{$method := .}}
|
||||
{{- range $arg, $field := .Request.RequiredFields}}
|
||||
{{if not $field.Entity.IsString -}}
|
||||
_, err = fmt.Sscan(args[{{$arg}}], &{{$method.CamelName}}Req.{{$field.PascalName}})
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid {{$field.ConstantName}}: %s", args[{{$arg}}])
|
||||
}{{else -}}
|
||||
{{$method.CamelName}}Req.{{$field.PascalName}} = args[{{$arg}}]
|
||||
{{- end -}}{{end}}
|
||||
{{- if .Request.IsAllRequiredFieldsPrimitive -}}
|
||||
{{- range $arg, $field := .Request.RequiredFields}}
|
||||
{{if not $field.Entity.IsString -}}
|
||||
_, err = fmt.Sscan(args[{{$arg}}], &{{$method.CamelName}}Req.{{$field.PascalName}})
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid {{$field.ConstantName}}: %s", args[{{$arg}}])
|
||||
}{{else -}}
|
||||
{{$method.CamelName}}Req.{{$field.PascalName}} = args[{{$arg}}]
|
||||
{{- end -}}{{end}}
|
||||
{{- else -}}
|
||||
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
||||
{{- end -}}
|
||||
}
|
||||
{{end}}
|
||||
{{if $wait -}}
|
||||
wait, err := {{if .Service.IsAccounts}}a{{else}}w{{end}}.{{.Service.PascalName}}.{{.PascalName}}(ctx{{if .Request}}, {{.CamelName}}Req{{end}})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if {{.CamelName}}SkipWait {
|
||||
{{template "method-call" .}}
|
||||
{{if .Response -}}
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
{{- else -}}
|
||||
return nil
|
||||
{{- end}}
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := {{if .Service.IsAccounts}}a{{else}}w{{end}}.{{.Service.PascalName}}.{{.PascalName}}AndWait(ctx{{if .Request}}, {{.CamelName}}Req{{end}},
|
||||
retries.Timeout[{{.Service.Package.Name}}.{{.Wait.Poll.Response.PascalName}}]({{.CamelName}}Timeout),
|
||||
func(i *retries.Info[{{.Service.Package.Name}}.{{.Wait.Poll.Response.PascalName}}]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
{{if .Wait.MessagePath -}}
|
||||
{{if .Wait.ComplexMessagePath -}}
|
||||
if i.Info.{{.Wait.MessagePathHead.PascalName}} == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info{{range .Wait.StatusPath}}.{{.PascalName}}{{end}}
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.{{.Wait.MessagePathHead.PascalName}} != nil {
|
||||
statusMessage = i.Info{{range .Wait.MessagePath}}.{{.PascalName}}{{end}}
|
||||
}
|
||||
{{- else -}}
|
||||
statusMessage := i.Info{{range .Wait.MessagePath}}.{{.PascalName}}{{end}}
|
||||
{{- end}}
|
||||
{{- else -}}
|
||||
status := i.Info{{range .Wait.StatusPath}}.{{.PascalName}}{{end}}
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
{{- end}}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *{{.Service.Package.Name}}.{{.Wait.Poll.Response.PascalName}}) {
|
||||
{{if .Wait.MessagePath -}}
|
||||
{{if .Wait.ComplexMessagePath -}}
|
||||
if i.{{.Wait.MessagePathHead.PascalName}} == nil {
|
||||
return
|
||||
}
|
||||
status := i{{range .Wait.StatusPath}}.{{.PascalName}}{{end}}
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.{{.Wait.MessagePathHead.PascalName}} != nil {
|
||||
statusMessage = i{{range .Wait.MessagePath}}.{{.PascalName}}{{end}}
|
||||
}
|
||||
{{- else -}}
|
||||
statusMessage := i{{range .Wait.MessagePath}}.{{.PascalName}}{{end}}
|
||||
{{- end}}
|
||||
{{- else -}}
|
||||
status := i{{range .Wait.StatusPath}}.{{.PascalName}}{{end}}
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
{{- end}}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout({{.CamelName}}Timeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -167,6 +189,9 @@ var {{.CamelName}}Cmd = &cobra.Command{
|
|||
{{template "method-call" .}}
|
||||
{{end -}}
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
{{end}}
|
||||
// end service {{.Name}}{{end}}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
cmd/account/access-control/access-control.go linguist-generated=true
|
||||
cmd/account/billable-usage/billable-usage.go linguist-generated=true
|
||||
cmd/account/budgets/budgets.go linguist-generated=true
|
||||
cmd/account/cmd.go linguist-generated=true
|
||||
|
@ -15,6 +16,7 @@ cmd/account/private-access/private-access.go linguist-generated=true
|
|||
cmd/account/published-app-integration/published-app-integration.go linguist-generated=true
|
||||
cmd/account/service-principal-secrets/service-principal-secrets.go linguist-generated=true
|
||||
cmd/account/service-principals/service-principals.go linguist-generated=true
|
||||
cmd/account/settings/settings.go linguist-generated=true
|
||||
cmd/account/storage-credentials/storage-credentials.go linguist-generated=true
|
||||
cmd/account/storage/storage.go linguist-generated=true
|
||||
cmd/account/users/users.go linguist-generated=true
|
||||
|
@ -26,6 +28,7 @@ cmd/workspace/catalogs/catalogs.go linguist-generated=true
|
|||
cmd/workspace/cluster-policies/cluster-policies.go linguist-generated=true
|
||||
cmd/workspace/clusters/clusters.go linguist-generated=true
|
||||
cmd/workspace/cmd.go linguist-generated=true
|
||||
cmd/workspace/connections/connections.go linguist-generated=true
|
||||
cmd/workspace/current-user/current-user.go linguist-generated=true
|
||||
cmd/workspace/dashboards/dashboards.go linguist-generated=true
|
||||
cmd/workspace/data-sources/data-sources.go linguist-generated=true
|
||||
|
@ -58,6 +61,7 @@ cmd/workspace/service-principals/service-principals.go linguist-generated=true
|
|||
cmd/workspace/serving-endpoints/serving-endpoints.go linguist-generated=true
|
||||
cmd/workspace/shares/shares.go linguist-generated=true
|
||||
cmd/workspace/storage-credentials/storage-credentials.go linguist-generated=true
|
||||
cmd/workspace/system-schemas/system-schemas.go linguist-generated=true
|
||||
cmd/workspace/table-constraints/table-constraints.go linguist-generated=true
|
||||
cmd/workspace/tables/tables.go linguist-generated=true
|
||||
cmd/workspace/token-management/token-management.go linguist-generated=true
|
||||
|
|
60
CHANGELOG.md
60
CHANGELOG.md
|
@ -1,5 +1,65 @@
|
|||
# Version changelog
|
||||
|
||||
## 0.100.4
|
||||
|
||||
CLI:
|
||||
* Add workspace import-dir command ([#456](https://github.com/databricks/cli/pull/456)).
|
||||
* Annotate generated commands with OpenAPI package name ([#466](https://github.com/databricks/cli/pull/466)).
|
||||
* Associate generated commands with command groups ([#475](https://github.com/databricks/cli/pull/475)).
|
||||
* Disable shell completions for generated commands ([#483](https://github.com/databricks/cli/pull/483)).
|
||||
* Include [DEFAULT] section header when writing ~/.databrickscfg ([#464](https://github.com/databricks/cli/pull/464)).
|
||||
* Pass through proxy related environment variables ([#465](https://github.com/databricks/cli/pull/465)).
|
||||
* Restore flags to original values on test completion ([#470](https://github.com/databricks/cli/pull/470)).
|
||||
* Update configure command ([#482](https://github.com/databricks/cli/pull/482)).
|
||||
|
||||
Dependencies:
|
||||
* Bump SDK to latest ([#473](https://github.com/databricks/cli/pull/473)).
|
||||
|
||||
## 0.100.3
|
||||
|
||||
CLI:
|
||||
* Add directory tracking to sync ([#425](https://github.com/databricks/cli/pull/425)).
|
||||
* Add fs cat command for dbfs files ([#430](https://github.com/databricks/cli/pull/430)).
|
||||
* Add fs ls command for dbfs ([#429](https://github.com/databricks/cli/pull/429)).
|
||||
* Add fs mkdirs command for dbfs ([#432](https://github.com/databricks/cli/pull/432)).
|
||||
* Add fs rm command for dbfs ([#433](https://github.com/databricks/cli/pull/433)).
|
||||
* Add installation instructions ([#458](https://github.com/databricks/cli/pull/458)).
|
||||
* Add new line to cmdio JSON rendering ([#443](https://github.com/databricks/cli/pull/443)).
|
||||
* Add profile on `databricks auth login` ([#423](https://github.com/databricks/cli/pull/423)).
|
||||
* Add readable console logger ([#370](https://github.com/databricks/cli/pull/370)).
|
||||
* Add workspace export-dir command ([#449](https://github.com/databricks/cli/pull/449)).
|
||||
* Added secrets input prompt for secrets put-secret command ([#413](https://github.com/databricks/cli/pull/413)).
|
||||
* Added spinner when loading command prompts ([#420](https://github.com/databricks/cli/pull/420)).
|
||||
* Better error message if can not load prompts ([#437](https://github.com/databricks/cli/pull/437)).
|
||||
* Changed service template to correctly handle required positional arguments ([#405](https://github.com/databricks/cli/pull/405)).
|
||||
* Do not generate prompts for certain commands ([#438](https://github.com/databricks/cli/pull/438)).
|
||||
* Do not prompt for List methods ([#411](https://github.com/databricks/cli/pull/411)).
|
||||
* Do not use FgWhite and FgBlack for terminal output ([#435](https://github.com/databricks/cli/pull/435)).
|
||||
* Skip path translation of job task for jobs with a Git source ([#404](https://github.com/databricks/cli/pull/404)).
|
||||
* Tweak profile prompt ([#454](https://github.com/databricks/cli/pull/454)).
|
||||
* Update with the latest Go SDK ([#457](https://github.com/databricks/cli/pull/457)).
|
||||
* Use cmdio in version command for `--output` flag ([#419](https://github.com/databricks/cli/pull/419)).
|
||||
|
||||
Bundles:
|
||||
* Check for nil environment before accessing it ([#453](https://github.com/databricks/cli/pull/453)).
|
||||
|
||||
Dependencies:
|
||||
* Bump github.com/hashicorp/terraform-json from 0.16.0 to 0.17.0 ([#459](https://github.com/databricks/cli/pull/459)).
|
||||
* Bump github.com/mattn/go-isatty from 0.0.18 to 0.0.19 ([#412](https://github.com/databricks/cli/pull/412)).
|
||||
|
||||
Internal:
|
||||
* Add Mkdir and ReadDir functions to filer.Filer interface ([#414](https://github.com/databricks/cli/pull/414)).
|
||||
* Add Stat function to filer.Filer interface ([#421](https://github.com/databricks/cli/pull/421)).
|
||||
* Add check for path is a directory in filer.ReadDir ([#426](https://github.com/databricks/cli/pull/426)).
|
||||
* Add fs.FS adapter for the filer interface ([#422](https://github.com/databricks/cli/pull/422)).
|
||||
* Add implementation of filer.Filer for local filesystem ([#460](https://github.com/databricks/cli/pull/460)).
|
||||
* Allow equivalence checking of filer errors to fs errors ([#416](https://github.com/databricks/cli/pull/416)).
|
||||
* Fix locker integration test ([#417](https://github.com/databricks/cli/pull/417)).
|
||||
* Implement DBFS filer ([#139](https://github.com/databricks/cli/pull/139)).
|
||||
* Include recursive deletion in filer interface ([#442](https://github.com/databricks/cli/pull/442)).
|
||||
* Make filer.Filer return fs.DirEntry from ReadDir ([#415](https://github.com/databricks/cli/pull/415)).
|
||||
* Speed up sync integration tests ([#428](https://github.com/databricks/cli/pull/428)).
|
||||
|
||||
## 0.100.2
|
||||
|
||||
CLI:
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
DB license
|
||||
|
||||
Copyright (2022) Databricks, Inc.
|
||||
|
||||
Definitions.
|
||||
|
||||
Agreement: The agreement between Databricks, Inc., and you governing the use of the Databricks Services, which shall be, with respect to Databricks, the Databricks Terms of Service located at www.databricks.com/termsofservice, and with respect to Databricks Community Edition, the Community Edition Terms of Service located at www.databricks.com/ce-termsofuse, in each case unless you have entered into a separate written agreement with Databricks governing the use of the applicable Databricks Services.
|
||||
|
||||
Software: The source code and object code to which this license applies.
|
||||
|
||||
Scope of Use. You may not use this Software except in connection with your use of the Databricks Services pursuant to the Agreement. Your use of the Software must comply at all times with any restrictions applicable to the Databricks Services, generally, and must be used in accordance with any applicable documentation. You may view, use, copy, modify, publish, and/or distribute the Software solely for the purposes of using the code within or connecting to the Databricks Services. If you do not agree to these terms, you may not view, use, copy, modify, publish, and/or distribute the Software.
|
||||
|
||||
Redistribution. You may redistribute and sublicense the Software so long as all use is in compliance with these terms. In addition:
|
||||
|
||||
You must give any other recipients a copy of this License;
|
||||
You must cause any modified files to carry prominent notices stating that you changed the files;
|
||||
You must retain, in the source code form of any derivative works that you distribute, all copyright, patent, trademark, and attribution notices from the source code form, excluding those notices that do not pertain to any part of the derivative works; and
|
||||
If the source code form includes a "NOTICE" text file as part of its distribution, then any derivative works that you distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the derivative works.
|
||||
You may add your own copyright statement to your modifications and may provide additional license terms and conditions for use, reproduction, or distribution of your modifications, or for any such derivative works as a whole, provided your use, reproduction, and distribution of the Software otherwise complies with the conditions stated in this License.
|
||||
|
||||
Termination. This license terminates automatically upon your breach of these terms or upon the termination of your Agreement. Additionally, Databricks may terminate this license at any time on notice. Upon termination, you must permanently delete the Software and all copies thereof.
|
||||
|
||||
DISCLAIMER; LIMITATION OF LIABILITY.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS-IS” AND WITH ALL FAULTS. DATABRICKS, ON BEHALF OF ITSELF AND ITS LICENSORS, SPECIFICALLY DISCLAIMS ALL WARRANTIES RELATING TO THE SOURCE CODE, EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES, CONDITIONS AND OTHER TERMS OF MERCHANTABILITY, SATISFACTORY QUALITY OR FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. DATABRICKS AND ITS LICENSORS TOTAL AGGREGATE LIABILITY RELATING TO OR ARISING OUT OF YOUR USE OF OR DATABRICKS’ PROVISIONING OF THE SOURCE CODE SHALL BE LIMITED TO ONE THOUSAND ($1,000) DOLLARS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,100 @@
|
|||
Copyright (2023) Databricks, Inc.
|
||||
|
||||
This Software includes software developed at Databricks (https://www.databricks.com/) and its use is subject to the included LICENSE file.
|
||||
|
||||
This Software contains code from the following open source projects, licensed under the Apache 2.0 license:
|
||||
|
||||
spf13/cobra - https://github.com/spf13/cobra
|
||||
Copyright cobra authors
|
||||
License - https://github.com/spf13/cobra/blob/main/LICENSE.txt
|
||||
|
||||
briandowns/spinner - https://github.com/briandowns/spinner
|
||||
Copyright 2022 Brian J. Downs
|
||||
License - https://github.com/briandowns/spinner/blob/master/LICENSE
|
||||
|
||||
go-ini/ini - https://github.com/go-ini/ini
|
||||
Copyright ini authors
|
||||
License - https://github.com/go-ini/ini/blob/main/LICENSE
|
||||
|
||||
—--
|
||||
|
||||
This software contains code from the following open source projects, licensed under the MPL 2.0 license:
|
||||
|
||||
hashicopr/go-version - https://github.com/hashicorp/go-version
|
||||
Copyright 2014 HashiCorp, Inc.
|
||||
License - https://github.com/hashicorp/go-version/blob/main/LICENSE
|
||||
|
||||
hashicorp/hc-install - https://github.com/hashicorp/hc-install
|
||||
Copyright 2020 HashiCorp, Inc.
|
||||
License - https://github.com/hashicorp/hc-install/blob/main/LICENSE
|
||||
|
||||
hashicopr/terraform-exec - https://github.com/hashicorp/terraform-exec
|
||||
Copyright 2020 HashiCorp, Inc.
|
||||
LIcense - https://github.com/hashicorp/terraform-exec/blob/main/LICENSE
|
||||
|
||||
hashicorp/terraform-json - https://github.com/hashicorp/terraform-json
|
||||
Copyright 2019 HashiCorp, Inc.
|
||||
License - https://github.com/hashicorp/terraform-json/blob/main/LICENSE
|
||||
|
||||
---
|
||||
|
||||
This software contains code from the following open source projects, licensed under the BSD (2-clause) license:
|
||||
|
||||
pkg/browser - https://github.com/pkg/browser
|
||||
Copyright (c) 2014, Dave Cheney <dave@cheney.net>
|
||||
License - https://github.com/pkg/browser/blob/master/LICENSE
|
||||
|
||||
---
|
||||
|
||||
This software contains code from the following open source projects, licensed under the BSD (3-clause) license:
|
||||
|
||||
spf13/pflag - https://github.com/spf13/pflag
|
||||
Copyright (c) 2012 Alex Ogier. All rights reserved.
|
||||
Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||
License - https://raw.githubusercontent.com/spf13/pflag/master/LICENSE
|
||||
|
||||
google/uuid - https://github.com/google/uuid
|
||||
Copyright (c) 2009,2014 Google Inc. All rights reserved.
|
||||
License - https://github.com/google/uuid/blob/master/LICENSE
|
||||
|
||||
imdario/mergo - https://github.com/imdario/mergo
|
||||
Copyright (c) 2013 Dario Castañé. All rights reserved.
|
||||
Copyright (c) 2012 The Go Authors. All rights reserved.
|
||||
License - https://github.com/imdario/mergo/blob/master/LICENSE
|
||||
|
||||
manifoldco/promptui - https://github.com/manifoldco/promptui
|
||||
Copyright (c) 2017, Arigato Machine Inc. All rights reserved.
|
||||
License - https://github.com/manifoldco/promptui/blob/master/LICENSE.md
|
||||
|
||||
—--
|
||||
|
||||
This Software contains code from the following open source projects, licensed under the MIT license:
|
||||
|
||||
fatih/color - https://github.com/fatih/color
|
||||
Copyright (c) 2013 Fatih Arslan
|
||||
License - https://github.com/fatih/color/blob/main/LICENSE.md
|
||||
|
||||
ghodss/yaml - https://github.com/ghodss/yaml
|
||||
Copyright (c) 2014 Sam Ghods
|
||||
License - https://github.com/ghodss/yaml/blob/master/LICENSE
|
||||
|
||||
mattn/go-isatty - https://github.com/mattn/go-isatty
|
||||
Copyright (c) Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
|
||||
https://github.com/mattn/go-isatty/blob/master/LICENSE
|
||||
|
||||
nwidger/jsoncolor - https://github.com/nwidger/jsoncolor
|
||||
Copyright (c) 2016 Niels Widger
|
||||
License - https://github.com/nwidger/jsoncolor/blob/master/LICENSE
|
||||
|
||||
sabhiram/go-gitignore - https://github.com/sabhiram/go-gitignore
|
||||
Copyright (c) 2015 Shaba Abhiram
|
||||
License - https://github.com/sabhiram/go-gitignore/blob/master/LICENSE
|
||||
|
||||
|
||||
stretchr/testify - https://github.com/stretchr/testify
|
||||
Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors.
|
||||
License - https://github.com/stretchr/testify/blob/master/LICENSE
|
||||
|
||||
whilp/git-urls - https://github.com/whilp/git-urls
|
||||
Copyright (c) 2020 Will Maier
|
||||
License - https://github.com/whilp/git-urls/blob/master/LICENSE
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![build](https://github.com/databricks/cli/workflows/build/badge.svg?branch=main)](https://github.com/databricks/cli/actions?query=workflow%3Abuild+branch%3Amain)
|
||||
|
||||
This project is in private preview.
|
||||
This project is in public preview.
|
||||
|
||||
Documentation about the full REST API coverage is avaialbe in the [docs folder](docs/commands.md).
|
||||
|
||||
|
@ -11,10 +11,9 @@ Documentation is available at https://docs.databricks.com/dev-tools/cli/databric
|
|||
## Installation
|
||||
|
||||
This CLI is packaged as a dependency-free binary executable and may be located in any directory.
|
||||
|
||||
For convenient access, copy the `databricks` binary to any directory listed in `$PATH`.
|
||||
|
||||
Confirm the binary works by executing `databricks version`.
|
||||
See https://github.com/databricks/cli/releases for releases and
|
||||
[the docs pages](https://docs.databricks.com/dev-tools/cli/databricks-cli.html) for
|
||||
installation instructions.
|
||||
|
||||
## Authentication
|
||||
|
||||
|
|
|
@ -103,6 +103,21 @@ func setTempDirEnvVars(env map[string]string, b *bundle.Bundle) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// This function passes through all proxy related environment variables.
|
||||
func setProxyEnvVars(env map[string]string, b *bundle.Bundle) error {
|
||||
for _, v := range []string{"http_proxy", "https_proxy", "no_proxy"} {
|
||||
// The case (upper or lower) is notoriously inconsistent for tools on Unix systems.
|
||||
// We therefore try to read both the upper and lower case versions of the variable.
|
||||
for _, v := range []string{strings.ToUpper(v), strings.ToLower(v)} {
|
||||
if val, ok := os.LookupEnv(v); ok {
|
||||
// Only set uppercase version of the variable.
|
||||
env[strings.ToUpper(v)] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *initialize) Apply(ctx context.Context, b *bundle.Bundle) error {
|
||||
tfConfig := b.Config.Bundle.Terraform
|
||||
if tfConfig == nil {
|
||||
|
@ -142,6 +157,12 @@ func (m *initialize) Apply(ctx context.Context, b *bundle.Bundle) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Set the proxy related environment variables
|
||||
err = setProxyEnvVars(env, b)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Configure environment variables for auth for Terraform to use.
|
||||
log.Debugf(ctx, "Environment variables for Terraform: %s", strings.Join(maps.Keys(env), ", "))
|
||||
err = tf.SetEnv(env)
|
||||
|
|
|
@ -5,12 +5,14 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/databricks/cli/bundle"
|
||||
"github.com/databricks/cli/bundle/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
func unsetEnv(t *testing.T, name string) {
|
||||
|
@ -222,3 +224,51 @@ func TestSetTempDirEnvVarsForWindowsWithoutAnyTempDirEnvVarsSet(t *testing.T) {
|
|||
"TMP": tmpDir,
|
||||
}, env)
|
||||
}
|
||||
|
||||
func TestSetProxyEnvVars(t *testing.T) {
|
||||
b := &bundle.Bundle{
|
||||
Config: config.Root{
|
||||
Path: t.TempDir(),
|
||||
Bundle: config.Bundle{
|
||||
Environment: "whatever",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Temporarily clear environment variables.
|
||||
clearEnv := func() {
|
||||
for _, v := range []string{"http_proxy", "https_proxy", "no_proxy"} {
|
||||
for _, v := range []string{strings.ToUpper(v), strings.ToLower(v)} {
|
||||
t.Setenv(v, "foo")
|
||||
os.Unsetenv(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// No proxy env vars set.
|
||||
clearEnv()
|
||||
env := make(map[string]string, 0)
|
||||
err := setProxyEnvVars(env, b)
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, env, 0)
|
||||
|
||||
// Lower case set.
|
||||
clearEnv()
|
||||
t.Setenv("http_proxy", "foo")
|
||||
t.Setenv("https_proxy", "foo")
|
||||
t.Setenv("no_proxy", "foo")
|
||||
env = make(map[string]string, 0)
|
||||
err = setProxyEnvVars(env, b)
|
||||
require.NoError(t, err)
|
||||
assert.ElementsMatch(t, []string{"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY"}, maps.Keys(env))
|
||||
|
||||
// Upper case set.
|
||||
clearEnv()
|
||||
t.Setenv("HTTP_PROXY", "foo")
|
||||
t.Setenv("HTTPS_PROXY", "foo")
|
||||
t.Setenv("NO_PROXY", "foo")
|
||||
env = make(map[string]string, 0)
|
||||
err = setProxyEnvVars(env, b)
|
||||
require.NoError(t, err)
|
||||
assert.ElementsMatch(t, []string{"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY"}, maps.Keys(env))
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@ package deployer
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/databricks/cli/libs/locker"
|
||||
"github.com/databricks/cli/libs/log"
|
||||
|
@ -97,22 +99,24 @@ func (b *Deployer) tfStateLocalPath() string {
|
|||
return filepath.Join(b.DefaultTerraformRoot(), "terraform.tfstate")
|
||||
}
|
||||
|
||||
func (b *Deployer) LoadTerraformState(ctx context.Context) error {
|
||||
bytes, err := b.locker.GetRawJsonFileContent(ctx, b.tfStateRemotePath())
|
||||
if err != nil {
|
||||
func (d *Deployer) LoadTerraformState(ctx context.Context) error {
|
||||
r, err := d.locker.Read(ctx, d.tfStateRemotePath())
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
// If remote tf state is absent, use local tf state
|
||||
if strings.Contains(err.Error(), "File not found.") {
|
||||
return nil
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
err = os.MkdirAll(b.DefaultTerraformRoot(), os.ModeDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.WriteFile(b.tfStateLocalPath(), bytes, os.ModePerm)
|
||||
return err
|
||||
err = os.MkdirAll(d.DefaultTerraformRoot(), os.ModeDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(d.tfStateLocalPath(), b, os.ModePerm)
|
||||
}
|
||||
|
||||
func (b *Deployer) SaveTerraformState(ctx context.Context) error {
|
||||
|
@ -120,7 +124,7 @@ func (b *Deployer) SaveTerraformState(ctx context.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return b.locker.PutFile(ctx, b.tfStateRemotePath(), bytes)
|
||||
return b.locker.Write(ctx, b.tfStateRemotePath(), bytes)
|
||||
}
|
||||
|
||||
func (d *Deployer) Lock(ctx context.Context, isForced bool) error {
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"github.com/databricks/cli/bundle/run/progress"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/log"
|
||||
"github.com/databricks/databricks-sdk-go/retries"
|
||||
"github.com/databricks/databricks-sdk-go/service/jobs"
|
||||
"github.com/fatih/color"
|
||||
flag "github.com/spf13/pflag"
|
||||
|
@ -145,27 +144,17 @@ func (r *jobRunner) logFailedTasks(ctx context.Context, runId int64) {
|
|||
}
|
||||
}
|
||||
|
||||
func pullRunIdCallback(runId *int64) func(info *retries.Info[jobs.Run]) {
|
||||
return func(info *retries.Info[jobs.Run]) {
|
||||
i := info.Info
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
|
||||
func pullRunIdCallback(runId *int64) func(info *jobs.Run) {
|
||||
return func(i *jobs.Run) {
|
||||
if *runId == 0 {
|
||||
*runId = i.RunId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func logDebugCallback(ctx context.Context, runId *int64) func(info *retries.Info[jobs.Run]) {
|
||||
func logDebugCallback(ctx context.Context, runId *int64) func(info *jobs.Run) {
|
||||
var prevState *jobs.RunState
|
||||
return func(info *retries.Info[jobs.Run]) {
|
||||
i := info.Info
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
|
||||
return func(i *jobs.Run) {
|
||||
state := i.State
|
||||
if state == nil {
|
||||
return
|
||||
|
@ -173,23 +162,18 @@ func logDebugCallback(ctx context.Context, runId *int64) func(info *retries.Info
|
|||
|
||||
// Log the job run URL as soon as it is available.
|
||||
if prevState == nil {
|
||||
log.Infof(ctx, "Run available at %s", info.Info.RunPageUrl)
|
||||
log.Infof(ctx, "Run available at %s", i.RunPageUrl)
|
||||
}
|
||||
if prevState == nil || prevState.LifeCycleState != state.LifeCycleState {
|
||||
log.Infof(ctx, "Run status: %s", info.Info.State.LifeCycleState)
|
||||
log.Infof(ctx, "Run status: %s", i.State.LifeCycleState)
|
||||
prevState = state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func logProgressCallback(ctx context.Context, progressLogger *cmdio.Logger) func(info *retries.Info[jobs.Run]) {
|
||||
func logProgressCallback(ctx context.Context, progressLogger *cmdio.Logger) func(info *jobs.Run) {
|
||||
var prevState *jobs.RunState
|
||||
return func(info *retries.Info[jobs.Run]) {
|
||||
i := info.Info
|
||||
if i == nil {
|
||||
return
|
||||
}
|
||||
|
||||
return func(i *jobs.Run) {
|
||||
state := i.State
|
||||
if state == nil {
|
||||
return
|
||||
|
@ -255,20 +239,24 @@ func (r *jobRunner) Run(ctx context.Context, opts *Options) (output.RunOutput, e
|
|||
}
|
||||
logProgress := logProgressCallback(ctx, progressLogger)
|
||||
|
||||
waiter, err := w.Jobs.RunNow(ctx, *req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot start job")
|
||||
}
|
||||
|
||||
if opts.NoWait {
|
||||
run, err := w.Jobs.RunNow(ctx, *req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
details, err := w.Jobs.GetRun(ctx, jobs.GetRunRequest{
|
||||
RunId: run.RunId,
|
||||
RunId: waiter.RunId,
|
||||
})
|
||||
progressLogger.Log(progress.NewJobRunUrlEvent(details.RunPageUrl))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
run, err := w.Jobs.RunNowAndWait(ctx, *req,
|
||||
retries.Timeout[jobs.Run](jobRunTimeout), pullRunId, logDebug, logProgress)
|
||||
run, err := waiter.OnProgress(func(r *jobs.Run) {
|
||||
pullRunId(r)
|
||||
logDebug(r)
|
||||
logProgress(r)
|
||||
}).GetWithTimeout(jobRunTimeout)
|
||||
if err != nil && runId != nil {
|
||||
r.logFailedTasks(ctx, *runId)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
||||
|
||||
package access_control
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/service/iam"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var Cmd = &cobra.Command{
|
||||
Use: "access-control",
|
||||
Short: `These APIs manage access rules on resources in an account.`,
|
||||
Long: `These APIs manage access rules on resources in an account. Currently, only
|
||||
grant rules are supported. A grant rule specifies a role assigned to a set of
|
||||
principals. A list of rules attached to a resource is called a rule set.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
|
||||
// This service is being previewed; hide from help output.
|
||||
Hidden: true,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
||||
var getReq iam.GetAccountAccessControlRequest
|
||||
var getJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(getCmd)
|
||||
// TODO: short flags
|
||||
getCmd.Flags().Var(&getJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
}
|
||||
|
||||
var getCmd = &cobra.Command{
|
||||
Use: "get NAME ETAG",
|
||||
Short: `Get a rule set.`,
|
||||
Long: `Get a rule set.
|
||||
|
||||
Get a rule set by its name. A rule set is always attached to a resource and
|
||||
contains a list of access rules on the said resource. Currently only a default
|
||||
rule set for each resource is supported.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(2)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustAccountClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
a := root.AccountClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = getJson.Unmarshal(&getReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
getReq.Name = args[0]
|
||||
getReq.Etag = args[1]
|
||||
}
|
||||
|
||||
response, err := a.AccessControl.Get(ctx, getReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
||||
var listReq iam.ListAccountAccessControlRequest
|
||||
var listJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(listCmd)
|
||||
// TODO: short flags
|
||||
listCmd.Flags().Var(&listJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
}
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list NAME",
|
||||
Short: `List assignable roles on a resource.`,
|
||||
Long: `List assignable roles on a resource.
|
||||
|
||||
Gets all the roles that can be granted on an account level resource. A role is
|
||||
grantable if the rule set on the resource can contain an access rule of the
|
||||
role.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(1)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustAccountClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
a := root.AccountClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = listJson.Unmarshal(&listReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
listReq.Name = args[0]
|
||||
}
|
||||
|
||||
response, err := a.AccessControl.List(ctx, listReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
||||
var updateReq iam.UpdateRuleSetRequest
|
||||
var updateJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(updateCmd)
|
||||
// TODO: short flags
|
||||
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
}
|
||||
|
||||
var updateCmd = &cobra.Command{
|
||||
Use: "update",
|
||||
Short: `Update a rule set.`,
|
||||
Long: `Update a rule set.
|
||||
|
||||
Replace the rules of a rule set. First, use get to read the current version of
|
||||
the rule set before modifying it. This pattern helps prevent conflicts between
|
||||
concurrent updates.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustAccountClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
a := root.AccountClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = updateJson.Unmarshal(&updateReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
updateReq.Name = args[0]
|
||||
_, err = fmt.Sscan(args[1], &updateReq.RuleSet)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid RULE_SET: %s", args[1])
|
||||
}
|
||||
updateReq.Etag = args[2]
|
||||
}
|
||||
|
||||
response, err := a.AccessControl.Update(ctx, updateReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountAccessControl
|
|
@ -14,6 +14,9 @@ var Cmd = &cobra.Command{
|
|||
Short: `This API allows you to download billable usage logs for the specified account and date range.`,
|
||||
Long: `This API allows you to download billable usage logs for the specified account
|
||||
and date range. This feature works with all account types.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "billing",
|
||||
},
|
||||
}
|
||||
|
||||
// start download command
|
||||
|
@ -69,6 +72,9 @@ var downloadCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service BillableUsage
|
||||
|
|
|
@ -17,6 +17,12 @@ var Cmd = &cobra.Command{
|
|||
Short: `These APIs manage budget configuration including notifications for exceeding a budget for a period.`,
|
||||
Long: `These APIs manage budget configuration including notifications for exceeding a
|
||||
budget for a period. They can also retrieve the status of each budget.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "billing",
|
||||
},
|
||||
|
||||
// This service is being previewed; hide from help output.
|
||||
Hidden: true,
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -49,10 +55,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
_, err = fmt.Sscan(args[0], &createReq.Budget)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid BUDGET: %s", args[0])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := a.Budgets.Create(ctx, createReq)
|
||||
|
@ -61,6 +64,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -119,6 +125,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -178,6 +187,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -206,6 +218,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -239,11 +254,7 @@ var updateCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
_, err = fmt.Sscan(args[0], &updateReq.Budget)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid BUDGET: %s", args[0])
|
||||
}
|
||||
updateReq.BudgetId = args[1]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = a.Budgets.Update(ctx, updateReq)
|
||||
|
@ -252,6 +263,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Budgets
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
account_access_control "github.com/databricks/cli/cmd/account/access-control"
|
||||
billable_usage "github.com/databricks/cli/cmd/account/billable-usage"
|
||||
budgets "github.com/databricks/cli/cmd/account/budgets"
|
||||
credentials "github.com/databricks/cli/cmd/account/credentials"
|
||||
|
@ -22,6 +23,7 @@ import (
|
|||
published_app_integration "github.com/databricks/cli/cmd/account/published-app-integration"
|
||||
service_principal_secrets "github.com/databricks/cli/cmd/account/service-principal-secrets"
|
||||
account_service_principals "github.com/databricks/cli/cmd/account/service-principals"
|
||||
account_settings "github.com/databricks/cli/cmd/account/settings"
|
||||
storage "github.com/databricks/cli/cmd/account/storage"
|
||||
account_storage_credentials "github.com/databricks/cli/cmd/account/storage-credentials"
|
||||
account_users "github.com/databricks/cli/cmd/account/users"
|
||||
|
@ -38,6 +40,7 @@ var accountCmd = &cobra.Command{
|
|||
func init() {
|
||||
root.RootCmd.AddCommand(accountCmd)
|
||||
|
||||
accountCmd.AddCommand(account_access_control.Cmd)
|
||||
accountCmd.AddCommand(billable_usage.Cmd)
|
||||
accountCmd.AddCommand(budgets.Cmd)
|
||||
accountCmd.AddCommand(credentials.Cmd)
|
||||
|
@ -54,10 +57,38 @@ func init() {
|
|||
accountCmd.AddCommand(published_app_integration.Cmd)
|
||||
accountCmd.AddCommand(service_principal_secrets.Cmd)
|
||||
accountCmd.AddCommand(account_service_principals.Cmd)
|
||||
accountCmd.AddCommand(account_settings.Cmd)
|
||||
accountCmd.AddCommand(storage.Cmd)
|
||||
accountCmd.AddCommand(account_storage_credentials.Cmd)
|
||||
accountCmd.AddCommand(account_users.Cmd)
|
||||
accountCmd.AddCommand(vpc_endpoints.Cmd)
|
||||
accountCmd.AddCommand(workspace_assignment.Cmd)
|
||||
accountCmd.AddCommand(workspaces.Cmd)
|
||||
|
||||
// Register commands with groups
|
||||
account_access_control.Cmd.GroupID = "iam"
|
||||
billable_usage.Cmd.GroupID = "billing"
|
||||
budgets.Cmd.GroupID = "billing"
|
||||
credentials.Cmd.GroupID = "provisioning"
|
||||
custom_app_integration.Cmd.GroupID = "oauth2"
|
||||
encryption_keys.Cmd.GroupID = "provisioning"
|
||||
account_groups.Cmd.GroupID = "iam"
|
||||
account_ip_access_lists.Cmd.GroupID = "settings"
|
||||
log_delivery.Cmd.GroupID = "billing"
|
||||
account_metastore_assignments.Cmd.GroupID = "catalog"
|
||||
account_metastores.Cmd.GroupID = "catalog"
|
||||
networks.Cmd.GroupID = "provisioning"
|
||||
o_auth_enrollment.Cmd.GroupID = "oauth2"
|
||||
private_access.Cmd.GroupID = "provisioning"
|
||||
published_app_integration.Cmd.GroupID = "oauth2"
|
||||
service_principal_secrets.Cmd.GroupID = "oauth2"
|
||||
account_service_principals.Cmd.GroupID = "iam"
|
||||
account_settings.Cmd.GroupID = "settings"
|
||||
storage.Cmd.GroupID = "provisioning"
|
||||
account_storage_credentials.Cmd.GroupID = "catalog"
|
||||
account_users.Cmd.GroupID = "iam"
|
||||
vpc_endpoints.Cmd.GroupID = "provisioning"
|
||||
workspace_assignment.Cmd.GroupID = "iam"
|
||||
workspaces.Cmd.GroupID = "provisioning"
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@ var Cmd = &cobra.Command{
|
|||
Databricks can deploy clusters in the appropriate VPC for the new workspace. A
|
||||
credential configuration encapsulates this role information, and its ID is
|
||||
used when creating a new workspace.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "provisioning",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -65,11 +68,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.CredentialsName = args[0]
|
||||
_, err = fmt.Sscan(args[1], &createReq.AwsCredentials)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid AWS_CREDENTIALS: %s", args[1])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := a.Credentials.Create(ctx, createReq)
|
||||
|
@ -78,6 +77,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -138,6 +140,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -197,6 +202,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -225,6 +233,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Credentials
|
||||
|
|
|
@ -22,6 +22,9 @@ var Cmd = &cobra.Command{
|
|||
**Note:** You can only add/use the OAuth custom application integrations when
|
||||
OAuth enrollment status is enabled. For more details see
|
||||
:method:OAuthEnrollment/create`,
|
||||
Annotations: map[string]string{
|
||||
"package": "oauth2",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -60,11 +63,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.Name = args[0]
|
||||
_, err = fmt.Sscan(args[1], &createReq.RedirectUrls)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid REDIRECT_URLS: %s", args[1])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := a.CustomAppIntegration.Create(ctx, createReq)
|
||||
|
@ -73,6 +72,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -122,6 +124,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -170,6 +175,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -198,6 +206,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -250,6 +261,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service CustomAppIntegration
|
||||
|
|
|
@ -31,6 +31,9 @@ var Cmd = &cobra.Command{
|
|||
encryption requires that the workspace is on the E2 version of the platform.
|
||||
If you have an older workspace, it might not be on the E2 version of the
|
||||
platform. If you are not sure, contact your Databricks representative.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "provisioning",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -82,10 +85,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
_, err = fmt.Sscan(args[0], &createReq.UseCases)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid USE_CASES: %s", args[0])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := a.EncryptionKeys.Create(ctx, createReq)
|
||||
|
@ -94,6 +94,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -143,6 +146,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -205,6 +211,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -244,6 +253,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service EncryptionKeys
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package account
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
// Groups returns an ordered list of command groups.
|
||||
// The order matches the order used in the Databricks API explorer.
|
||||
func Groups() []cobra.Group {
|
||||
return []cobra.Group{
|
||||
{
|
||||
ID: "iam",
|
||||
Title: "Identity and Access Management",
|
||||
},
|
||||
{
|
||||
ID: "catalog",
|
||||
Title: "Unity Catalog",
|
||||
},
|
||||
{
|
||||
ID: "settings",
|
||||
Title: "Settings",
|
||||
},
|
||||
{
|
||||
ID: "provisioning",
|
||||
Title: "Provisioning",
|
||||
},
|
||||
{
|
||||
ID: "billing",
|
||||
Title: "Billing",
|
||||
},
|
||||
{
|
||||
ID: "oauth2",
|
||||
Title: "OAuth",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Register groups with parent command
|
||||
groups := Groups()
|
||||
for i := range groups {
|
||||
accountCmd.AddGroup(&groups[i])
|
||||
}
|
||||
}
|
|
@ -22,6 +22,9 @@ var Cmd = &cobra.Command{
|
|||
in Unity Catalog to groups, instead of to users individually. All Databricks
|
||||
account identities can be assigned as members of groups, and members inherit
|
||||
permissions that are assigned to their group.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -78,6 +81,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -136,6 +142,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -194,6 +203,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -249,6 +261,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start patch command
|
||||
|
@ -309,6 +324,9 @@ var patchCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -375,6 +393,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountGroups
|
||||
|
|
|
@ -37,6 +37,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
After changes to the account-level IP access lists, it can take a few minutes
|
||||
for changes to take effect.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "settings",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -82,15 +85,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.Label = args[0]
|
||||
_, err = fmt.Sscan(args[1], &createReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[1])
|
||||
}
|
||||
_, err = fmt.Sscan(args[2], &createReq.IpAddresses)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid IP_ADDRESSES: %s", args[2])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := a.IpAccessLists.Create(ctx, createReq)
|
||||
|
@ -99,6 +94,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -157,6 +155,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -215,6 +216,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -242,6 +246,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start replace command
|
||||
|
@ -285,20 +292,7 @@ var replaceCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
replaceReq.Label = args[0]
|
||||
_, err = fmt.Sscan(args[1], &replaceReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[1])
|
||||
}
|
||||
_, err = fmt.Sscan(args[2], &replaceReq.IpAddresses)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid IP_ADDRESSES: %s", args[2])
|
||||
}
|
||||
_, err = fmt.Sscan(args[3], &replaceReq.Enabled)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ENABLED: %s", args[3])
|
||||
}
|
||||
replaceReq.IpAccessListId = args[4]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = a.IpAccessLists.Replace(ctx, replaceReq)
|
||||
|
@ -307,6 +301,9 @@ var replaceCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -354,20 +351,7 @@ var updateCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
updateReq.Label = args[0]
|
||||
_, err = fmt.Sscan(args[1], &updateReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[1])
|
||||
}
|
||||
_, err = fmt.Sscan(args[2], &updateReq.IpAddresses)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid IP_ADDRESSES: %s", args[2])
|
||||
}
|
||||
_, err = fmt.Sscan(args[3], &updateReq.Enabled)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ENABLED: %s", args[3])
|
||||
}
|
||||
updateReq.IpAccessListId = args[4]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = a.IpAccessLists.Update(ctx, updateReq)
|
||||
|
@ -376,6 +360,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountIpAccessLists
|
||||
|
|
|
@ -75,6 +75,9 @@ var Cmd = &cobra.Command{
|
|||
[Billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html
|
||||
[Usage page]: https://docs.databricks.com/administration-guide/account-settings/usage.html
|
||||
[create a new AWS S3 bucket]: https://docs.databricks.com/administration-guide/account-api/aws-storage.html`,
|
||||
Annotations: map[string]string{
|
||||
"package": "billing",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -149,6 +152,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -208,6 +214,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -260,6 +269,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start patch-status command
|
||||
|
@ -316,6 +328,9 @@ var patchStatusCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service LogDelivery
|
||||
|
|
|
@ -16,11 +16,14 @@ var Cmd = &cobra.Command{
|
|||
Use: "metastore-assignments",
|
||||
Short: `These APIs manage metastore assignments to a workspace.`,
|
||||
Long: `These APIs manage metastore assignments to a workspace.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
||||
var createReq catalog.CreateMetastoreAssignment
|
||||
var createReq catalog.AccountsCreateMetastoreAssignment
|
||||
var createJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
|
@ -28,18 +31,21 @@ func init() {
|
|||
// TODO: short flags
|
||||
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
// TODO: complex arg: metastore_assignment
|
||||
|
||||
}
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create METASTORE_ID DEFAULT_CATALOG_NAME WORKSPACE_ID",
|
||||
Use: "create WORKSPACE_ID METASTORE_ID",
|
||||
Short: `Assigns a workspace to a metastore.`,
|
||||
Long: `Assigns a workspace to a metastore.
|
||||
|
||||
Creates an assignment to a metastore for a workspace`,
|
||||
Creates an assignment to a metastore for a workspace Please add a header
|
||||
X-Databricks-Account-Console-API-Version: 2.0 to access this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(3)
|
||||
check := cobra.ExactArgs(2)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
|
@ -55,12 +61,11 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.MetastoreId = args[0]
|
||||
createReq.DefaultCatalogName = args[1]
|
||||
_, err = fmt.Sscan(args[2], &createReq.WorkspaceId)
|
||||
_, err = fmt.Sscan(args[0], &createReq.WorkspaceId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[2])
|
||||
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
||||
}
|
||||
createReq.MetastoreId = args[1]
|
||||
}
|
||||
|
||||
response, err := a.MetastoreAssignments.Create(ctx, createReq)
|
||||
|
@ -69,6 +74,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -89,7 +97,8 @@ var deleteCmd = &cobra.Command{
|
|||
Long: `Delete a metastore assignment.
|
||||
|
||||
Deletes a metastore assignment to a workspace, leaving the workspace with no
|
||||
metastore.`,
|
||||
metastore. Please add a header X-Databricks-Account-Console-API-Version: 2.0
|
||||
to access this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
|
@ -122,6 +131,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -144,7 +156,8 @@ var getCmd = &cobra.Command{
|
|||
Gets the metastore assignment, if any, for the workspace specified by ID. If
|
||||
the workspace is assigned a metastore, the mappig will be returned. If no
|
||||
metastore is assigned to the workspace, the assignment will not be found and a
|
||||
404 returned.`,
|
||||
404 returned. Please add a header X-Databricks-Account-Console-API-Version:
|
||||
2.0 to access this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
|
@ -176,6 +189,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -196,7 +212,8 @@ var listCmd = &cobra.Command{
|
|||
Long: `Get all workspaces assigned to a metastore.
|
||||
|
||||
Gets a list of all Databricks workspace IDs that have been assigned to given
|
||||
metastore.`,
|
||||
metastore. Please add a header X-Databricks-Account-Console-API-Version: 2.0
|
||||
to access this API`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
|
@ -225,11 +242,14 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
||||
var updateReq catalog.UpdateMetastoreAssignment
|
||||
var updateReq catalog.AccountsUpdateMetastoreAssignment
|
||||
var updateJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
|
@ -237,8 +257,7 @@ func init() {
|
|||
// TODO: short flags
|
||||
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
updateCmd.Flags().StringVar(&updateReq.DefaultCatalogName, "default-catalog-name", updateReq.DefaultCatalogName, `The name of the default catalog for the metastore.`)
|
||||
updateCmd.Flags().StringVar(&updateReq.MetastoreId, "metastore-id", updateReq.MetastoreId, `The unique ID of the metastore.`)
|
||||
// TODO: complex arg: metastore_assignment
|
||||
|
||||
}
|
||||
|
||||
|
@ -248,7 +267,8 @@ var updateCmd = &cobra.Command{
|
|||
Long: `Updates a metastore assignment to a workspaces.
|
||||
|
||||
Updates an assignment to a metastore for a workspace. Currently, only the
|
||||
default catalog may be updated`,
|
||||
default catalog may be updated. Please add a header
|
||||
X-Databricks-Account-Console-API-Version: 2.0 to access this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
|
@ -281,6 +301,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountMetastoreAssignments
|
||||
|
|
|
@ -15,11 +15,14 @@ var Cmd = &cobra.Command{
|
|||
Short: `These APIs manage Unity Catalog metastores for an account.`,
|
||||
Long: `These APIs manage Unity Catalog metastores for an account. A metastore
|
||||
contains catalogs that can be associated with workspaces`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
||||
var createReq catalog.CreateMetastore
|
||||
var createReq catalog.AccountsCreateMetastore
|
||||
var createJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
|
@ -27,20 +30,21 @@ func init() {
|
|||
// TODO: short flags
|
||||
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
createCmd.Flags().StringVar(&createReq.Region, "region", createReq.Region, `Cloud region which the metastore serves (e.g., us-west-2, westus).`)
|
||||
// TODO: complex arg: metastore_info
|
||||
|
||||
}
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create NAME STORAGE_ROOT",
|
||||
Use: "create",
|
||||
Short: `Create metastore.`,
|
||||
Long: `Create metastore.
|
||||
|
||||
Creates a Unity Catalog metastore.`,
|
||||
Creates a Unity Catalog metastore. Please add a header
|
||||
X-Databricks-Account-Console-API-Version: 2.0 to access this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(2)
|
||||
check := cobra.ExactArgs(0)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
|
@ -56,8 +60,6 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.Name = args[0]
|
||||
createReq.StorageRoot = args[1]
|
||||
}
|
||||
|
||||
response, err := a.Metastores.Create(ctx, createReq)
|
||||
|
@ -66,6 +68,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -85,7 +90,8 @@ var deleteCmd = &cobra.Command{
|
|||
Short: `Delete a metastore.`,
|
||||
Long: `Delete a metastore.
|
||||
|
||||
Deletes a Unity Catalog metastore for an account, both specified by ID.`,
|
||||
Deletes a Unity Catalog metastore for an account, both specified by ID. Please
|
||||
add a header X-Databricks-Account-Console-API-Version: 2.0 to access this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
|
@ -114,6 +120,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -133,7 +142,8 @@ var getCmd = &cobra.Command{
|
|||
Short: `Get a metastore.`,
|
||||
Long: `Get a metastore.
|
||||
|
||||
Gets a Unity Catalog metastore from an account, both specified by ID.`,
|
||||
Gets a Unity Catalog metastore from an account, both specified by ID. Please
|
||||
add a header X-Databricks-Account-Console-API-Version: 2.0 to access this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
|
@ -162,6 +172,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -176,7 +189,9 @@ var listCmd = &cobra.Command{
|
|||
Short: `Get all metastores associated with an account.`,
|
||||
Long: `Get all metastores associated with an account.
|
||||
|
||||
Gets all Unity Catalog metastores associated with an account specified by ID.`,
|
||||
Gets all Unity Catalog metastores associated with an account specified by ID.
|
||||
Please add a header X-Databricks-Account-Console-API-Version: 2.0 to access
|
||||
this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustAccountClient,
|
||||
|
@ -189,11 +204,14 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
||||
var updateReq catalog.UpdateMetastore
|
||||
var updateReq catalog.AccountsUpdateMetastore
|
||||
var updateJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
|
@ -201,13 +219,7 @@ func init() {
|
|||
// TODO: short flags
|
||||
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
updateCmd.Flags().StringVar(&updateReq.DeltaSharingOrganizationName, "delta-sharing-organization-name", updateReq.DeltaSharingOrganizationName, `The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name.`)
|
||||
updateCmd.Flags().Int64Var(&updateReq.DeltaSharingRecipientTokenLifetimeInSeconds, "delta-sharing-recipient-token-lifetime-in-seconds", updateReq.DeltaSharingRecipientTokenLifetimeInSeconds, `The lifetime of delta sharing recipient token in seconds.`)
|
||||
updateCmd.Flags().Var(&updateReq.DeltaSharingScope, "delta-sharing-scope", `The scope of Delta Sharing enabled for the metastore.`)
|
||||
updateCmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `The user-specified name of the metastore.`)
|
||||
updateCmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `The owner of the metastore.`)
|
||||
updateCmd.Flags().StringVar(&updateReq.PrivilegeModelVersion, "privilege-model-version", updateReq.PrivilegeModelVersion, `Privilege model version of the metastore, of the form major.minor (e.g., 1.0).`)
|
||||
updateCmd.Flags().StringVar(&updateReq.StorageRootCredentialId, "storage-root-credential-id", updateReq.StorageRootCredentialId, `UUID of storage credential to access the metastore storage_root.`)
|
||||
// TODO: complex arg: metastore_info
|
||||
|
||||
}
|
||||
|
||||
|
@ -216,7 +228,8 @@ var updateCmd = &cobra.Command{
|
|||
Short: `Update a metastore.`,
|
||||
Long: `Update a metastore.
|
||||
|
||||
Updates an existing Unity Catalog metastore.`,
|
||||
Updates an existing Unity Catalog metastore. Please add a header
|
||||
X-Databricks-Account-Console-API-Version: 2.0 to access this API.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
|
@ -245,6 +258,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountMetastores
|
||||
|
|
|
@ -17,6 +17,9 @@ var Cmd = &cobra.Command{
|
|||
Short: `These APIs manage network configurations for customer-managed VPCs (optional).`,
|
||||
Long: `These APIs manage network configurations for customer-managed VPCs (optional).
|
||||
Its ID is used when creating a new workspace if you use customer-managed VPCs.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "provisioning",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -73,6 +76,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -136,6 +142,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -195,6 +204,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -226,6 +238,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Networks
|
||||
|
|
|
@ -18,6 +18,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
**Note:** Your account must be on the E2 version to use these APIs, this is
|
||||
because OAuth is only supported on the E2 version.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "oauth2",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -75,6 +78,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -105,6 +111,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service OAuthEnrollment
|
||||
|
|
|
@ -16,6 +16,9 @@ var Cmd = &cobra.Command{
|
|||
Use: "private-access",
|
||||
Short: `These APIs manage private access settings for this account.`,
|
||||
Long: `These APIs manage private access settings for this account.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "provisioning",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -83,6 +86,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -148,6 +154,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -213,6 +222,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -241,6 +253,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start replace command
|
||||
|
@ -315,6 +330,9 @@ var replaceCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service PrivateAccess
|
||||
|
|
|
@ -20,6 +20,9 @@ var Cmd = &cobra.Command{
|
|||
**Note:** You can only add/use the OAuth published application integrations
|
||||
when OAuth enrollment status is enabled. For more details see
|
||||
:method:OAuthEnrollment/create`,
|
||||
Annotations: map[string]string{
|
||||
"package": "oauth2",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -73,6 +76,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -122,6 +128,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -170,6 +179,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -198,6 +210,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -249,6 +264,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service PublishedAppIntegration
|
||||
|
|
|
@ -28,6 +28,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
[Authentication using OAuth tokens for service principals]: https://docs.databricks.com/dev-tools/authentication-oauth.html
|
||||
[Databricks Terraform Provider]: https://github.com/databricks/terraform-provider-databricks/blob/master/docs/index.md#authenticating-with-service-principal`,
|
||||
Annotations: map[string]string{
|
||||
"package": "oauth2",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -79,6 +82,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -131,6 +137,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -184,6 +193,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service ServicePrincipalSecrets
|
||||
|
|
|
@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
|
|||
production data run with service principals, interactive users do not need any
|
||||
write, delete, or modify privileges in production. This eliminates the risk of
|
||||
a user overwriting production data by accident.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -77,6 +80,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -135,6 +141,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -194,6 +203,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -249,6 +261,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start patch command
|
||||
|
@ -310,6 +325,9 @@ var patchCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -379,6 +397,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountServicePrincipals
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
||||
|
||||
package settings
|
||||
|
||||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/service/settings"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var Cmd = &cobra.Command{
|
||||
Use: "settings",
|
||||
Short: `TBD.`,
|
||||
Long: `TBD`,
|
||||
Annotations: map[string]string{
|
||||
"package": "settings",
|
||||
},
|
||||
}
|
||||
|
||||
// start read-personal-compute-setting command
|
||||
|
||||
var readPersonalComputeSettingReq settings.ReadPersonalComputeSettingRequest
|
||||
var readPersonalComputeSettingJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(readPersonalComputeSettingCmd)
|
||||
// TODO: short flags
|
||||
readPersonalComputeSettingCmd.Flags().Var(&readPersonalComputeSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
readPersonalComputeSettingCmd.Flags().StringVar(&readPersonalComputeSettingReq.Etag, "etag", readPersonalComputeSettingReq.Etag, `TBD.`)
|
||||
|
||||
}
|
||||
|
||||
var readPersonalComputeSettingCmd = &cobra.Command{
|
||||
Use: "read-personal-compute-setting",
|
||||
Short: `Get Personal Compute setting.`,
|
||||
Long: `Get Personal Compute setting.
|
||||
|
||||
TBD`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(0)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustAccountClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
a := root.AccountClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = readPersonalComputeSettingJson.Unmarshal(&readPersonalComputeSettingReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
response, err := a.Settings.ReadPersonalComputeSetting(ctx, readPersonalComputeSettingReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountSettings
|
|
@ -14,11 +14,14 @@ var Cmd = &cobra.Command{
|
|||
Use: "storage-credentials",
|
||||
Short: `These APIs manage storage credentials for a particular metastore.`,
|
||||
Long: `These APIs manage storage credentials for a particular metastore.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
||||
var createReq catalog.CreateStorageCredential
|
||||
var createReq catalog.AccountsCreateStorageCredential
|
||||
var createJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
|
@ -26,17 +29,12 @@ func init() {
|
|||
// TODO: short flags
|
||||
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
// TODO: complex arg: aws_iam_role
|
||||
// TODO: complex arg: azure_service_principal
|
||||
createCmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `Comment associated with the credential.`)
|
||||
// TODO: complex arg: gcp_service_account_key
|
||||
createCmd.Flags().BoolVar(&createReq.ReadOnly, "read-only", createReq.ReadOnly, `Whether the storage credential is only usable for read operations.`)
|
||||
createCmd.Flags().BoolVar(&createReq.SkipValidation, "skip-validation", createReq.SkipValidation, `Supplying true to this argument skips validation of the created credential.`)
|
||||
// TODO: complex arg: credential_info
|
||||
|
||||
}
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create NAME METASTORE_ID",
|
||||
Use: "create METASTORE_ID",
|
||||
Short: `Create a storage credential.`,
|
||||
Long: `Create a storage credential.
|
||||
|
||||
|
@ -50,7 +48,7 @@ var createCmd = &cobra.Command{
|
|||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(2)
|
||||
check := cobra.ExactArgs(1)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
|
@ -66,8 +64,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.Name = args[0]
|
||||
createReq.MetastoreId = args[1]
|
||||
createReq.MetastoreId = args[0]
|
||||
}
|
||||
|
||||
response, err := a.StorageCredentials.Create(ctx, createReq)
|
||||
|
@ -76,6 +73,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -126,6 +126,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -177,6 +180,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -226,11 +232,14 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
||||
var updateReq catalog.UpdateStorageCredential
|
||||
var updateReq catalog.AccountsUpdateStorageCredential
|
||||
var updateJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
|
@ -238,15 +247,7 @@ func init() {
|
|||
// TODO: short flags
|
||||
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
// TODO: complex arg: aws_iam_role
|
||||
// TODO: complex arg: azure_service_principal
|
||||
updateCmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `Comment associated with the credential.`)
|
||||
updateCmd.Flags().BoolVar(&updateReq.Force, "force", updateReq.Force, `Force update even if there are dependent external locations or external tables.`)
|
||||
// TODO: complex arg: gcp_service_account_key
|
||||
updateCmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `The credential name.`)
|
||||
updateCmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `Username of current owner of credential.`)
|
||||
updateCmd.Flags().BoolVar(&updateReq.ReadOnly, "read-only", updateReq.ReadOnly, `Whether the storage credential is only usable for read operations.`)
|
||||
updateCmd.Flags().BoolVar(&updateReq.SkipValidation, "skip-validation", updateReq.SkipValidation, `Supplying true to this argument skips validation of the updated credential.`)
|
||||
// TODO: complex arg: credential_info
|
||||
|
||||
}
|
||||
|
||||
|
@ -287,6 +288,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountStorageCredentials
|
||||
|
|
|
@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
|
|||
bucket for storage of non-production DBFS data. A storage configuration
|
||||
encapsulates this bucket information, and its ID is used when creating a new
|
||||
workspace.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "provisioning",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -62,11 +65,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.StorageConfigurationName = args[0]
|
||||
_, err = fmt.Sscan(args[1], &createReq.RootBucketInfo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ROOT_BUCKET_INFO: %s", args[1])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := a.Storage.Create(ctx, createReq)
|
||||
|
@ -75,6 +74,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -134,6 +136,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -192,6 +197,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -220,6 +228,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Storage
|
||||
|
|
|
@ -26,6 +26,9 @@ var Cmd = &cobra.Command{
|
|||
provider and that user’s account will also be removed from Databricks
|
||||
account. This ensures a consistent offboarding process and prevents
|
||||
unauthorized users from accessing sensitive data.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -85,6 +88,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -144,6 +150,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -202,6 +211,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -257,6 +269,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start patch command
|
||||
|
@ -318,6 +333,9 @@ var patchCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -387,6 +405,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service AccountUsers
|
||||
|
|
|
@ -16,6 +16,9 @@ var Cmd = &cobra.Command{
|
|||
Use: "vpc-endpoints",
|
||||
Short: `These APIs manage VPC endpoint configurations for this account.`,
|
||||
Long: `These APIs manage VPC endpoint configurations for this account.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "provisioning",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -80,6 +83,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -146,6 +152,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -208,6 +217,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -240,6 +252,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service VpcEndpoints
|
||||
|
|
|
@ -17,6 +17,9 @@ var Cmd = &cobra.Command{
|
|||
Short: `The Workspace Permission Assignment API allows you to manage workspace permissions for principals in your account.`,
|
||||
Long: `The Workspace Permission Assignment API allows you to manage workspace
|
||||
permissions for principals in your account.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -73,6 +76,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -124,6 +130,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -176,6 +185,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -209,18 +221,7 @@ var updateCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
_, err = fmt.Sscan(args[0], &updateReq.Permissions)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid PERMISSIONS: %s", args[0])
|
||||
}
|
||||
_, err = fmt.Sscan(args[1], &updateReq.WorkspaceId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[1])
|
||||
}
|
||||
_, err = fmt.Sscan(args[2], &updateReq.PrincipalId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid PRINCIPAL_ID: %s", args[2])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = a.WorkspaceAssignment.Update(ctx, updateReq)
|
||||
|
@ -229,6 +230,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service WorkspaceAssignment
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/retries"
|
||||
"github.com/databricks/databricks-sdk-go/service/provisioning"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -25,6 +24,9 @@ var Cmd = &cobra.Command{
|
|||
These endpoints are available if your account is on the E2 version of the
|
||||
platform or on a select custom plan that allows multiple workspaces per
|
||||
account.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "provisioning",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -93,29 +95,27 @@ var createCmd = &cobra.Command{
|
|||
createReq.WorkspaceName = args[0]
|
||||
}
|
||||
|
||||
wait, err := a.Workspaces.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if createSkipWait {
|
||||
response, err := a.Workspaces.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := a.Workspaces.CreateAndWait(ctx, createReq,
|
||||
retries.Timeout[provisioning.Workspace](createTimeout),
|
||||
func(i *retries.Info[provisioning.Workspace]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.WorkspaceStatusMessage
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *provisioning.Workspace) {
|
||||
statusMessage := i.WorkspaceStatusMessage
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(createTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -184,6 +184,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -258,6 +261,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -289,6 +295,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -466,29 +475,27 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
}
|
||||
|
||||
wait, err := a.Workspaces.Update(ctx, updateReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if updateSkipWait {
|
||||
err = a.Workspaces.Update(ctx, updateReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := a.Workspaces.UpdateAndWait(ctx, updateReq,
|
||||
retries.Timeout[provisioning.Workspace](updateTimeout),
|
||||
func(i *retries.Info[provisioning.Workspace]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.WorkspaceStatusMessage
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *provisioning.Workspace) {
|
||||
statusMessage := i.WorkspaceStatusMessage
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(updateTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Workspaces
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
// rootCmd represents the root command for the bundle subcommand.
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "bundle",
|
||||
Short: "Databricks Asset Bundles",
|
||||
Short: "Databricks Application Bundles",
|
||||
}
|
||||
|
||||
func AddCommand(cmd *cobra.Command) {
|
||||
|
|
|
@ -1,124 +1,167 @@
|
|||
package configure
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"net/url"
|
||||
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/databrickscfg"
|
||||
"github.com/databricks/databricks-sdk-go/config"
|
||||
"github.com/spf13/cobra"
|
||||
"gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
type Configs struct {
|
||||
Host string `ini:"host"`
|
||||
Token string `ini:"token,omitempty"`
|
||||
Profile string `ini:"-"`
|
||||
}
|
||||
|
||||
var tokenMode bool
|
||||
|
||||
func (cfg *Configs) loadNonInteractive(cmd *cobra.Command) error {
|
||||
host, err := cmd.Flags().GetString("host")
|
||||
if err != nil || host == "" {
|
||||
return fmt.Errorf("use --host to specify host in non interactive mode: %w", err)
|
||||
}
|
||||
cfg.Host = host
|
||||
|
||||
if !tokenMode {
|
||||
return nil
|
||||
}
|
||||
|
||||
n, err := fmt.Scanf("%s\n", &cfg.Token)
|
||||
func validateHost(s string) error {
|
||||
u, err := url.Parse(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if n != 1 {
|
||||
return fmt.Errorf("exactly 1 argument required")
|
||||
if u.Host == "" || u.Scheme != "https" {
|
||||
return fmt.Errorf("must start with https://")
|
||||
}
|
||||
if u.Path != "" && u.Path != "/" {
|
||||
return fmt.Errorf("must use empty path")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func configureFromFlags(cmd *cobra.Command, ctx context.Context, cfg *config.Config) error {
|
||||
// Configure profile name if set.
|
||||
profile, err := cmd.Flags().GetString("profile")
|
||||
if err != nil {
|
||||
return fmt.Errorf("read --profile flag: %w", err)
|
||||
}
|
||||
if profile != "" {
|
||||
cfg.Profile = profile
|
||||
}
|
||||
|
||||
// Configure host if set.
|
||||
host, err := cmd.Flags().GetString("host")
|
||||
if err != nil {
|
||||
return fmt.Errorf("read --host flag: %w", err)
|
||||
}
|
||||
if host != "" {
|
||||
cfg.Host = host
|
||||
}
|
||||
|
||||
// Validate host if set.
|
||||
if cfg.Host != "" {
|
||||
err = validateHost(cfg.Host)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func configureInteractive(cmd *cobra.Command, ctx context.Context, cfg *config.Config) error {
|
||||
err := configureFromFlags(cmd, ctx, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Ask user to specify the host if not already set.
|
||||
if cfg.Host == "" {
|
||||
prompt := cmdio.Prompt(ctx)
|
||||
prompt.Label = "Databricks Host"
|
||||
prompt.Default = "https://"
|
||||
prompt.AllowEdit = true
|
||||
prompt.Validate = validateHost
|
||||
out, err := prompt.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cfg.Host = out
|
||||
}
|
||||
|
||||
// Ask user to specify the token is not already set.
|
||||
if cfg.Token == "" {
|
||||
prompt := cmdio.Prompt(ctx)
|
||||
prompt.Label = "Personal Access Token"
|
||||
prompt.Mask = '*'
|
||||
out, err := prompt.Run()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cfg.Token = out
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func configureNonInteractive(cmd *cobra.Command, ctx context.Context, cfg *config.Config) error {
|
||||
err := configureFromFlags(cmd, ctx, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if cfg.Host == "" {
|
||||
return fmt.Errorf("host must be set in non-interactive mode")
|
||||
}
|
||||
|
||||
// Read token from stdin if not already set.
|
||||
if cfg.Token == "" {
|
||||
_, err := fmt.Fscanf(cmd.InOrStdin(), "%s\n", &cfg.Token)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var configureCmd = &cobra.Command{
|
||||
Use: "configure",
|
||||
Short: "Configure authentication",
|
||||
Use: "configure",
|
||||
Short: "Configure authentication",
|
||||
Long: `Configure authentication.
|
||||
|
||||
This command adds a profile to your ~/.databrickscfg file.
|
||||
You can write to a different file by setting the DATABRICKS_CONFIG_FILE environment variable.
|
||||
|
||||
If this command is invoked in non-interactive mode, it will read the token from stdin.
|
||||
The host must be specified with the --host flag.
|
||||
`,
|
||||
Hidden: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
profile, err := cmd.Flags().GetString("profile")
|
||||
var cfg config.Config
|
||||
|
||||
// Load environment variables, possibly the DEFAULT profile.
|
||||
err := config.ConfigAttributes.Configure(&cfg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read --profile flag: %w", err)
|
||||
return fmt.Errorf("unable to instantiate configuration from environment variables: %w", err)
|
||||
}
|
||||
|
||||
path := os.Getenv("DATABRICKS_CONFIG_FILE")
|
||||
if path == "" {
|
||||
path, err = os.UserHomeDir()
|
||||
if err != nil {
|
||||
return fmt.Errorf("homedir: %w", err)
|
||||
}
|
||||
ctx := cmd.Context()
|
||||
interactive := cmdio.IsInTTY(ctx) && cmdio.IsOutTTY(ctx)
|
||||
var fn func(*cobra.Command, context.Context, *config.Config) error
|
||||
if interactive {
|
||||
fn = configureInteractive
|
||||
} else {
|
||||
fn = configureNonInteractive
|
||||
}
|
||||
if filepath.Base(path) == ".databrickscfg" {
|
||||
path = filepath.Dir(path)
|
||||
}
|
||||
err = os.MkdirAll(path, os.ModeDir|os.ModePerm)
|
||||
err = fn(cmd, ctx, &cfg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create config dir: %w", err)
|
||||
}
|
||||
cfgPath := filepath.Join(path, ".databrickscfg")
|
||||
_, err = os.Stat(cfgPath)
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
file, err := os.Create(cfgPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create config file: %w", err)
|
||||
}
|
||||
file.Close()
|
||||
} else if err != nil {
|
||||
return fmt.Errorf("open config file: %w", err)
|
||||
return err
|
||||
}
|
||||
|
||||
ini_cfg, err := ini.Load(cfgPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("load config file: %w", err)
|
||||
}
|
||||
cfg := &Configs{"", "", profile}
|
||||
err = ini_cfg.Section(profile).MapTo(cfg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unmarshal loaded config: %w", err)
|
||||
}
|
||||
// Clear the Databricks CLI path in token mode.
|
||||
// This is relevant for OAuth only.
|
||||
cfg.DatabricksCliPath = ""
|
||||
|
||||
err = cfg.loadNonInteractive(cmd)
|
||||
if err != nil {
|
||||
return fmt.Errorf("reading configs: %w", err)
|
||||
}
|
||||
|
||||
err = ini_cfg.Section(profile).ReflectFrom(cfg)
|
||||
if err != nil {
|
||||
return fmt.Errorf("marshall config: %w", err)
|
||||
}
|
||||
|
||||
var buffer bytes.Buffer
|
||||
if ini_cfg.Section("DEFAULT").Body() != "" {
|
||||
//This configuration makes the ini library write the DEFAULT header explicitly.
|
||||
//DEFAULT section might be empty
|
||||
ini.DefaultHeader = true
|
||||
}
|
||||
_, err = ini_cfg.WriteTo(&buffer)
|
||||
if err != nil {
|
||||
return fmt.Errorf("write config to buffer: %w", err)
|
||||
}
|
||||
err = os.WriteFile(cfgPath, buffer.Bytes(), os.ModePerm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("write congfig to file: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
// Save profile to config file.
|
||||
return databrickscfg.SaveToProfile(ctx, &cfg)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
root.RootCmd.AddCommand(configureCmd)
|
||||
configureCmd.Flags().BoolVarP(&tokenMode, "token", "t", false, "Configure using Databricks Personal Access Token")
|
||||
configureCmd.Flags().String("host", "", "Host to connect to.")
|
||||
configureCmd.Flags().String("profile", "DEFAULT", "CLI connection profile to use.")
|
||||
configureCmd.Flags().String("host", "", "Databricks workspace host.")
|
||||
configureCmd.Flags().String("profile", "DEFAULT", "Name for the connection profile to configure.")
|
||||
|
||||
// Include token flag for compatibility with the legacy CLI.
|
||||
// It doesn't actually do anything because we always use PATs.
|
||||
configureCmd.Flags().BoolP("token", "t", true, "Configure using Databricks Personal Access Token")
|
||||
configureCmd.Flags().MarkHidden("token")
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ func TestDefaultConfigureNoInteractive(t *testing.T) {
|
|||
})
|
||||
os.Stdin = inp
|
||||
|
||||
root.RootCmd.SetArgs([]string{"configure", "--token", "--host", "host"})
|
||||
root.RootCmd.SetArgs([]string{"configure", "--token", "--host", "https://host"})
|
||||
|
||||
err := root.RootCmd.ExecuteContext(ctx)
|
||||
assert.NoError(t, err)
|
||||
|
@ -67,7 +67,7 @@ func TestDefaultConfigureNoInteractive(t *testing.T) {
|
|||
defaultSection, err := cfg.GetSection("DEFAULT")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assertKeyValueInSection(t, defaultSection, "host", "host")
|
||||
assertKeyValueInSection(t, defaultSection, "host", "https://host")
|
||||
assertKeyValueInSection(t, defaultSection, "token", "token")
|
||||
}
|
||||
|
||||
|
@ -75,8 +75,8 @@ func TestConfigFileFromEnvNoInteractive(t *testing.T) {
|
|||
//TODO: Replace with similar test code from go SDK, once we start using it directly
|
||||
ctx := context.Background()
|
||||
tempHomeDir := setup(t)
|
||||
cfgFileDir := filepath.Join(tempHomeDir, "test")
|
||||
t.Setenv("DATABRICKS_CONFIG_FILE", cfgFileDir)
|
||||
cfgPath := filepath.Join(tempHomeDir, ".databrickscfg")
|
||||
t.Setenv("DATABRICKS_CONFIG_FILE", cfgPath)
|
||||
|
||||
inp := getTempFileWithContent(t, tempHomeDir, "token\n")
|
||||
defer inp.Close()
|
||||
|
@ -84,12 +84,11 @@ func TestConfigFileFromEnvNoInteractive(t *testing.T) {
|
|||
t.Cleanup(func() { os.Stdin = oldStdin })
|
||||
os.Stdin = inp
|
||||
|
||||
root.RootCmd.SetArgs([]string{"configure", "--token", "--host", "host"})
|
||||
root.RootCmd.SetArgs([]string{"configure", "--token", "--host", "https://host"})
|
||||
|
||||
err := root.RootCmd.ExecuteContext(ctx)
|
||||
assert.NoError(t, err)
|
||||
|
||||
cfgPath := filepath.Join(cfgFileDir, ".databrickscfg")
|
||||
_, err = os.Stat(cfgPath)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
@ -99,25 +98,25 @@ func TestConfigFileFromEnvNoInteractive(t *testing.T) {
|
|||
defaultSection, err := cfg.GetSection("DEFAULT")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assertKeyValueInSection(t, defaultSection, "host", "host")
|
||||
assertKeyValueInSection(t, defaultSection, "host", "https://host")
|
||||
assertKeyValueInSection(t, defaultSection, "token", "token")
|
||||
}
|
||||
|
||||
func TestCustomProfileConfigureNoInteractive(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
tempHomeDir := setup(t)
|
||||
cfgPath := filepath.Join(tempHomeDir, ".databrickscfg")
|
||||
inp := getTempFileWithContent(t, tempHomeDir, "token\n")
|
||||
defer inp.Close()
|
||||
oldStdin := os.Stdin
|
||||
t.Cleanup(func() { os.Stdin = oldStdin })
|
||||
os.Stdin = inp
|
||||
|
||||
root.RootCmd.SetArgs([]string{"configure", "--token", "--host", "host", "--profile", "CUSTOM"})
|
||||
root.RootCmd.SetArgs([]string{"configure", "--token", "--host", "https://host", "--profile", "CUSTOM"})
|
||||
|
||||
err := root.RootCmd.ExecuteContext(ctx)
|
||||
assert.NoError(t, err)
|
||||
|
||||
cfgPath := filepath.Join(tempHomeDir, ".databrickscfg")
|
||||
_, err = os.Stat(cfgPath)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
@ -127,6 +126,6 @@ func TestCustomProfileConfigureNoInteractive(t *testing.T) {
|
|||
defaultSection, err := cfg.GetSection("CUSTOM")
|
||||
assert.NoError(t, err)
|
||||
|
||||
assertKeyValueInSection(t, defaultSection, "host", "host")
|
||||
assertKeyValueInSection(t, defaultSection, "host", "https://host")
|
||||
assertKeyValueInSection(t, defaultSection, "token", "token")
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package fs
|
|||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/filer"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -16,14 +15,8 @@ var catCmd = &cobra.Command{
|
|||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
|
||||
path, err := resolveDbfsPath(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f, err := filer.NewDbfsClient(w, "/")
|
||||
f, path, err := filerForPath(ctx, args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,179 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/filer"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type copy struct {
|
||||
ctx context.Context
|
||||
sourceFiler filer.Filer
|
||||
targetFiler filer.Filer
|
||||
}
|
||||
|
||||
func (c *copy) cpWriteCallback(sourceDir, targetDir string) fs.WalkDirFunc {
|
||||
return func(sourcePath string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Compute path relative to the target directory
|
||||
relPath, err := filepath.Rel(sourceDir, sourcePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
relPath = filepath.ToSlash(relPath)
|
||||
|
||||
// Compute target path for the file
|
||||
targetPath := path.Join(targetDir, relPath)
|
||||
|
||||
// create directory and return early
|
||||
if d.IsDir() {
|
||||
return c.targetFiler.Mkdir(c.ctx, targetPath)
|
||||
}
|
||||
|
||||
return c.cpFileToFile(sourcePath, targetPath)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *copy) cpDirToDir(sourceDir, targetDir string) error {
|
||||
if !cpRecursive {
|
||||
return fmt.Errorf("source path %s is a directory. Please specify the --recursive flag", sourceDir)
|
||||
}
|
||||
|
||||
sourceFs := filer.NewFS(c.ctx, c.sourceFiler)
|
||||
return fs.WalkDir(sourceFs, sourceDir, c.cpWriteCallback(sourceDir, targetDir))
|
||||
}
|
||||
|
||||
func (c *copy) cpFileToDir(sourcePath, targetDir string) error {
|
||||
fileName := path.Base(sourcePath)
|
||||
targetPath := path.Join(targetDir, fileName)
|
||||
|
||||
return c.cpFileToFile(sourcePath, targetPath)
|
||||
}
|
||||
|
||||
func (c *copy) cpFileToFile(sourcePath, targetPath string) error {
|
||||
// Get reader for file at source path
|
||||
r, err := c.sourceFiler.Read(c.ctx, sourcePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer r.Close()
|
||||
|
||||
if cpOverwrite {
|
||||
err = c.targetFiler.Write(c.ctx, targetPath, r, filer.OverwriteIfExists)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
err = c.targetFiler.Write(c.ctx, targetPath, r)
|
||||
// skip if file already exists
|
||||
if err != nil && errors.Is(err, fs.ErrExist) {
|
||||
return emitCpFileSkippedEvent(c.ctx, sourcePath, targetPath)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return emitCpFileCopiedEvent(c.ctx, sourcePath, targetPath)
|
||||
}
|
||||
|
||||
// TODO: emit these events on stderr
|
||||
// TODO: add integration tests for these events
|
||||
func emitCpFileSkippedEvent(ctx context.Context, sourcePath, targetPath string) error {
|
||||
event := newFileSkippedEvent(sourcePath, targetPath)
|
||||
template := "{{.SourcePath}} -> {{.TargetPath}} (skipped; already exists)\n"
|
||||
|
||||
return cmdio.RenderWithTemplate(ctx, event, template)
|
||||
}
|
||||
|
||||
func emitCpFileCopiedEvent(ctx context.Context, sourcePath, targetPath string) error {
|
||||
event := newFileCopiedEvent(sourcePath, targetPath)
|
||||
template := "{{.SourcePath}} -> {{.TargetPath}}\n"
|
||||
|
||||
return cmdio.RenderWithTemplate(ctx, event, template)
|
||||
}
|
||||
|
||||
var cpOverwrite bool
|
||||
var cpRecursive bool
|
||||
|
||||
// cpCmd represents the fs cp command
|
||||
var cpCmd = &cobra.Command{
|
||||
Use: "cp SOURCE_PATH TARGET_PATH",
|
||||
Short: "Copy files and directories to and from DBFS.",
|
||||
Long: `Copy files to and from DBFS.
|
||||
|
||||
It is required that you specify the scheme "file" for local files and
|
||||
"dbfs" for dbfs files. For example: file:/foo/bar, file:/c:/foo/bar or dbfs:/foo/bar.
|
||||
|
||||
Recursively copying a directory will copy all files inside directory
|
||||
at SOURCE_PATH to the directory at TARGET_PATH.
|
||||
|
||||
When copying a file, if TARGET_PATH is a directory, the file will be created
|
||||
inside the directory, otherwise the file is created at TARGET_PATH.
|
||||
`,
|
||||
Args: cobra.ExactArgs(2),
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
|
||||
// TODO: Error if a user uses '\' as path separator on windows when "file"
|
||||
// scheme is specified (https://github.com/databricks/cli/issues/485)
|
||||
|
||||
// Get source filer and source path without scheme
|
||||
fullSourcePath := args[0]
|
||||
sourceFiler, sourcePath, err := filerForPath(ctx, fullSourcePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Get target filer and target path without scheme
|
||||
fullTargetPath := args[1]
|
||||
targetFiler, targetPath, err := filerForPath(ctx, fullTargetPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c := copy{
|
||||
ctx: ctx,
|
||||
sourceFiler: sourceFiler,
|
||||
targetFiler: targetFiler,
|
||||
}
|
||||
|
||||
// Get information about file at source path
|
||||
sourceInfo, err := sourceFiler.Stat(ctx, sourcePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// case 1: source path is a directory, then recursively create files at target path
|
||||
if sourceInfo.IsDir() {
|
||||
return c.cpDirToDir(sourcePath, targetPath)
|
||||
}
|
||||
|
||||
// case 2: source path is a file, and target path is a directory. In this case
|
||||
// we copy the file to inside the directory
|
||||
if targetInfo, err := targetFiler.Stat(ctx, targetPath); err == nil && targetInfo.IsDir() {
|
||||
return c.cpFileToDir(sourcePath, targetPath)
|
||||
}
|
||||
|
||||
// case 3: source path is a file, and target path is a file
|
||||
return c.cpFileToFile(sourcePath, targetPath)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
cpCmd.Flags().BoolVar(&cpOverwrite, "overwrite", false, "overwrite existing files")
|
||||
cpCmd.Flags().BoolVarP(&cpRecursive, "recursive", "r", false, "recursively copy files from directory")
|
||||
fsCmd.AddCommand(cpCmd)
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package fs
|
||||
|
||||
type fileIOEvent struct {
|
||||
SourcePath string `json:"source_path,omitempty"`
|
||||
TargetPath string `json:"target_path,omitempty"`
|
||||
Type EventType `json:"type"`
|
||||
}
|
||||
|
||||
type EventType string
|
||||
|
||||
const (
|
||||
EventTypeFileCopied = EventType("FILE_COPIED")
|
||||
EventTypeFileSkipped = EventType("FILE_SKIPPED")
|
||||
)
|
||||
|
||||
func newFileCopiedEvent(sourcePath, targetPath string) fileIOEvent {
|
||||
return fileIOEvent{
|
||||
SourcePath: sourcePath,
|
||||
TargetPath: targetPath,
|
||||
Type: EventTypeFileCopied,
|
||||
}
|
||||
}
|
||||
|
||||
func newFileSkippedEvent(sourcePath, targetPath string) fileIOEvent {
|
||||
return fileIOEvent{
|
||||
SourcePath: sourcePath,
|
||||
TargetPath: targetPath,
|
||||
Type: EventTypeFileSkipped,
|
||||
}
|
||||
}
|
|
@ -1,14 +1,51 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/filer"
|
||||
)
|
||||
|
||||
func resolveDbfsPath(path string) (string, error) {
|
||||
if !strings.HasPrefix(path, "dbfs:/") {
|
||||
return "", fmt.Errorf("expected dbfs path (with the dbfs:/ prefix): %s", path)
|
||||
}
|
||||
type Scheme string
|
||||
|
||||
return strings.TrimPrefix(path, "dbfs:"), nil
|
||||
const (
|
||||
DbfsScheme = Scheme("dbfs")
|
||||
LocalScheme = Scheme("file")
|
||||
NoScheme = Scheme("")
|
||||
)
|
||||
|
||||
func filerForPath(ctx context.Context, fullPath string) (filer.Filer, string, error) {
|
||||
parts := strings.SplitN(fullPath, ":/", 2)
|
||||
if len(parts) < 2 {
|
||||
return nil, "", fmt.Errorf(`no scheme specified for path %s. Please specify scheme "dbfs" or "file". Example: file:/foo/bar or file:/c:/foo/bar`, fullPath)
|
||||
}
|
||||
scheme := Scheme(parts[0])
|
||||
path := parts[1]
|
||||
switch scheme {
|
||||
case DbfsScheme:
|
||||
w := root.WorkspaceClient(ctx)
|
||||
f, err := filer.NewDbfsClient(w, "/")
|
||||
return f, path, err
|
||||
|
||||
case LocalScheme:
|
||||
if runtime.GOOS == "windows" {
|
||||
parts := strings.SplitN(path, ":", 2)
|
||||
if len(parts) < 2 {
|
||||
return nil, "", fmt.Errorf("no volume specfied for path: %s", path)
|
||||
}
|
||||
volume := parts[0] + ":"
|
||||
relPath := parts[1]
|
||||
f, err := filer.NewLocalClient(volume)
|
||||
return f, relPath, err
|
||||
}
|
||||
f, err := filer.NewLocalClient("/")
|
||||
return f, path, err
|
||||
|
||||
default:
|
||||
return nil, "", fmt.Errorf(`unsupported scheme %s specified for path %s. Please specify scheme "dbfs" or "file". Example: file:/foo/bar or file:/c:/foo/bar`, scheme, fullPath)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +1,26 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestResolveDbfsPath(t *testing.T) {
|
||||
path, err := resolveDbfsPath("dbfs:/")
|
||||
func TestNotSpecifyingVolumeForWindowsPathErrors(t *testing.T) {
|
||||
if runtime.GOOS != "windows" {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
pathWithVolume := `file:/c:/foo/bar`
|
||||
pathWOVolume := `file:/uno/dos`
|
||||
|
||||
_, path, err := filerForPath(ctx, pathWithVolume)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "/", path)
|
||||
assert.Equal(t, `/foo/bar`, path)
|
||||
|
||||
path, err = resolveDbfsPath("dbfs:/abc")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "/abc", path)
|
||||
|
||||
path, err = resolveDbfsPath("dbfs:/a/b/c")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "/a/b/c", path)
|
||||
|
||||
path, err = resolveDbfsPath("dbfs:/a/b/.")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "/a/b/.", path)
|
||||
|
||||
path, err = resolveDbfsPath("dbfs:/a/../c")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "/a/../c", path)
|
||||
|
||||
_, err = resolveDbfsPath("dbf:/a/b/c")
|
||||
assert.ErrorContains(t, err, "expected dbfs path (with the dbfs:/ prefix): dbf:/a/b/c")
|
||||
|
||||
_, err = resolveDbfsPath("/a/b/c")
|
||||
assert.ErrorContains(t, err, "expected dbfs path (with the dbfs:/ prefix): /a/b/c")
|
||||
|
||||
_, err = resolveDbfsPath("dbfs:a/b/c")
|
||||
assert.ErrorContains(t, err, "expected dbfs path (with the dbfs:/ prefix): dbfs:a/b/c")
|
||||
_, _, err = filerForPath(ctx, pathWOVolume)
|
||||
assert.Equal(t, "no volume specfied for path: uno/dos", err.Error())
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/filer"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -42,14 +41,8 @@ var lsCmd = &cobra.Command{
|
|||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
|
||||
path, err := resolveDbfsPath(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
f, err := filer.NewDbfsClient(w, "/")
|
||||
f, path, err := filerForPath(ctx, args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var mkdirCmd = &cobra.Command{
|
||||
Use: "mkdir DIR_PATH",
|
||||
// Alias `mkdirs` for this command exists for legacy purposes. This command
|
||||
// is called databricks fs mkdirs in our legacy CLI: https://github.com/databricks/databricks-cli
|
||||
Aliases: []string{"mkdirs"},
|
||||
Short: "Make directories",
|
||||
Long: `Mkdir will create directories along the path to the argument directory.`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
|
||||
f, path, err := filerForPath(ctx, args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return f.Mkdir(ctx, path)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
fsCmd.AddCommand(mkdirCmd)
|
||||
}
|
13
cmd/fs/rm.go
13
cmd/fs/rm.go
|
@ -2,7 +2,7 @@ package fs
|
|||
|
||||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/databricks-sdk-go/service/files"
|
||||
"github.com/databricks/cli/libs/filer"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -15,17 +15,16 @@ var rmCmd = &cobra.Command{
|
|||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
|
||||
path, err := resolveDbfsPath(args[0])
|
||||
f, path, err := filerForPath(ctx, args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return w.Dbfs.Delete(ctx, files.Delete{
|
||||
Path: path,
|
||||
Recursive: recursive,
|
||||
})
|
||||
if recursive {
|
||||
return f.Delete(ctx, path, filer.DeleteRecursively)
|
||||
}
|
||||
return f.Delete(ctx, path)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ func (l *friendlyHandler) Handle(ctx context.Context, rec slog.Record) error {
|
|||
msg := fmt.Sprintf("%s %s %s%s\n",
|
||||
color.MagentaString(t),
|
||||
l.coloredLevel(rec),
|
||||
color.HiWhiteString(rec.Message),
|
||||
rec.Message,
|
||||
attrs)
|
||||
_, err := l.w.Write([]byte(msg))
|
||||
return err
|
||||
|
|
|
@ -20,6 +20,9 @@ var Cmd = &cobra.Command{
|
|||
its result, and notifies one or more users and/or notification destinations if
|
||||
the condition was met. Alerts can be scheduled using the sql_task type of
|
||||
the Jobs API, e.g. :method:jobs/create.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sql",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -57,12 +60,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.Name = args[0]
|
||||
_, err = fmt.Sscan(args[1], &createReq.Options)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid OPTIONS: %s", args[1])
|
||||
}
|
||||
createReq.QueryId = args[2]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := w.Alerts.Create(ctx, createReq)
|
||||
|
@ -71,6 +69,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -131,6 +132,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -189,6 +193,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -216,6 +223,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -250,13 +260,7 @@ var updateCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
updateReq.Name = args[0]
|
||||
_, err = fmt.Sscan(args[1], &updateReq.Options)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid OPTIONS: %s", args[1])
|
||||
}
|
||||
updateReq.QueryId = args[2]
|
||||
updateReq.AlertId = args[3]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = w.Alerts.Update(ctx, updateReq)
|
||||
|
@ -265,6 +269,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Alerts
|
||||
|
|
|
@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
|
|||
data centrally across all of the workspaces in a Databricks account. Users in
|
||||
different workspaces can share access to the same data, depending on
|
||||
privileges granted centrally in Unity Catalog.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -76,6 +79,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -127,6 +133,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -177,6 +186,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -208,6 +220,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -264,6 +279,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Catalogs
|
||||
|
|
|
@ -39,6 +39,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
Only admin users can create, edit, and delete policies. Admin users also have
|
||||
access to all policies.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "compute",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -93,6 +96,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -152,6 +158,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start edit command
|
||||
|
@ -208,6 +217,9 @@ var editCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -266,6 +278,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -316,6 +331,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service ClusterPolicies
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/retries"
|
||||
"github.com/databricks/databricks-sdk-go/service/compute"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -19,31 +18,34 @@ var Cmd = &cobra.Command{
|
|||
Short: `The Clusters API allows you to create, start, edit, list, terminate, and delete clusters.`,
|
||||
Long: `The Clusters API allows you to create, start, edit, list, terminate, and
|
||||
delete clusters.
|
||||
|
||||
|
||||
Databricks maps cluster node instance types to compute units known as DBUs.
|
||||
See the instance type pricing page for a list of the supported instance types
|
||||
and their corresponding DBUs.
|
||||
|
||||
|
||||
A Databricks cluster is a set of computation resources and configurations on
|
||||
which you run data engineering, data science, and data analytics workloads,
|
||||
such as production ETL pipelines, streaming analytics, ad-hoc analytics, and
|
||||
machine learning.
|
||||
|
||||
|
||||
You run these workloads as a set of commands in a notebook or as an automated
|
||||
job. Databricks makes a distinction between all-purpose clusters and job
|
||||
clusters. You use all-purpose clusters to analyze data collaboratively using
|
||||
interactive notebooks. You use job clusters to run fast and robust automated
|
||||
jobs.
|
||||
|
||||
|
||||
You can create an all-purpose cluster using the UI, CLI, or REST API. You can
|
||||
manually terminate and restart an all-purpose cluster. Multiple users can
|
||||
share such clusters to do collaborative interactive analysis.
|
||||
|
||||
|
||||
IMPORTANT: Databricks retains cluster configuration information for up to 200
|
||||
all-purpose clusters terminated in the last 30 days and up to 30 job clusters
|
||||
recently terminated by the job scheduler. To keep an all-purpose cluster
|
||||
configuration even after it has been terminated for more than 30 days, an
|
||||
administrator can pin a cluster to the cluster list.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "compute",
|
||||
},
|
||||
}
|
||||
|
||||
// start change-owner command
|
||||
|
@ -62,7 +64,7 @@ var changeOwnerCmd = &cobra.Command{
|
|||
Use: "change-owner CLUSTER_ID OWNER_USERNAME",
|
||||
Short: `Change cluster owner.`,
|
||||
Long: `Change cluster owner.
|
||||
|
||||
|
||||
Change the owner of the cluster. You must be an admin to perform this
|
||||
operation.`,
|
||||
|
||||
|
@ -94,6 +96,9 @@ var changeOwnerCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -142,17 +147,17 @@ var createCmd = &cobra.Command{
|
|||
Use: "create SPARK_VERSION",
|
||||
Short: `Create new cluster.`,
|
||||
Long: `Create new cluster.
|
||||
|
||||
|
||||
Creates a new Spark cluster. This method will acquire new instances from the
|
||||
cloud provider if necessary. This method is asynchronous; the returned
|
||||
cluster_id can be used to poll the cluster status. When this method returns,
|
||||
the cluster will be in a PENDING state. The cluster will be usable once it
|
||||
enters a RUNNING state.
|
||||
|
||||
|
||||
Note: Databricks may not be able to acquire some of the requested nodes, due
|
||||
to cloud provider limitations (account limits, spot price, etc.) or transient
|
||||
network issues.
|
||||
|
||||
|
||||
If Databricks acquires at least 85% of the requested on-demand nodes, cluster
|
||||
creation will succeed. Otherwise the cluster will terminate with an
|
||||
informative error message.`,
|
||||
|
@ -178,29 +183,27 @@ var createCmd = &cobra.Command{
|
|||
createReq.SparkVersion = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Clusters.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if createSkipWait {
|
||||
response, err := w.Clusters.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Clusters.CreateAndWait(ctx, createReq,
|
||||
retries.Timeout[compute.ClusterInfo](createTimeout),
|
||||
func(i *retries.Info[compute.ClusterInfo]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.StateMessage
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *compute.ClusterInfo) {
|
||||
statusMessage := i.StateMessage
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(createTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -224,7 +227,7 @@ var deleteCmd = &cobra.Command{
|
|||
Use: "delete CLUSTER_ID",
|
||||
Short: `Terminate cluster.`,
|
||||
Long: `Terminate cluster.
|
||||
|
||||
|
||||
Terminates the Spark cluster with the specified ID. The cluster is removed
|
||||
asynchronously. Once the termination has completed, the cluster will be in a
|
||||
TERMINATED state. If the cluster is already in a TERMINATING or
|
||||
|
@ -261,29 +264,27 @@ var deleteCmd = &cobra.Command{
|
|||
deleteReq.ClusterId = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Clusters.Delete(ctx, deleteReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if deleteSkipWait {
|
||||
err = w.Clusters.Delete(ctx, deleteReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Clusters.DeleteAndWait(ctx, deleteReq,
|
||||
retries.Timeout[compute.ClusterInfo](deleteTimeout),
|
||||
func(i *retries.Info[compute.ClusterInfo]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.StateMessage
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *compute.ClusterInfo) {
|
||||
statusMessage := i.StateMessage
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(deleteTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start edit command
|
||||
|
@ -310,6 +311,8 @@ func init() {
|
|||
editCmd.Flags().StringVar(&editReq.ClusterName, "cluster-name", editReq.ClusterName, `Cluster name requested by the user.`)
|
||||
editCmd.Flags().Var(&editReq.ClusterSource, "cluster-source", `Determines whether the cluster was created by a user through the UI, created by the Databricks Jobs Scheduler, or through an API request.`)
|
||||
// TODO: map via StringToStringVar: custom_tags
|
||||
editCmd.Flags().Var(&editReq.DataSecurityMode, "data-security-mode", `This describes an enum.`)
|
||||
// TODO: complex arg: docker_image
|
||||
editCmd.Flags().StringVar(&editReq.DriverInstancePoolId, "driver-instance-pool-id", editReq.DriverInstancePoolId, `The optional ID of the instance pool for the driver of the cluster belongs.`)
|
||||
editCmd.Flags().StringVar(&editReq.DriverNodeTypeId, "driver-node-type-id", editReq.DriverNodeTypeId, `The node type of the Spark driver.`)
|
||||
editCmd.Flags().BoolVar(&editReq.EnableElasticDisk, "enable-elastic-disk", editReq.EnableElasticDisk, `Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk space when its Spark workers are running low on disk space.`)
|
||||
|
@ -321,6 +324,7 @@ func init() {
|
|||
editCmd.Flags().IntVar(&editReq.NumWorkers, "num-workers", editReq.NumWorkers, `Number of worker nodes that this cluster should have.`)
|
||||
editCmd.Flags().StringVar(&editReq.PolicyId, "policy-id", editReq.PolicyId, `The ID of the cluster policy used to create the cluster if applicable.`)
|
||||
editCmd.Flags().Var(&editReq.RuntimeEngine, "runtime-engine", `Decides which runtime engine to be use, e.g.`)
|
||||
editCmd.Flags().StringVar(&editReq.SingleUserName, "single-user-name", editReq.SingleUserName, `Single user name if data_security_mode is SINGLE_USER.`)
|
||||
// TODO: map via StringToStringVar: spark_conf
|
||||
// TODO: map via StringToStringVar: spark_env_vars
|
||||
// TODO: array: ssh_public_keys
|
||||
|
@ -332,18 +336,18 @@ var editCmd = &cobra.Command{
|
|||
Use: "edit CLUSTER_ID SPARK_VERSION",
|
||||
Short: `Update cluster configuration.`,
|
||||
Long: `Update cluster configuration.
|
||||
|
||||
|
||||
Updates the configuration of a cluster to match the provided attributes and
|
||||
size. A cluster can be updated if it is in a RUNNING or TERMINATED state.
|
||||
|
||||
|
||||
If a cluster is updated while in a RUNNING state, it will be restarted so
|
||||
that the new attributes can take effect.
|
||||
|
||||
|
||||
If a cluster is updated while in a TERMINATED state, it will remain
|
||||
TERMINATED. The next time it is started using the clusters/start API, the
|
||||
new attributes will take effect. Any attempt to update a cluster in any other
|
||||
state will be rejected with an INVALID_STATE error code.
|
||||
|
||||
|
||||
Clusters created by the Databricks Jobs service cannot be edited.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
|
@ -368,29 +372,27 @@ var editCmd = &cobra.Command{
|
|||
editReq.SparkVersion = args[1]
|
||||
}
|
||||
|
||||
wait, err := w.Clusters.Edit(ctx, editReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if editSkipWait {
|
||||
err = w.Clusters.Edit(ctx, editReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Clusters.EditAndWait(ctx, editReq,
|
||||
retries.Timeout[compute.ClusterInfo](editTimeout),
|
||||
func(i *retries.Info[compute.ClusterInfo]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.StateMessage
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *compute.ClusterInfo) {
|
||||
statusMessage := i.StateMessage
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(editTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start events command
|
||||
|
@ -416,7 +418,7 @@ var eventsCmd = &cobra.Command{
|
|||
Use: "events CLUSTER_ID",
|
||||
Short: `List cluster activity events.`,
|
||||
Long: `List cluster activity events.
|
||||
|
||||
|
||||
Retrieves a list of events about the activity of a cluster. This API is
|
||||
paginated. If there are more events to read, the response includes all the
|
||||
nparameters necessary to request the next page of events.`,
|
||||
|
@ -458,6 +460,9 @@ var eventsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -481,7 +486,7 @@ var getCmd = &cobra.Command{
|
|||
Use: "get CLUSTER_ID",
|
||||
Short: `Get cluster info.`,
|
||||
Long: `Get cluster info.
|
||||
|
||||
|
||||
Retrieves the information for a cluster given its identifier. Clusters can be
|
||||
described while they are running, or up to 60 days after they are terminated.`,
|
||||
|
||||
|
@ -522,6 +527,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -542,11 +550,11 @@ var listCmd = &cobra.Command{
|
|||
Use: "list",
|
||||
Short: `List all clusters.`,
|
||||
Long: `List all clusters.
|
||||
|
||||
|
||||
Return information about all pinned clusters, active clusters, up to 200 of
|
||||
the most recently terminated all-purpose clusters in the past 30 days, and up
|
||||
to 30 of the most recently terminated job clusters in the past 30 days.
|
||||
|
||||
|
||||
For example, if there is 1 pinned cluster, 4 active clusters, 45 terminated
|
||||
all-purpose clusters in the past 30 days, and 50 terminated job clusters in
|
||||
the past 30 days, then this API returns the 1 pinned cluster, 4 active
|
||||
|
@ -579,6 +587,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-node-types command
|
||||
|
@ -592,7 +603,7 @@ var listNodeTypesCmd = &cobra.Command{
|
|||
Use: "list-node-types",
|
||||
Short: `List node types.`,
|
||||
Long: `List node types.
|
||||
|
||||
|
||||
Returns a list of supported Spark node types. These node types can be used to
|
||||
launch a cluster.`,
|
||||
|
||||
|
@ -607,6 +618,9 @@ var listNodeTypesCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-zones command
|
||||
|
@ -620,7 +634,7 @@ var listZonesCmd = &cobra.Command{
|
|||
Use: "list-zones",
|
||||
Short: `List availability zones.`,
|
||||
Long: `List availability zones.
|
||||
|
||||
|
||||
Returns a list of availability zones where clusters can be created in (For
|
||||
example, us-west-2a). These zones can be used to launch a cluster.`,
|
||||
|
||||
|
@ -635,6 +649,9 @@ var listZonesCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start permanent-delete command
|
||||
|
@ -653,10 +670,10 @@ var permanentDeleteCmd = &cobra.Command{
|
|||
Use: "permanent-delete CLUSTER_ID",
|
||||
Short: `Permanently delete cluster.`,
|
||||
Long: `Permanently delete cluster.
|
||||
|
||||
|
||||
Permanently deletes a Spark cluster. This cluster is terminated and resources
|
||||
are asynchronously removed.
|
||||
|
||||
|
||||
In addition, users will no longer see permanently deleted clusters in the
|
||||
cluster list, and API users can no longer perform any action on permanently
|
||||
deleted clusters.`,
|
||||
|
@ -698,6 +715,9 @@ var permanentDeleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start pin command
|
||||
|
@ -716,7 +736,7 @@ var pinCmd = &cobra.Command{
|
|||
Use: "pin CLUSTER_ID",
|
||||
Short: `Pin cluster.`,
|
||||
Long: `Pin cluster.
|
||||
|
||||
|
||||
Pinning a cluster ensures that the cluster will always be returned by the
|
||||
ListClusters API. Pinning a cluster that is already pinned will have no
|
||||
effect. This API can only be called by workspace admins.`,
|
||||
|
@ -758,6 +778,9 @@ var pinCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start resize command
|
||||
|
@ -784,7 +807,7 @@ var resizeCmd = &cobra.Command{
|
|||
Use: "resize CLUSTER_ID",
|
||||
Short: `Resize cluster.`,
|
||||
Long: `Resize cluster.
|
||||
|
||||
|
||||
Resizes a cluster to have a desired number of workers. This will fail unless
|
||||
the cluster is in a RUNNING state.`,
|
||||
|
||||
|
@ -819,29 +842,27 @@ var resizeCmd = &cobra.Command{
|
|||
resizeReq.ClusterId = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Clusters.Resize(ctx, resizeReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resizeSkipWait {
|
||||
err = w.Clusters.Resize(ctx, resizeReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Clusters.ResizeAndWait(ctx, resizeReq,
|
||||
retries.Timeout[compute.ClusterInfo](resizeTimeout),
|
||||
func(i *retries.Info[compute.ClusterInfo]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.StateMessage
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *compute.ClusterInfo) {
|
||||
statusMessage := i.StateMessage
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(resizeTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start restart command
|
||||
|
@ -867,7 +888,7 @@ var restartCmd = &cobra.Command{
|
|||
Use: "restart CLUSTER_ID",
|
||||
Short: `Restart cluster.`,
|
||||
Long: `Restart cluster.
|
||||
|
||||
|
||||
Restarts a Spark cluster with the supplied ID. If the cluster is not currently
|
||||
in a RUNNING state, nothing will happen.`,
|
||||
|
||||
|
@ -902,29 +923,27 @@ var restartCmd = &cobra.Command{
|
|||
restartReq.ClusterId = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Clusters.Restart(ctx, restartReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if restartSkipWait {
|
||||
err = w.Clusters.Restart(ctx, restartReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Clusters.RestartAndWait(ctx, restartReq,
|
||||
retries.Timeout[compute.ClusterInfo](restartTimeout),
|
||||
func(i *retries.Info[compute.ClusterInfo]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.StateMessage
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *compute.ClusterInfo) {
|
||||
statusMessage := i.StateMessage
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(restartTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start spark-versions command
|
||||
|
@ -938,7 +957,7 @@ var sparkVersionsCmd = &cobra.Command{
|
|||
Use: "spark-versions",
|
||||
Short: `List available Spark versions.`,
|
||||
Long: `List available Spark versions.
|
||||
|
||||
|
||||
Returns the list of available Spark versions. These versions can be used to
|
||||
launch a cluster.`,
|
||||
|
||||
|
@ -953,6 +972,9 @@ var sparkVersionsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start start command
|
||||
|
@ -976,10 +998,10 @@ var startCmd = &cobra.Command{
|
|||
Use: "start CLUSTER_ID",
|
||||
Short: `Start terminated cluster.`,
|
||||
Long: `Start terminated cluster.
|
||||
|
||||
|
||||
Starts a terminated Spark cluster with the supplied ID. This works similar to
|
||||
createCluster except:
|
||||
|
||||
|
||||
* The previous cluster id and attributes are preserved. * The cluster starts
|
||||
with the last specified cluster size. * If the previous cluster was an
|
||||
autoscaling cluster, the current cluster starts with the minimum number of
|
||||
|
@ -1017,29 +1039,27 @@ var startCmd = &cobra.Command{
|
|||
startReq.ClusterId = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Clusters.Start(ctx, startReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if startSkipWait {
|
||||
err = w.Clusters.Start(ctx, startReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Clusters.StartAndWait(ctx, startReq,
|
||||
retries.Timeout[compute.ClusterInfo](startTimeout),
|
||||
func(i *retries.Info[compute.ClusterInfo]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.StateMessage
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *compute.ClusterInfo) {
|
||||
statusMessage := i.StateMessage
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(startTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start unpin command
|
||||
|
@ -1058,7 +1078,7 @@ var unpinCmd = &cobra.Command{
|
|||
Use: "unpin CLUSTER_ID",
|
||||
Short: `Unpin cluster.`,
|
||||
Long: `Unpin cluster.
|
||||
|
||||
|
||||
Unpinning a cluster will allow the cluster to eventually be removed from the
|
||||
ListClusters API. Unpinning a cluster that is not pinned will have no effect.
|
||||
This API can only be called by workspace admins.`,
|
||||
|
@ -1100,6 +1120,9 @@ var unpinCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Clusters
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
||||
|
||||
package cmd
|
||||
package workspace
|
||||
|
||||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
|
@ -9,6 +9,7 @@ import (
|
|||
catalogs "github.com/databricks/cli/cmd/workspace/catalogs"
|
||||
cluster_policies "github.com/databricks/cli/cmd/workspace/cluster-policies"
|
||||
clusters "github.com/databricks/cli/cmd/workspace/clusters"
|
||||
connections "github.com/databricks/cli/cmd/workspace/connections"
|
||||
current_user "github.com/databricks/cli/cmd/workspace/current-user"
|
||||
dashboards "github.com/databricks/cli/cmd/workspace/dashboards"
|
||||
data_sources "github.com/databricks/cli/cmd/workspace/data-sources"
|
||||
|
@ -41,6 +42,7 @@ import (
|
|||
serving_endpoints "github.com/databricks/cli/cmd/workspace/serving-endpoints"
|
||||
shares "github.com/databricks/cli/cmd/workspace/shares"
|
||||
storage_credentials "github.com/databricks/cli/cmd/workspace/storage-credentials"
|
||||
system_schemas "github.com/databricks/cli/cmd/workspace/system-schemas"
|
||||
table_constraints "github.com/databricks/cli/cmd/workspace/table-constraints"
|
||||
tables "github.com/databricks/cli/cmd/workspace/tables"
|
||||
token_management "github.com/databricks/cli/cmd/workspace/token-management"
|
||||
|
@ -54,11 +56,11 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
|
||||
root.RootCmd.AddCommand(alerts.Cmd)
|
||||
root.RootCmd.AddCommand(catalogs.Cmd)
|
||||
root.RootCmd.AddCommand(cluster_policies.Cmd)
|
||||
root.RootCmd.AddCommand(clusters.Cmd)
|
||||
root.RootCmd.AddCommand(connections.Cmd)
|
||||
root.RootCmd.AddCommand(current_user.Cmd)
|
||||
root.RootCmd.AddCommand(dashboards.Cmd)
|
||||
root.RootCmd.AddCommand(data_sources.Cmd)
|
||||
|
@ -91,6 +93,7 @@ func init() {
|
|||
root.RootCmd.AddCommand(serving_endpoints.Cmd)
|
||||
root.RootCmd.AddCommand(shares.Cmd)
|
||||
root.RootCmd.AddCommand(storage_credentials.Cmd)
|
||||
root.RootCmd.AddCommand(system_schemas.Cmd)
|
||||
root.RootCmd.AddCommand(table_constraints.Cmd)
|
||||
root.RootCmd.AddCommand(tables.Cmd)
|
||||
root.RootCmd.AddCommand(token_management.Cmd)
|
||||
|
@ -101,4 +104,55 @@ func init() {
|
|||
root.RootCmd.AddCommand(workspace.Cmd)
|
||||
root.RootCmd.AddCommand(workspace_bindings.Cmd)
|
||||
root.RootCmd.AddCommand(workspace_conf.Cmd)
|
||||
|
||||
// Register commands with groups
|
||||
alerts.Cmd.GroupID = "sql"
|
||||
catalogs.Cmd.GroupID = "catalog"
|
||||
cluster_policies.Cmd.GroupID = "compute"
|
||||
clusters.Cmd.GroupID = "compute"
|
||||
connections.Cmd.GroupID = "catalog"
|
||||
current_user.Cmd.GroupID = "iam"
|
||||
dashboards.Cmd.GroupID = "sql"
|
||||
data_sources.Cmd.GroupID = "sql"
|
||||
experiments.Cmd.GroupID = "ml"
|
||||
external_locations.Cmd.GroupID = "catalog"
|
||||
functions.Cmd.GroupID = "catalog"
|
||||
git_credentials.Cmd.GroupID = "workspace"
|
||||
global_init_scripts.Cmd.GroupID = "compute"
|
||||
grants.Cmd.GroupID = "catalog"
|
||||
groups.Cmd.GroupID = "iam"
|
||||
instance_pools.Cmd.GroupID = "compute"
|
||||
instance_profiles.Cmd.GroupID = "compute"
|
||||
ip_access_lists.Cmd.GroupID = "settings"
|
||||
jobs.Cmd.GroupID = "jobs"
|
||||
libraries.Cmd.GroupID = "compute"
|
||||
metastores.Cmd.GroupID = "catalog"
|
||||
model_registry.Cmd.GroupID = "ml"
|
||||
permissions.Cmd.GroupID = "iam"
|
||||
pipelines.Cmd.GroupID = "pipelines"
|
||||
policy_families.Cmd.GroupID = "compute"
|
||||
providers.Cmd.GroupID = "sharing"
|
||||
queries.Cmd.GroupID = "sql"
|
||||
query_history.Cmd.GroupID = "sql"
|
||||
recipient_activation.Cmd.GroupID = "sharing"
|
||||
recipients.Cmd.GroupID = "sharing"
|
||||
repos.Cmd.GroupID = "workspace"
|
||||
schemas.Cmd.GroupID = "catalog"
|
||||
secrets.Cmd.GroupID = "workspace"
|
||||
service_principals.Cmd.GroupID = "iam"
|
||||
serving_endpoints.Cmd.GroupID = "serving"
|
||||
shares.Cmd.GroupID = "sharing"
|
||||
storage_credentials.Cmd.GroupID = "catalog"
|
||||
system_schemas.Cmd.GroupID = "catalog"
|
||||
table_constraints.Cmd.GroupID = "catalog"
|
||||
tables.Cmd.GroupID = "catalog"
|
||||
token_management.Cmd.GroupID = "settings"
|
||||
tokens.Cmd.GroupID = "settings"
|
||||
users.Cmd.GroupID = "iam"
|
||||
volumes.Cmd.GroupID = "catalog"
|
||||
warehouses.Cmd.GroupID = "sql"
|
||||
workspace.Cmd.GroupID = "workspace"
|
||||
workspace_bindings.Cmd.GroupID = "catalog"
|
||||
workspace_conf.Cmd.GroupID = "settings"
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,286 @@
|
|||
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
||||
|
||||
package connections
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/service/catalog"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var Cmd = &cobra.Command{
|
||||
Use: "connections",
|
||||
Short: `Connections allow for creating a connection to an external data source.`,
|
||||
Long: `Connections allow for creating a connection to an external data source.
|
||||
|
||||
A connection is an abstraction of an external data source that can be
|
||||
connected from Databricks Compute. Creating a connection object is the first
|
||||
step to managing external data sources within Unity Catalog, with the second
|
||||
step being creating a data object (catalog, schema, or table) using the
|
||||
connection. Data objects derived from a connection can be written to or read
|
||||
from similar to other Unity Catalog data objects based on cloud storage. Users
|
||||
may create different types of connections with each connection having a unique
|
||||
set of configuration options to support credential management and other
|
||||
settings.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
|
||||
// This service is being previewed; hide from help output.
|
||||
Hidden: true,
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
||||
var createReq catalog.CreateConnection
|
||||
var createJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(createCmd)
|
||||
// TODO: short flags
|
||||
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
createCmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `User-provided free-form text description.`)
|
||||
createCmd.Flags().StringVar(&createReq.Owner, "owner", createReq.Owner, `Username of current owner of the connection.`)
|
||||
// TODO: map via StringToStringVar: properties_kvpairs
|
||||
createCmd.Flags().BoolVar(&createReq.ReadOnly, "read-only", createReq.ReadOnly, `If the connection is read only.`)
|
||||
|
||||
}
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
Use: "create",
|
||||
Short: `Create a connection.`,
|
||||
Long: `Create a connection.
|
||||
|
||||
Creates a new connection
|
||||
|
||||
Creates a new connection to an external data source. It allows users to
|
||||
specify connection details and configurations for interaction with the
|
||||
external server.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = createJson.Unmarshal(&createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := w.Connections.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
||||
var deleteReq catalog.DeleteConnectionRequest
|
||||
var deleteJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(deleteCmd)
|
||||
// TODO: short flags
|
||||
deleteCmd.Flags().Var(&deleteJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
}
|
||||
|
||||
var deleteCmd = &cobra.Command{
|
||||
Use: "delete NAME_ARG",
|
||||
Short: `Delete a connection.`,
|
||||
Long: `Delete a connection.
|
||||
|
||||
Deletes the connection that matches the supplied name.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = deleteJson.Unmarshal(&deleteReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No NAME_ARG argument specified. Loading names for Connections drop-down."
|
||||
names, err := w.Connections.ConnectionInfoNameToFullNameMap(ctx)
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Connections drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The name of the connection to be deleted")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the name of the connection to be deleted")
|
||||
}
|
||||
deleteReq.NameArg = args[0]
|
||||
}
|
||||
|
||||
err = w.Connections.Delete(ctx, deleteReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
||||
var getReq catalog.GetConnectionRequest
|
||||
var getJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(getCmd)
|
||||
// TODO: short flags
|
||||
getCmd.Flags().Var(&getJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
}
|
||||
|
||||
var getCmd = &cobra.Command{
|
||||
Use: "get NAME_ARG",
|
||||
Short: `Get a connection.`,
|
||||
Long: `Get a connection.
|
||||
|
||||
Gets a connection from it's name.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = getJson.Unmarshal(&getReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No NAME_ARG argument specified. Loading names for Connections drop-down."
|
||||
names, err := w.Connections.ConnectionInfoNameToFullNameMap(ctx)
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Connections drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "Name of the connection")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have name of the connection")
|
||||
}
|
||||
getReq.NameArg = args[0]
|
||||
}
|
||||
|
||||
response, err := w.Connections.Get(ctx, getReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(listCmd)
|
||||
|
||||
}
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list",
|
||||
Short: `List connections.`,
|
||||
Long: `List connections.
|
||||
|
||||
List all connections.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
response, err := w.Connections.ListAll(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
||||
var updateReq catalog.UpdateConnection
|
||||
var updateJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(updateCmd)
|
||||
// TODO: short flags
|
||||
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
}
|
||||
|
||||
var updateCmd = &cobra.Command{
|
||||
Use: "update",
|
||||
Short: `Update a connection.`,
|
||||
Long: `Update a connection.
|
||||
|
||||
Updates the connection that matches the supplied name.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = updateJson.Unmarshal(&updateReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := w.Connections.Update(ctx, updateReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Connections
|
|
@ -13,6 +13,9 @@ var Cmd = &cobra.Command{
|
|||
Short: `This API allows retrieving information about currently authenticated user or service principal.`,
|
||||
Long: `This API allows retrieving information about currently authenticated user or
|
||||
service principal.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start me command
|
||||
|
@ -40,6 +43,9 @@ var meCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service CurrentUser
|
||||
|
|
|
@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
|
|||
since you can get a dashboard definition with a GET request and then POST it
|
||||
to create a new one. Dashboards can be scheduled using the sql_task type of
|
||||
the Jobs API, e.g. :method:jobs/create.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sql",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -71,6 +74,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -130,6 +136,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -189,6 +198,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -241,6 +253,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start restore command
|
||||
|
@ -299,6 +314,9 @@ var restoreCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Dashboards
|
||||
|
|
|
@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
|
|||
in your workspace. We advise you to use any text editor, REST client, or
|
||||
grep to search the response from this API for the name of your SQL warehouse
|
||||
as it appears in Databricks SQL.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sql",
|
||||
},
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -50,6 +53,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service DataSources
|
||||
|
|
|
@ -24,6 +24,9 @@ var Cmd = &cobra.Command{
|
|||
Experiments are located in the workspace file tree. You manage experiments
|
||||
using the same tools you use to manage other workspace objects such as
|
||||
folders, notebooks, and libraries.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "ml",
|
||||
},
|
||||
}
|
||||
|
||||
// start create-experiment command
|
||||
|
@ -80,6 +83,9 @@ var createExperimentCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create-run command
|
||||
|
@ -135,6 +141,9 @@ var createRunCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-experiment command
|
||||
|
@ -185,6 +194,9 @@ var deleteExperimentCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-run command
|
||||
|
@ -233,6 +245,9 @@ var deleteRunCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-tag command
|
||||
|
@ -283,6 +298,9 @@ var deleteTagCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-by-name command
|
||||
|
@ -339,6 +357,9 @@ var getByNameCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-experiment command
|
||||
|
@ -387,6 +408,9 @@ var getExperimentCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-history command
|
||||
|
@ -440,6 +464,9 @@ var getHistoryCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-run command
|
||||
|
@ -495,6 +522,9 @@ var getRunCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-artifacts command
|
||||
|
@ -548,6 +578,9 @@ var listArtifactsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-experiments command
|
||||
|
@ -599,6 +632,9 @@ var listExperimentsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start log-batch command
|
||||
|
@ -687,6 +723,9 @@ var logBatchCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start log-inputs command
|
||||
|
@ -738,6 +777,9 @@ var logInputsCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start log-metric command
|
||||
|
@ -800,6 +842,9 @@ var logMetricCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start log-model command
|
||||
|
@ -851,6 +896,9 @@ var logModelCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start log-param command
|
||||
|
@ -906,6 +954,9 @@ var logParamCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start restore-experiment command
|
||||
|
@ -959,6 +1010,9 @@ var restoreExperimentCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start restore-run command
|
||||
|
@ -1007,6 +1061,9 @@ var restoreRunCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start search-experiments command
|
||||
|
@ -1060,6 +1117,9 @@ var searchExperimentsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start search-runs command
|
||||
|
@ -1116,6 +1176,9 @@ var searchRunsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start set-experiment-tag command
|
||||
|
@ -1166,6 +1229,9 @@ var setExperimentTagCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start set-tag command
|
||||
|
@ -1219,6 +1285,9 @@ var setTagCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-experiment command
|
||||
|
@ -1269,6 +1338,9 @@ var updateExperimentCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-run command
|
||||
|
@ -1321,6 +1393,9 @@ var updateRunCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Experiments
|
||||
|
|
|
@ -26,6 +26,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
To create external locations, you must be a metastore admin or a user with the
|
||||
**CREATE_EXTERNAL_LOCATION** privilege.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -82,6 +85,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -133,6 +139,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -183,6 +192,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -213,6 +225,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -271,6 +286,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service ExternalLocations
|
||||
|
|
|
@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
|
|||
invoked wherever a table reference is allowed in a query. In Unity Catalog, a
|
||||
function resides at the same level as a table, so it can be referenced with
|
||||
the form __catalog_name__.__schema_name__.__function_name__.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -63,52 +66,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.Name = args[0]
|
||||
createReq.CatalogName = args[1]
|
||||
createReq.SchemaName = args[2]
|
||||
_, err = fmt.Sscan(args[3], &createReq.InputParams)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid INPUT_PARAMS: %s", args[3])
|
||||
}
|
||||
_, err = fmt.Sscan(args[4], &createReq.DataType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid DATA_TYPE: %s", args[4])
|
||||
}
|
||||
createReq.FullDataType = args[5]
|
||||
_, err = fmt.Sscan(args[6], &createReq.ReturnParams)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid RETURN_PARAMS: %s", args[6])
|
||||
}
|
||||
_, err = fmt.Sscan(args[7], &createReq.RoutineBody)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ROUTINE_BODY: %s", args[7])
|
||||
}
|
||||
createReq.RoutineDefinition = args[8]
|
||||
_, err = fmt.Sscan(args[9], &createReq.RoutineDependencies)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ROUTINE_DEPENDENCIES: %s", args[9])
|
||||
}
|
||||
_, err = fmt.Sscan(args[10], &createReq.ParameterStyle)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid PARAMETER_STYLE: %s", args[10])
|
||||
}
|
||||
_, err = fmt.Sscan(args[11], &createReq.IsDeterministic)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid IS_DETERMINISTIC: %s", args[11])
|
||||
}
|
||||
_, err = fmt.Sscan(args[12], &createReq.SqlDataAccess)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid SQL_DATA_ACCESS: %s", args[12])
|
||||
}
|
||||
_, err = fmt.Sscan(args[13], &createReq.IsNullCall)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid IS_NULL_CALL: %s", args[13])
|
||||
}
|
||||
_, err = fmt.Sscan(args[14], &createReq.SecurityType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid SECURITY_TYPE: %s", args[14])
|
||||
}
|
||||
createReq.SpecificName = args[15]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := w.Functions.Create(ctx, createReq)
|
||||
|
@ -117,6 +75,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -146,14 +107,7 @@ var deleteCmd = &cobra.Command{
|
|||
its parent catalog and the **USE_SCHEMA** privilege on its parent schema`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(1)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
|
@ -163,6 +117,23 @@ var deleteCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No NAME argument specified. Loading names for Functions drop-down."
|
||||
names, err := w.Functions.FunctionInfoNameToFullNameMap(ctx, catalog.ListFunctionsRequest{})
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Functions drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)")
|
||||
}
|
||||
deleteReq.Name = args[0]
|
||||
}
|
||||
|
||||
|
@ -172,6 +143,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -200,14 +174,7 @@ var getCmd = &cobra.Command{
|
|||
**EXECUTE** privilege on the function itself`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(1)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
|
@ -217,6 +184,23 @@ var getCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No NAME argument specified. Loading names for Functions drop-down."
|
||||
names, err := w.Functions.FunctionInfoNameToFullNameMap(ctx, catalog.ListFunctionsRequest{})
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Functions drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)")
|
||||
}
|
||||
getReq.Name = args[0]
|
||||
}
|
||||
|
||||
|
@ -226,6 +210,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -275,12 +262,15 @@ var listCmd = &cobra.Command{
|
|||
listReq.SchemaName = args[1]
|
||||
}
|
||||
|
||||
response, err := w.Functions.List(ctx, listReq)
|
||||
response, err := w.Functions.ListAll(ctx, listReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -312,14 +302,7 @@ var updateCmd = &cobra.Command{
|
|||
function's parent schema.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(1)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
|
@ -329,6 +312,23 @@ var updateCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No NAME argument specified. Loading names for Functions drop-down."
|
||||
names, err := w.Functions.FunctionInfoNameToFullNameMap(ctx, catalog.ListFunctionsRequest{})
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Functions drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)")
|
||||
}
|
||||
updateReq.Name = args[0]
|
||||
}
|
||||
|
||||
|
@ -338,6 +338,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Functions
|
||||
|
|
|
@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
|
|||
See [more info].
|
||||
|
||||
[more info]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html`,
|
||||
Annotations: map[string]string{
|
||||
"package": "workspace",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -75,6 +78,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -136,6 +142,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -197,6 +206,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -225,6 +237,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -290,6 +305,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service GitCredentials
|
||||
|
|
|
@ -24,6 +24,9 @@ var Cmd = &cobra.Command{
|
|||
script returns with a bad exit code, the Apache Spark container fails to
|
||||
launch and init scripts with later position are skipped. If enough containers
|
||||
fail, the entire cluster fails with a GLOBAL_INIT_SCRIPT_FAILURE error code.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "compute",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -76,6 +79,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -134,6 +140,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -192,6 +201,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -222,6 +234,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -276,6 +291,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service GlobalInitScripts
|
||||
|
|
|
@ -26,6 +26,9 @@ var Cmd = &cobra.Command{
|
|||
automatically grants the privilege to all current and future objects within
|
||||
the catalog. Similarly, privileges granted on a schema are inherited by all
|
||||
current and future objects within that schema.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -80,6 +83,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-effective command
|
||||
|
@ -134,6 +140,9 @@ var getEffectiveCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -188,6 +197,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Grants
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package workspace
|
||||
|
||||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Groups returns an ordered list of command groups.
|
||||
// The order matches the order used in the Databricks API explorer.
|
||||
func Groups() []cobra.Group {
|
||||
return []cobra.Group{
|
||||
{
|
||||
ID: "workspace",
|
||||
Title: "Databricks Workspace",
|
||||
},
|
||||
{
|
||||
ID: "compute",
|
||||
Title: "Compute",
|
||||
},
|
||||
{
|
||||
ID: "jobs",
|
||||
Title: "Jobs",
|
||||
},
|
||||
{
|
||||
ID: "pipelines",
|
||||
Title: "Delta Live Tables",
|
||||
},
|
||||
{
|
||||
ID: "ml",
|
||||
Title: "Machine Learning",
|
||||
},
|
||||
{
|
||||
ID: "serving",
|
||||
Title: "Real-time Serving",
|
||||
},
|
||||
{
|
||||
ID: "iam",
|
||||
Title: "Identity and Access Management",
|
||||
},
|
||||
{
|
||||
ID: "sql",
|
||||
Title: "Databricks SQL",
|
||||
},
|
||||
{
|
||||
ID: "catalog",
|
||||
Title: "Unity Catalog",
|
||||
},
|
||||
{
|
||||
ID: "sharing",
|
||||
Title: "Delta Sharing",
|
||||
},
|
||||
{
|
||||
ID: "settings",
|
||||
Title: "Settings",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Register groups with parent command
|
||||
groups := Groups()
|
||||
for i := range groups {
|
||||
root.RootCmd.AddGroup(&groups[i])
|
||||
}
|
||||
}
|
|
@ -22,6 +22,9 @@ var Cmd = &cobra.Command{
|
|||
in Unity Catalog to groups, instead of to users individually. All Databricks
|
||||
workspace identities can be assigned as members of groups, and members inherit
|
||||
permissions that are assigned to their group.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -78,6 +81,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -136,6 +142,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -194,6 +203,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -249,6 +261,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start patch command
|
||||
|
@ -309,6 +324,9 @@ var patchCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -375,6 +393,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Groups
|
||||
|
|
|
@ -33,6 +33,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
Databricks does not charge DBUs while instances are idle in the pool. Instance
|
||||
provider billing does apply. See pricing.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "compute",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -50,6 +53,7 @@ func init() {
|
|||
// TODO: map via StringToStringVar: custom_tags
|
||||
// TODO: complex arg: disk_spec
|
||||
createCmd.Flags().BoolVar(&createReq.EnableElasticDisk, "enable-elastic-disk", createReq.EnableElasticDisk, `Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire additional disk space when its Spark workers are running low on disk space.`)
|
||||
// TODO: complex arg: gcp_attributes
|
||||
createCmd.Flags().IntVar(&createReq.IdleInstanceAutoterminationMinutes, "idle-instance-autotermination-minutes", createReq.IdleInstanceAutoterminationMinutes, `Automatically terminates the extra instances in the pool cache after they are inactive for this time in minutes if min_idle_instances requirement is already met.`)
|
||||
// TODO: complex arg: instance_pool_fleet_attributes
|
||||
createCmd.Flags().IntVar(&createReq.MaxCapacity, "max-capacity", createReq.MaxCapacity, `Maximum number of outstanding instances to keep in the pool, including both instances used by clusters and idle instances.`)
|
||||
|
@ -94,6 +98,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -153,6 +160,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start edit command
|
||||
|
@ -170,6 +180,7 @@ func init() {
|
|||
// TODO: map via StringToStringVar: custom_tags
|
||||
// TODO: complex arg: disk_spec
|
||||
editCmd.Flags().BoolVar(&editReq.EnableElasticDisk, "enable-elastic-disk", editReq.EnableElasticDisk, `Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire additional disk space when its Spark workers are running low on disk space.`)
|
||||
// TODO: complex arg: gcp_attributes
|
||||
editCmd.Flags().IntVar(&editReq.IdleInstanceAutoterminationMinutes, "idle-instance-autotermination-minutes", editReq.IdleInstanceAutoterminationMinutes, `Automatically terminates the extra instances in the pool cache after they are inactive for this time in minutes if min_idle_instances requirement is already met.`)
|
||||
// TODO: complex arg: instance_pool_fleet_attributes
|
||||
editCmd.Flags().IntVar(&editReq.MaxCapacity, "max-capacity", editReq.MaxCapacity, `Maximum number of outstanding instances to keep in the pool, including both instances used by clusters and idle instances.`)
|
||||
|
@ -215,6 +226,9 @@ var editCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -273,6 +287,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -300,6 +317,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service InstancePools
|
||||
|
|
|
@ -19,6 +19,9 @@ var Cmd = &cobra.Command{
|
|||
instance profiles for more information.
|
||||
|
||||
[Secure access to S3 buckets]: https://docs.databricks.com/administration-guide/cloud-configurations/aws/instance-profiles.html`,
|
||||
Annotations: map[string]string{
|
||||
"package": "compute",
|
||||
},
|
||||
}
|
||||
|
||||
// start add command
|
||||
|
@ -72,6 +75,9 @@ var addCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start edit command
|
||||
|
@ -137,6 +143,9 @@ var editCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -166,6 +175,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start remove command
|
||||
|
@ -217,6 +229,9 @@ var removeCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service InstanceProfiles
|
||||
|
|
|
@ -36,6 +36,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
After changes to the IP access list feature, it can take a few minutes for
|
||||
changes to take effect.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "settings",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -83,15 +86,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.Label = args[0]
|
||||
_, err = fmt.Sscan(args[1], &createReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[1])
|
||||
}
|
||||
_, err = fmt.Sscan(args[2], &createReq.IpAddresses)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid IP_ADDRESSES: %s", args[2])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := w.IpAccessLists.Create(ctx, createReq)
|
||||
|
@ -100,6 +95,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -158,6 +156,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -216,6 +217,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -243,6 +247,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start replace command
|
||||
|
@ -288,20 +295,7 @@ var replaceCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
replaceReq.Label = args[0]
|
||||
_, err = fmt.Sscan(args[1], &replaceReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[1])
|
||||
}
|
||||
_, err = fmt.Sscan(args[2], &replaceReq.IpAddresses)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid IP_ADDRESSES: %s", args[2])
|
||||
}
|
||||
_, err = fmt.Sscan(args[3], &replaceReq.Enabled)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ENABLED: %s", args[3])
|
||||
}
|
||||
replaceReq.IpAccessListId = args[4]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = w.IpAccessLists.Replace(ctx, replaceReq)
|
||||
|
@ -310,6 +304,9 @@ var replaceCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -359,20 +356,7 @@ var updateCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
updateReq.Label = args[0]
|
||||
_, err = fmt.Sscan(args[1], &updateReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[1])
|
||||
}
|
||||
_, err = fmt.Sscan(args[2], &updateReq.IpAddresses)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid IP_ADDRESSES: %s", args[2])
|
||||
}
|
||||
_, err = fmt.Sscan(args[3], &updateReq.Enabled)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ENABLED: %s", args[3])
|
||||
}
|
||||
updateReq.IpAccessListId = args[4]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = w.IpAccessLists.Update(ctx, updateReq)
|
||||
|
@ -381,6 +365,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service IpAccessLists
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/retries"
|
||||
"github.com/databricks/databricks-sdk-go/service/jobs"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -35,6 +34,9 @@ var Cmd = &cobra.Command{
|
|||
[Databricks CLI]: https://docs.databricks.com/dev-tools/cli/index.html
|
||||
[Secrets CLI]: https://docs.databricks.com/dev-tools/cli/secrets-cli.html
|
||||
[Secrets utility]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-secrets`,
|
||||
Annotations: map[string]string{
|
||||
"package": "jobs",
|
||||
},
|
||||
}
|
||||
|
||||
// start cancel-all-runs command
|
||||
|
@ -97,6 +99,9 @@ var cancelAllRunsCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start cancel-run command
|
||||
|
@ -158,36 +163,34 @@ var cancelRunCmd = &cobra.Command{
|
|||
}
|
||||
}
|
||||
|
||||
wait, err := w.Jobs.CancelRun(ctx, cancelRunReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if cancelRunSkipWait {
|
||||
err = w.Jobs.CancelRun(ctx, cancelRunReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Jobs.CancelRunAndWait(ctx, cancelRunReq,
|
||||
retries.Timeout[jobs.Run](cancelRunTimeout),
|
||||
func(i *retries.Info[jobs.Run]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.State == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State.LifeCycleState
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.State != nil {
|
||||
statusMessage = i.Info.State.StateMessage
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *jobs.Run) {
|
||||
if i.State == nil {
|
||||
return
|
||||
}
|
||||
status := i.State.LifeCycleState
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.State != nil {
|
||||
statusMessage = i.State.StateMessage
|
||||
}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(cancelRunTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -252,6 +255,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -313,6 +319,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-run command
|
||||
|
@ -374,6 +383,9 @@ var deleteRunCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start export-run command
|
||||
|
@ -437,6 +449,9 @@ var exportRunCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -498,6 +513,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-run command
|
||||
|
@ -566,6 +584,9 @@ var getRunCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-run-output command
|
||||
|
@ -636,6 +657,9 @@ var getRunOutputCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -652,6 +676,7 @@ func init() {
|
|||
listCmd.Flags().IntVar(&listReq.Limit, "limit", listReq.Limit, `The number of jobs to return.`)
|
||||
listCmd.Flags().StringVar(&listReq.Name, "name", listReq.Name, `A filter on the list based on the exact (case insensitive) job name.`)
|
||||
listCmd.Flags().IntVar(&listReq.Offset, "offset", listReq.Offset, `The offset of the first job to return, relative to the most recently created job.`)
|
||||
listCmd.Flags().StringVar(&listReq.PageToken, "page-token", listReq.PageToken, `Use next_page_token or prev_page_token returned from the previous request to list the next or previous page of jobs respectively.`)
|
||||
|
||||
}
|
||||
|
||||
|
@ -688,6 +713,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-runs command
|
||||
|
@ -706,6 +734,7 @@ func init() {
|
|||
listRunsCmd.Flags().Int64Var(&listRunsReq.JobId, "job-id", listRunsReq.JobId, `The job for which to list runs.`)
|
||||
listRunsCmd.Flags().IntVar(&listRunsReq.Limit, "limit", listRunsReq.Limit, `The number of runs to return.`)
|
||||
listRunsCmd.Flags().IntVar(&listRunsReq.Offset, "offset", listRunsReq.Offset, `The offset of the first run to return, relative to the most recent run.`)
|
||||
listRunsCmd.Flags().StringVar(&listRunsReq.PageToken, "page-token", listRunsReq.PageToken, `Use next_page_token or prev_page_token returned from the previous request to list the next or previous page of runs respectively.`)
|
||||
listRunsCmd.Flags().Var(&listRunsReq.RunType, "run-type", `The type of runs to return.`)
|
||||
listRunsCmd.Flags().IntVar(&listRunsReq.StartTimeFrom, "start-time-from", listRunsReq.StartTimeFrom, `Show runs that started _at or after_ this value.`)
|
||||
listRunsCmd.Flags().IntVar(&listRunsReq.StartTimeTo, "start-time-to", listRunsReq.StartTimeTo, `Show runs that started _at or before_ this value.`)
|
||||
|
@ -745,6 +774,9 @@ var listRunsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start repair-run command
|
||||
|
@ -819,36 +851,34 @@ var repairRunCmd = &cobra.Command{
|
|||
}
|
||||
}
|
||||
|
||||
wait, err := w.Jobs.RepairRun(ctx, repairRunReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if repairRunSkipWait {
|
||||
response, err := w.Jobs.RepairRun(ctx, repairRunReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Jobs.RepairRunAndWait(ctx, repairRunReq,
|
||||
retries.Timeout[jobs.Run](repairRunTimeout),
|
||||
func(i *retries.Info[jobs.Run]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.State == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State.LifeCycleState
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.State != nil {
|
||||
statusMessage = i.Info.State.StateMessage
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *jobs.Run) {
|
||||
if i.State == nil {
|
||||
return
|
||||
}
|
||||
status := i.State.LifeCycleState
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.State != nil {
|
||||
statusMessage = i.State.StateMessage
|
||||
}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(repairRunTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start reset command
|
||||
|
@ -882,14 +912,7 @@ var resetCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
_, err = fmt.Sscan(args[0], &resetReq.JobId)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid JOB_ID: %s", args[0])
|
||||
}
|
||||
_, err = fmt.Sscan(args[1], &resetReq.NewSettings)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid NEW_SETTINGS: %s", args[1])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = w.Jobs.Reset(ctx, resetReq)
|
||||
|
@ -898,6 +921,9 @@ var resetCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start run-now command
|
||||
|
@ -968,36 +994,34 @@ var runNowCmd = &cobra.Command{
|
|||
}
|
||||
}
|
||||
|
||||
wait, err := w.Jobs.RunNow(ctx, runNowReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if runNowSkipWait {
|
||||
response, err := w.Jobs.RunNow(ctx, runNowReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Jobs.RunNowAndWait(ctx, runNowReq,
|
||||
retries.Timeout[jobs.Run](runNowTimeout),
|
||||
func(i *retries.Info[jobs.Run]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.State == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State.LifeCycleState
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.State != nil {
|
||||
statusMessage = i.Info.State.StateMessage
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *jobs.Run) {
|
||||
if i.State == nil {
|
||||
return
|
||||
}
|
||||
status := i.State.LifeCycleState
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.State != nil {
|
||||
statusMessage = i.State.StateMessage
|
||||
}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(runNowTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start submit command
|
||||
|
@ -1056,36 +1080,34 @@ var submitCmd = &cobra.Command{
|
|||
} else {
|
||||
}
|
||||
|
||||
wait, err := w.Jobs.Submit(ctx, submitReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if submitSkipWait {
|
||||
response, err := w.Jobs.Submit(ctx, submitReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Jobs.SubmitAndWait(ctx, submitReq,
|
||||
retries.Timeout[jobs.Run](submitTimeout),
|
||||
func(i *retries.Info[jobs.Run]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.State == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State.LifeCycleState
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.State != nil {
|
||||
statusMessage = i.Info.State.StateMessage
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *jobs.Run) {
|
||||
if i.State == nil {
|
||||
return
|
||||
}
|
||||
status := i.State.LifeCycleState
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.State != nil {
|
||||
statusMessage = i.State.StateMessage
|
||||
}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(submitTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -1151,6 +1173,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Jobs
|
||||
|
|
|
@ -35,6 +35,9 @@ var Cmd = &cobra.Command{
|
|||
When you uninstall a library from a cluster, the library is removed only when
|
||||
you restart the cluster. Until you restart the cluster, the status of the
|
||||
uninstalled library appears as Uninstall pending restart.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "compute",
|
||||
},
|
||||
}
|
||||
|
||||
// start all-cluster-statuses command
|
||||
|
@ -64,6 +67,9 @@ var allClusterStatusesCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start cluster-status command
|
||||
|
@ -126,6 +132,9 @@ var clusterStatusCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start install command
|
||||
|
@ -163,11 +172,7 @@ var installCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
installReq.ClusterId = args[0]
|
||||
_, err = fmt.Sscan(args[1], &installReq.Libraries)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIBRARIES: %s", args[1])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = w.Libraries.Install(ctx, installReq)
|
||||
|
@ -176,6 +181,9 @@ var installCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start uninstall command
|
||||
|
@ -210,11 +218,7 @@ var uninstallCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
uninstallReq.ClusterId = args[0]
|
||||
_, err = fmt.Sscan(args[1], &uninstallReq.Libraries)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIBRARIES: %s", args[1])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
err = w.Libraries.Uninstall(ctx, uninstallReq)
|
||||
|
@ -223,6 +227,9 @@ var uninstallCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Libraries
|
||||
|
|
|
@ -28,6 +28,9 @@ var Cmd = &cobra.Command{
|
|||
workspaces created before Unity Catalog was released. If your workspace
|
||||
includes a legacy Hive metastore, the data in that metastore is available in a
|
||||
catalog named hive_metastore.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start assign command
|
||||
|
@ -83,6 +86,9 @@ var assignCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -134,6 +140,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start current command
|
||||
|
@ -161,6 +170,9 @@ var currentCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -221,6 +233,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -280,6 +295,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -309,6 +327,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start maintenance command
|
||||
|
@ -330,6 +351,9 @@ var maintenanceCmd = &cobra.Command{
|
|||
|
||||
Enables or disables auto maintenance on the metastore.`,
|
||||
|
||||
// This command is being previewed; hide from help output.
|
||||
Hidden: true,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(2)
|
||||
|
@ -361,6 +385,9 @@ var maintenanceCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start summary command
|
||||
|
@ -389,6 +416,9 @@ var summaryCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start unassign command
|
||||
|
@ -441,6 +471,9 @@ var unassignCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -508,6 +541,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-assignment command
|
||||
|
@ -575,6 +611,9 @@ var updateAssignmentCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Metastores
|
||||
|
|
|
@ -17,6 +17,9 @@ var Cmd = &cobra.Command{
|
|||
Short: `MLflow Model Registry is a centralized model repository and a UI and set of APIs that enable you to manage the full lifecycle of MLflow Models.`,
|
||||
Long: `MLflow Model Registry is a centralized model repository and a UI and set of
|
||||
APIs that enable you to manage the full lifecycle of MLflow Models.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "ml",
|
||||
},
|
||||
}
|
||||
|
||||
// start approve-transition-request command
|
||||
|
@ -76,6 +79,9 @@ var approveTransitionRequestCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create-comment command
|
||||
|
@ -128,6 +134,9 @@ var createCommentCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create-model command
|
||||
|
@ -182,6 +191,9 @@ var createModelCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create-model-version command
|
||||
|
@ -236,6 +248,9 @@ var createModelVersionCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create-transition-request command
|
||||
|
@ -291,6 +306,9 @@ var createTransitionRequestCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create-webhook command
|
||||
|
@ -331,10 +349,7 @@ var createWebhookCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
_, err = fmt.Sscan(args[0], &createWebhookReq.Events)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid EVENTS: %s", args[0])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := w.ModelRegistry.CreateWebhook(ctx, createWebhookReq)
|
||||
|
@ -343,6 +358,9 @@ var createWebhookCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-comment command
|
||||
|
@ -391,6 +409,9 @@ var deleteCommentCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-model command
|
||||
|
@ -439,6 +460,9 @@ var deleteModelCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-model-tag command
|
||||
|
@ -488,6 +512,9 @@ var deleteModelTagCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-model-version command
|
||||
|
@ -537,6 +564,9 @@ var deleteModelVersionCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-model-version-tag command
|
||||
|
@ -587,6 +617,9 @@ var deleteModelVersionTagCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-transition-request command
|
||||
|
@ -643,6 +676,9 @@ var deleteTransitionRequestCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-webhook command
|
||||
|
@ -694,6 +730,9 @@ var deleteWebhookCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-latest-versions command
|
||||
|
@ -744,6 +783,9 @@ var getLatestVersionsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-model command
|
||||
|
@ -796,6 +838,9 @@ var getModelCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-model-version command
|
||||
|
@ -845,6 +890,9 @@ var getModelVersionCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-model-version-download-uri command
|
||||
|
@ -894,6 +942,9 @@ var getModelVersionDownloadUriCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-models command
|
||||
|
@ -945,6 +996,9 @@ var listModelsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-transition-requests command
|
||||
|
@ -994,6 +1048,9 @@ var listTransitionRequestsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-webhooks command
|
||||
|
@ -1047,6 +1104,9 @@ var listWebhooksCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start reject-transition-request command
|
||||
|
@ -1102,6 +1162,9 @@ var rejectTransitionRequestCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start rename-model command
|
||||
|
@ -1152,6 +1215,9 @@ var renameModelCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start search-model-versions command
|
||||
|
@ -1204,6 +1270,9 @@ var searchModelVersionsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start search-models command
|
||||
|
@ -1256,6 +1325,9 @@ var searchModelsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start set-model-tag command
|
||||
|
@ -1306,6 +1378,9 @@ var setModelTagCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start set-model-version-tag command
|
||||
|
@ -1357,6 +1432,9 @@ var setModelVersionTagCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start test-registry-webhook command
|
||||
|
@ -1409,6 +1487,9 @@ var testRegistryWebhookCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start transition-stage command
|
||||
|
@ -1472,6 +1553,9 @@ var transitionStageCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-comment command
|
||||
|
@ -1521,6 +1605,9 @@ var updateCommentCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-model command
|
||||
|
@ -1571,6 +1658,9 @@ var updateModelCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-model-version command
|
||||
|
@ -1622,6 +1712,9 @@ var updateModelVersionCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-webhook command
|
||||
|
@ -1678,6 +1771,9 @@ var updateWebhookCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service ModelRegistry
|
||||
|
|
|
@ -15,6 +15,9 @@ var Cmd = &cobra.Command{
|
|||
Short: `Permissions API are used to create read, write, edit, update and manage access for various users on different objects and endpoints.`,
|
||||
Long: `Permissions API are used to create read, write, edit, update and manage access
|
||||
for various users on different objects and endpoints.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -65,6 +68,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-permission-levels command
|
||||
|
@ -114,6 +120,9 @@ var getPermissionLevelsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start set command
|
||||
|
@ -166,6 +175,9 @@ var setCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -217,6 +229,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Permissions
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/retries"
|
||||
"github.com/databricks/databricks-sdk-go/service/pipelines"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -31,6 +30,9 @@ var Cmd = &cobra.Command{
|
|||
quality with Delta Live Tables expectations. Expectations allow you to define
|
||||
expected data quality and specify how to handle records that fail those
|
||||
expectations.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "pipelines",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -98,6 +100,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -156,6 +161,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -217,6 +225,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-update command
|
||||
|
@ -266,6 +277,9 @@ var getUpdateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-pipeline-events command
|
||||
|
@ -329,6 +343,9 @@ var listPipelineEventsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-pipelines command
|
||||
|
@ -381,6 +398,9 @@ var listPipelinesCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-updates command
|
||||
|
@ -443,6 +463,9 @@ var listUpdatesCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start reset command
|
||||
|
@ -500,29 +523,27 @@ var resetCmd = &cobra.Command{
|
|||
resetReq.PipelineId = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Pipelines.Reset(ctx, resetReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if resetSkipWait {
|
||||
err = w.Pipelines.Reset(ctx, resetReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Pipelines.ResetAndWait(ctx, resetReq,
|
||||
retries.Timeout[pipelines.GetPipelineResponse](resetTimeout),
|
||||
func(i *retries.Info[pipelines.GetPipelineResponse]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.Cause
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *pipelines.GetPipelineResponse) {
|
||||
statusMessage := i.Cause
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(resetTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start start-update command
|
||||
|
@ -586,6 +607,9 @@ var startUpdateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start stop command
|
||||
|
@ -643,29 +667,27 @@ var stopCmd = &cobra.Command{
|
|||
stopReq.PipelineId = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Pipelines.Stop(ctx, stopReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if stopSkipWait {
|
||||
err = w.Pipelines.Stop(ctx, stopReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Pipelines.StopAndWait(ctx, stopReq,
|
||||
retries.Timeout[pipelines.GetPipelineResponse](stopTimeout),
|
||||
func(i *retries.Info[pipelines.GetPipelineResponse]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
statusMessage := i.Info.Cause
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *pipelines.GetPipelineResponse) {
|
||||
statusMessage := i.Cause
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(stopTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -744,6 +766,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Pipelines
|
||||
|
|
|
@ -22,6 +22,9 @@ var Cmd = &cobra.Command{
|
|||
Policy families cannot be used directly to create clusters. Instead, you
|
||||
create cluster policies using a policy family. Cluster policies created using
|
||||
a policy family inherit the policy family's policy definition.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "compute",
|
||||
},
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -66,6 +69,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -112,6 +118,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service PolicyFamilies
|
||||
|
|
|
@ -16,6 +16,9 @@ var Cmd = &cobra.Command{
|
|||
Use: "providers",
|
||||
Short: `Databricks Providers REST API.`,
|
||||
Long: `Databricks Providers REST API`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sharing",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -72,6 +75,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -131,6 +137,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -191,6 +200,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -243,6 +255,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-shares command
|
||||
|
@ -303,6 +318,9 @@ var listSharesCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -369,6 +387,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Providers
|
||||
|
|
|
@ -19,6 +19,9 @@ var Cmd = &cobra.Command{
|
|||
definitions include the target SQL warehouse, query text, name, description,
|
||||
tags, parameters, and visualizations. Queries can be scheduled using the
|
||||
sql_task type of the Jobs API, e.g. :method:jobs/create.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sql",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -81,6 +84,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -141,6 +147,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -200,6 +209,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -253,6 +265,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start restore command
|
||||
|
@ -312,6 +327,9 @@ var restoreCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -378,6 +396,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Queries
|
||||
|
|
|
@ -14,6 +14,9 @@ var Cmd = &cobra.Command{
|
|||
Use: "query-history",
|
||||
Short: `Access the history of queries through SQL warehouses.`,
|
||||
Long: `Access the history of queries through SQL warehouses.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sql",
|
||||
},
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -68,6 +71,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service QueryHistory
|
||||
|
|
|
@ -14,6 +14,9 @@ var Cmd = &cobra.Command{
|
|||
Use: "recipient-activation",
|
||||
Short: `Databricks Recipient Activation REST API.`,
|
||||
Long: `Databricks Recipient Activation REST API`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sharing",
|
||||
},
|
||||
}
|
||||
|
||||
// start get-activation-url-info command
|
||||
|
@ -62,6 +65,9 @@ var getActivationUrlInfoCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start retrieve-token command
|
||||
|
@ -111,6 +117,9 @@ var retrieveTokenCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service RecipientActivation
|
||||
|
|
|
@ -16,6 +16,9 @@ var Cmd = &cobra.Command{
|
|||
Use: "recipients",
|
||||
Short: `Databricks Recipients REST API.`,
|
||||
Long: `Databricks Recipients REST API`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sharing",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -77,6 +80,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -136,6 +142,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -196,6 +205,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -248,6 +260,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start rotate-token command
|
||||
|
@ -301,6 +316,9 @@ var rotateTokenCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start share-permissions command
|
||||
|
@ -360,6 +378,9 @@ var sharePermissionsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -426,6 +447,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Recipients
|
||||
|
|
|
@ -25,6 +25,9 @@ var Cmd = &cobra.Command{
|
|||
Within Repos you can develop code in notebooks or other files and follow data
|
||||
science and engineering code development best practices using Git for version
|
||||
control, collaboration, and CI/CD.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "workspace",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -79,6 +82,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -140,6 +146,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -201,6 +210,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -252,6 +264,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -318,6 +333,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Repos
|
||||
|
|
|
@ -20,6 +20,9 @@ var Cmd = &cobra.Command{
|
|||
access (or list) a table or view in a schema, users must have the USE_SCHEMA
|
||||
data permission on the schema and its parent catalog, and they must have the
|
||||
SELECT permission on the table or view.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -75,6 +78,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -134,6 +140,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -194,6 +203,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -246,6 +258,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -313,6 +328,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Schemas
|
||||
|
|
|
@ -27,6 +27,9 @@ var Cmd = &cobra.Command{
|
|||
Databricks secrets. While Databricks makes an effort to redact secret values
|
||||
that might be displayed in notebooks, it is not possible to prevent such users
|
||||
from reading secrets.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "workspace",
|
||||
},
|
||||
}
|
||||
|
||||
// start create-scope command
|
||||
|
@ -81,6 +84,9 @@ var createScopeCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-acl command
|
||||
|
@ -135,6 +141,9 @@ var deleteAclCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-scope command
|
||||
|
@ -187,6 +196,9 @@ var deleteScopeCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete-secret command
|
||||
|
@ -241,6 +253,9 @@ var deleteSecretCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-acl command
|
||||
|
@ -295,6 +310,9 @@ var getAclCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-acls command
|
||||
|
@ -348,6 +366,9 @@ var listAclsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-scopes command
|
||||
|
@ -378,6 +399,9 @@ var listScopesCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-secrets command
|
||||
|
@ -433,6 +457,9 @@ var listSecretsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start put-acl command
|
||||
|
@ -511,6 +538,9 @@ var putAclCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Secrets
|
||||
|
|
|
@ -21,6 +21,9 @@ var Cmd = &cobra.Command{
|
|||
production data run with service principals, interactive users do not need any
|
||||
write, delete, or modify privileges in production. This eliminates the risk of
|
||||
a user overwriting production data by accident.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -77,6 +80,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -135,6 +141,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -194,6 +203,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -249,6 +261,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start patch command
|
||||
|
@ -310,6 +325,9 @@ var patchCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -379,6 +397,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service ServicePrincipals
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/retries"
|
||||
"github.com/databricks/databricks-sdk-go/service/serving"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -30,6 +29,9 @@ var Cmd = &cobra.Command{
|
|||
define how requests should be routed to your served models behind an endpoint.
|
||||
Additionally, you can configure the scale of resources that should be applied
|
||||
to each served model.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "serving",
|
||||
},
|
||||
}
|
||||
|
||||
// start build-logs command
|
||||
|
@ -80,6 +82,9 @@ var buildLogsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -115,37 +120,31 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.Name = args[0]
|
||||
_, err = fmt.Sscan(args[1], &createReq.Config)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid CONFIG: %s", args[1])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
wait, err := w.ServingEndpoints.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if createSkipWait {
|
||||
response, err := w.ServingEndpoints.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.ServingEndpoints.CreateAndWait(ctx, createReq,
|
||||
retries.Timeout[serving.ServingEndpointDetailed](createTimeout),
|
||||
func(i *retries.Info[serving.ServingEndpointDetailed]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State.ConfigUpdate
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *serving.ServingEndpointDetailed) {
|
||||
status := i.State.ConfigUpdate
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(createTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -192,6 +191,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start export-metrics command
|
||||
|
@ -242,6 +244,9 @@ var exportMetricsCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -290,6 +295,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -309,12 +317,15 @@ var listCmd = &cobra.Command{
|
|||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
response, err := w.ServingEndpoints.List(ctx)
|
||||
response, err := w.ServingEndpoints.ListAll(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start logs command
|
||||
|
@ -365,6 +376,9 @@ var logsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start query command
|
||||
|
@ -411,6 +425,9 @@ var queryCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-config command
|
||||
|
@ -453,37 +470,31 @@ var updateConfigCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
_, err = fmt.Sscan(args[0], &updateConfigReq.ServedModels)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid SERVED_MODELS: %s", args[0])
|
||||
}
|
||||
updateConfigReq.Name = args[1]
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
wait, err := w.ServingEndpoints.UpdateConfig(ctx, updateConfigReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if updateConfigSkipWait {
|
||||
response, err := w.ServingEndpoints.UpdateConfig(ctx, updateConfigReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.ServingEndpoints.UpdateConfigAndWait(ctx, updateConfigReq,
|
||||
retries.Timeout[serving.ServingEndpointDetailed](updateConfigTimeout),
|
||||
func(i *retries.Info[serving.ServingEndpointDetailed]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State.ConfigUpdate
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *serving.ServingEndpointDetailed) {
|
||||
status := i.State.ConfigUpdate
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(updateConfigTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service ServingEndpoints
|
||||
|
|
|
@ -14,6 +14,9 @@ var Cmd = &cobra.Command{
|
|||
Use: "shares",
|
||||
Short: `Databricks Shares REST API.`,
|
||||
Long: `Databricks Shares REST API`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sharing",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -66,6 +69,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -115,6 +121,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -166,6 +175,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -195,6 +207,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start share-permissions command
|
||||
|
@ -244,6 +259,9 @@ var sharePermissionsCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -310,6 +328,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update-permissions command
|
||||
|
@ -364,6 +385,9 @@ var updatePermissionsCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Shares
|
||||
|
|
|
@ -28,6 +28,9 @@ var Cmd = &cobra.Command{
|
|||
To create storage credentials, you must be a Databricks account admin. The
|
||||
account admin who creates the storage credential can delegate ownership to
|
||||
another user or group to manage permissions on it.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -41,9 +44,10 @@ func init() {
|
|||
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
// TODO: complex arg: aws_iam_role
|
||||
// TODO: complex arg: azure_managed_identity
|
||||
// TODO: complex arg: azure_service_principal
|
||||
createCmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `Comment associated with the credential.`)
|
||||
// TODO: complex arg: gcp_service_account_key
|
||||
// TODO: output-only field
|
||||
createCmd.Flags().BoolVar(&createReq.ReadOnly, "read-only", createReq.ReadOnly, `Whether the storage credential is only usable for read operations.`)
|
||||
createCmd.Flags().BoolVar(&createReq.SkipValidation, "skip-validation", createReq.SkipValidation, `Supplying true to this argument skips validation of the created credential.`)
|
||||
|
||||
|
@ -56,14 +60,22 @@ var createCmd = &cobra.Command{
|
|||
|
||||
Creates a new storage credential. The request object is specific to the cloud:
|
||||
|
||||
* **AwsIamRole** for AWS credentials * **AzureServicePrincipal** for Azure
|
||||
credentials * **GcpServiceAcountKey** for GCP credentials.
|
||||
* **AwsIamRole** for AWS credentials. * **AzureServicePrincipal** for Azure
|
||||
credentials. * **AzureManagedIdentity** for Azure managed credentials. *
|
||||
**DatabricksGcpServiceAccount** for GCP managed credentials.
|
||||
|
||||
The caller must be a metastore admin and have the
|
||||
**CREATE_STORAGE_CREDENTIAL** privilege on the metastore.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(1)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
|
@ -73,20 +85,6 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
names, err := w.StorageCredentials.StorageCredentialInfoNameToIdMap(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The credential name")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the credential name")
|
||||
}
|
||||
createReq.Name = args[0]
|
||||
}
|
||||
|
||||
|
@ -96,6 +94,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -132,9 +133,12 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No NAME argument specified. Loading names for Storage Credentials drop-down."
|
||||
names, err := w.StorageCredentials.StorageCredentialInfoNameToIdMap(ctx)
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to load names for Storage Credentials drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "Name of the storage credential")
|
||||
if err != nil {
|
||||
|
@ -154,6 +158,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -189,9 +196,12 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No NAME argument specified. Loading names for Storage Credentials drop-down."
|
||||
names, err := w.StorageCredentials.StorageCredentialInfoNameToIdMap(ctx)
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to load names for Storage Credentials drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "Name of the storage credential")
|
||||
if err != nil {
|
||||
|
@ -211,6 +221,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -242,6 +255,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -255,10 +271,11 @@ func init() {
|
|||
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
// TODO: complex arg: aws_iam_role
|
||||
// TODO: complex arg: azure_managed_identity
|
||||
// TODO: complex arg: azure_service_principal
|
||||
updateCmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `Comment associated with the credential.`)
|
||||
// TODO: output-only field
|
||||
updateCmd.Flags().BoolVar(&updateReq.Force, "force", updateReq.Force, `Force update even if there are dependent external locations or external tables.`)
|
||||
// TODO: complex arg: gcp_service_account_key
|
||||
updateCmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `The credential name.`)
|
||||
updateCmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `Username of current owner of credential.`)
|
||||
updateCmd.Flags().BoolVar(&updateReq.ReadOnly, "read-only", updateReq.ReadOnly, `Whether the storage credential is only usable for read operations.`)
|
||||
|
@ -287,9 +304,12 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
} else {
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No NAME argument specified. Loading names for Storage Credentials drop-down."
|
||||
names, err := w.StorageCredentials.StorageCredentialInfoNameToIdMap(ctx)
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to load names for Storage Credentials drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The credential name")
|
||||
if err != nil {
|
||||
|
@ -309,6 +329,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start validate command
|
||||
|
@ -322,9 +345,10 @@ func init() {
|
|||
validateCmd.Flags().Var(&validateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
// TODO: complex arg: aws_iam_role
|
||||
// TODO: complex arg: azure_managed_identity
|
||||
// TODO: complex arg: azure_service_principal
|
||||
// TODO: output-only field
|
||||
validateCmd.Flags().StringVar(&validateReq.ExternalLocationName, "external-location-name", validateReq.ExternalLocationName, `The name of an existing external location to validate.`)
|
||||
// TODO: complex arg: gcp_service_account_key
|
||||
validateCmd.Flags().BoolVar(&validateReq.ReadOnly, "read-only", validateReq.ReadOnly, `Whether the storage credential is only usable for read operations.`)
|
||||
// TODO: any: storage_credential_name
|
||||
validateCmd.Flags().StringVar(&validateReq.Url, "url", validateReq.Url, `The external location url to validate.`)
|
||||
|
@ -375,6 +399,9 @@ var validateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service StorageCredentials
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
||||
|
||||
package system_schemas
|
||||
|
||||
import (
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/service/catalog"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var Cmd = &cobra.Command{
|
||||
Use: "system-schemas",
|
||||
Short: `A system schema is a schema that lives within the system catalog.`,
|
||||
Long: `A system schema is a schema that lives within the system catalog. A system
|
||||
schema may contain information about customer usage of Unity Catalog such as
|
||||
audit-logs, billing-logs, lineage information, etc.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
|
||||
// This service is being previewed; hide from help output.
|
||||
Hidden: true,
|
||||
}
|
||||
|
||||
// start disable command
|
||||
|
||||
var disableReq catalog.DisableRequest
|
||||
var disableJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(disableCmd)
|
||||
// TODO: short flags
|
||||
disableCmd.Flags().Var(&disableJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
}
|
||||
|
||||
var disableCmd = &cobra.Command{
|
||||
Use: "disable METASTORE_ID SCHEMA_NAME",
|
||||
Short: `Disable a system schema.`,
|
||||
Long: `Disable a system schema.
|
||||
|
||||
Disables the system schema and removes it from the system catalog. The caller
|
||||
must be an account admin or a metastore admin.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(2)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = disableJson.Unmarshal(&disableReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
disableReq.MetastoreId = args[0]
|
||||
disableReq.SchemaName = args[1]
|
||||
}
|
||||
|
||||
err = w.SystemSchemas.Disable(ctx, disableReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start enable command
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(enableCmd)
|
||||
|
||||
}
|
||||
|
||||
var enableCmd = &cobra.Command{
|
||||
Use: "enable",
|
||||
Short: `Enable a system schema.`,
|
||||
Long: `Enable a system schema.
|
||||
|
||||
Enables the system schema and adds it to the system catalog. The caller must
|
||||
be an account admin or a metastore admin.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
err = w.SystemSchemas.Enable(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
||||
var listReq catalog.ListSystemSchemasRequest
|
||||
var listJson flags.JsonFlag
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(listCmd)
|
||||
// TODO: short flags
|
||||
listCmd.Flags().Var(&listJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
}
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
Use: "list METASTORE_ID",
|
||||
Short: `List system schemas.`,
|
||||
Long: `List system schemas.
|
||||
|
||||
Gets an array of system schemas for a metastore. The caller must be an account
|
||||
admin or a metastore admin.`,
|
||||
|
||||
Annotations: map[string]string{},
|
||||
Args: func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(1)
|
||||
if cmd.Flags().Changed("json") {
|
||||
check = cobra.ExactArgs(0)
|
||||
}
|
||||
return check(cmd, args)
|
||||
},
|
||||
PreRunE: root.MustWorkspaceClient,
|
||||
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
w := root.WorkspaceClient(ctx)
|
||||
if cmd.Flags().Changed("json") {
|
||||
err = listJson.Unmarshal(&listReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
listReq.MetastoreId = args[0]
|
||||
}
|
||||
|
||||
response, err := w.SystemSchemas.ListAll(ctx, listReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service SystemSchemas
|
|
@ -28,6 +28,9 @@ var Cmd = &cobra.Command{
|
|||
You can declare primary keys and foreign keys as part of the table
|
||||
specification during table creation. You can also add or drop constraints on
|
||||
existing tables.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -69,11 +72,7 @@ var createCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
} else {
|
||||
createReq.FullNameArg = args[0]
|
||||
_, err = fmt.Sscan(args[1], &createReq.Constraint)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid CONSTRAINT: %s", args[1])
|
||||
}
|
||||
return fmt.Errorf("provide command input in JSON format by specifying --json option")
|
||||
}
|
||||
|
||||
response, err := w.TableConstraints.Create(ctx, createReq)
|
||||
|
@ -82,6 +81,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -143,6 +145,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service TableConstraints
|
||||
|
|
|
@ -24,6 +24,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
A table can be managed or external. From an API perspective, a __VIEW__ is a
|
||||
particular kind of table (rather than a managed or external table).`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -86,6 +89,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -150,6 +156,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -208,6 +217,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list-summaries command
|
||||
|
@ -281,6 +293,9 @@ var listSummariesCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Tables
|
||||
|
|
|
@ -18,6 +18,9 @@ var Cmd = &cobra.Command{
|
|||
Long: `Enables administrators to get all tokens and delete tokens for other users.
|
||||
Admins can either get every token, get a specific token by ID, or get all
|
||||
tokens for a particular user.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "settings",
|
||||
},
|
||||
}
|
||||
|
||||
// start create-obo-token command
|
||||
|
@ -72,6 +75,9 @@ var createOboTokenCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -130,6 +136,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -188,6 +197,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -238,6 +250,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service TokenManagement
|
||||
|
|
|
@ -17,6 +17,9 @@ var Cmd = &cobra.Command{
|
|||
Short: `The Token API allows you to create, list, and revoke tokens that can be used to authenticate and access Databricks REST APIs.`,
|
||||
Long: `The Token API allows you to create, list, and revoke tokens that can be used
|
||||
to authenticate and access Databricks REST APIs.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "settings",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -70,6 +73,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -131,6 +137,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -158,6 +167,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Tokens
|
||||
|
|
|
@ -26,6 +26,9 @@ var Cmd = &cobra.Command{
|
|||
provider and that user’s account will also be removed from Databricks
|
||||
workspace. This ensures a consistent offboarding process and prevents
|
||||
unauthorized users from accessing sensitive data.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "iam",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -85,6 +88,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -144,6 +150,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -202,6 +211,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -257,6 +269,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start patch command
|
||||
|
@ -318,6 +333,9 @@ var patchCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -387,6 +405,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Users
|
||||
|
|
|
@ -23,6 +23,12 @@ var Cmd = &cobra.Command{
|
|||
storing library and config files of arbitrary formats such as .whl or .txt
|
||||
centrally and providing secure access across workspaces to it, or transforming
|
||||
and querying non-tabular data files in ETL.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
|
||||
// This service is being previewed; hide from help output.
|
||||
Hidden: true,
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -97,6 +103,9 @@ var createCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
@ -159,6 +168,9 @@ var deleteCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -218,6 +230,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start read command
|
||||
|
@ -281,6 +296,9 @@ var readCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -350,6 +368,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Volumes
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/databricks/cli/libs/cmdio"
|
||||
"github.com/databricks/cli/libs/flags"
|
||||
"github.com/databricks/databricks-sdk-go/retries"
|
||||
"github.com/databricks/databricks-sdk-go/service/sql"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -20,6 +19,9 @@ var Cmd = &cobra.Command{
|
|||
Long: `A SQL warehouse is a compute resource that lets you run SQL commands on data
|
||||
objects within Databricks SQL. Compute resources are infrastructure resources
|
||||
that provide processing capabilities in the cloud.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "sql",
|
||||
},
|
||||
}
|
||||
|
||||
// start create command
|
||||
|
@ -80,50 +82,43 @@ var createCmd = &cobra.Command{
|
|||
} else {
|
||||
}
|
||||
|
||||
wait, err := w.Warehouses.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if createSkipWait {
|
||||
response, err := w.Warehouses.Create(ctx, createReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
return cmdio.Render(ctx, wait.Response)
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Warehouses.CreateAndWait(ctx, createReq,
|
||||
retries.Timeout[sql.GetWarehouseResponse](createTimeout),
|
||||
func(i *retries.Info[sql.GetWarehouseResponse]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.Health != nil {
|
||||
statusMessage = i.Info.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *sql.GetWarehouseResponse) {
|
||||
if i.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Health != nil {
|
||||
statusMessage = i.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(createTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start delete command
|
||||
|
||||
var deleteReq sql.DeleteWarehouseRequest
|
||||
var deleteJson flags.JsonFlag
|
||||
var deleteSkipWait bool
|
||||
var deleteTimeout time.Duration
|
||||
|
||||
func init() {
|
||||
Cmd.AddCommand(deleteCmd)
|
||||
|
||||
deleteCmd.Flags().BoolVar(&deleteSkipWait, "no-wait", deleteSkipWait, `do not wait to reach DELETED state`)
|
||||
deleteCmd.Flags().DurationVar(&deleteTimeout, "timeout", 20*time.Minute, `maximum amount of time to reach DELETED state`)
|
||||
// TODO: short flags
|
||||
deleteCmd.Flags().Var(&deleteJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
|
@ -167,36 +162,15 @@ var deleteCmd = &cobra.Command{
|
|||
deleteReq.Id = args[0]
|
||||
}
|
||||
|
||||
if deleteSkipWait {
|
||||
err = w.Warehouses.Delete(ctx, deleteReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Warehouses.DeleteAndWait(ctx, deleteReq,
|
||||
retries.Timeout[sql.GetWarehouseResponse](deleteTimeout),
|
||||
func(i *retries.Info[sql.GetWarehouseResponse]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.Health != nil {
|
||||
statusMessage = i.Info.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
close(spinner)
|
||||
err = w.Warehouses.Delete(ctx, deleteReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start edit command
|
||||
|
@ -268,36 +242,34 @@ var editCmd = &cobra.Command{
|
|||
editReq.Id = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Warehouses.Edit(ctx, editReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if editSkipWait {
|
||||
err = w.Warehouses.Edit(ctx, editReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Warehouses.EditAndWait(ctx, editReq,
|
||||
retries.Timeout[sql.GetWarehouseResponse](editTimeout),
|
||||
func(i *retries.Info[sql.GetWarehouseResponse]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.Health != nil {
|
||||
statusMessage = i.Info.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *sql.GetWarehouseResponse) {
|
||||
if i.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Health != nil {
|
||||
statusMessage = i.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(editTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -361,6 +333,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start get-workspace-warehouse-config command
|
||||
|
@ -389,6 +364,9 @@ var getWorkspaceWarehouseConfigCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start list command
|
||||
|
@ -438,6 +416,9 @@ var listCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start set-workspace-warehouse-config command
|
||||
|
@ -496,6 +477,9 @@ var setWorkspaceWarehouseConfigCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start start command
|
||||
|
@ -553,36 +537,34 @@ var startCmd = &cobra.Command{
|
|||
startReq.Id = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Warehouses.Start(ctx, startReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if startSkipWait {
|
||||
err = w.Warehouses.Start(ctx, startReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Warehouses.StartAndWait(ctx, startReq,
|
||||
retries.Timeout[sql.GetWarehouseResponse](startTimeout),
|
||||
func(i *retries.Info[sql.GetWarehouseResponse]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.Health != nil {
|
||||
statusMessage = i.Info.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *sql.GetWarehouseResponse) {
|
||||
if i.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Health != nil {
|
||||
statusMessage = i.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(startTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start stop command
|
||||
|
@ -640,36 +622,34 @@ var stopCmd = &cobra.Command{
|
|||
stopReq.Id = args[0]
|
||||
}
|
||||
|
||||
wait, err := w.Warehouses.Stop(ctx, stopReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if stopSkipWait {
|
||||
err = w.Warehouses.Stop(ctx, stopReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
spinner := cmdio.Spinner(ctx)
|
||||
info, err := w.Warehouses.StopAndWait(ctx, stopReq,
|
||||
retries.Timeout[sql.GetWarehouseResponse](stopTimeout),
|
||||
func(i *retries.Info[sql.GetWarehouseResponse]) {
|
||||
if i.Info == nil {
|
||||
return
|
||||
}
|
||||
if i.Info.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.Info.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Info.Health != nil {
|
||||
statusMessage = i.Info.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
})
|
||||
info, err := wait.OnProgress(func(i *sql.GetWarehouseResponse) {
|
||||
if i.Health == nil {
|
||||
return
|
||||
}
|
||||
status := i.State
|
||||
statusMessage := fmt.Sprintf("current status: %s", status)
|
||||
if i.Health != nil {
|
||||
statusMessage = i.Health.Summary
|
||||
}
|
||||
spinner <- statusMessage
|
||||
}).GetWithTimeout(stopTimeout)
|
||||
close(spinner)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return cmdio.Render(ctx, info)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service Warehouses
|
||||
|
|
|
@ -19,6 +19,9 @@ var Cmd = &cobra.Command{
|
|||
|
||||
A catalog's workspace bindings can be configured by a metastore admin or the
|
||||
owner of the catalog.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "catalog",
|
||||
},
|
||||
}
|
||||
|
||||
// start get command
|
||||
|
@ -68,6 +71,9 @@ var getCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start update command
|
||||
|
@ -120,6 +126,9 @@ var updateCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service WorkspaceBindings
|
||||
|
|
|
@ -14,6 +14,9 @@ var Cmd = &cobra.Command{
|
|||
Use: "workspace-conf",
|
||||
Short: `This API allows updating known workspace settings for advanced users.`,
|
||||
Long: `This API allows updating known workspace settings for advanced users.`,
|
||||
Annotations: map[string]string{
|
||||
"package": "settings",
|
||||
},
|
||||
}
|
||||
|
||||
// start get-status command
|
||||
|
@ -62,6 +65,9 @@ var getStatusCmd = &cobra.Command{
|
|||
}
|
||||
return cmdio.Render(ctx, response)
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// start set-status command
|
||||
|
@ -110,6 +116,9 @@ var setStatusCmd = &cobra.Command{
|
|||
}
|
||||
return nil
|
||||
},
|
||||
// Disable completions since they are not applicable.
|
||||
// Can be overridden by manual implementation in `override.go`.
|
||||
ValidArgsFunction: cobra.NoFileCompletions,
|
||||
}
|
||||
|
||||
// end service WorkspaceConf
|
||||
|
|
|
@ -9,10 +9,15 @@ type fileIOEvent struct {
|
|||
type EventType string
|
||||
|
||||
const (
|
||||
EventTypeFileExported = EventType("FILE_EXPORTED")
|
||||
EventTypeFileExported = EventType("FILE_EXPORTED")
|
||||
EventTypeFileSkipped = EventType("FILE_SKIPPED")
|
||||
EventTypeFileImported = EventType("FILE_IMPORTED")
|
||||
|
||||
EventTypeExportStarted = EventType("EXPORT_STARTED")
|
||||
EventTypeExportCompleted = EventType("EXPORT_COMPLETED")
|
||||
EventTypeFileSkipped = EventType("FILE_SKIPPED")
|
||||
|
||||
EventTypeImportStarted = EventType("IMPORT_STARTED")
|
||||
EventTypeImportCompleted = EventType("IMPORT_COMPLETED")
|
||||
)
|
||||
|
||||
func newFileExportedEvent(sourcePath, targetPath string) fileIOEvent {
|
||||
|
@ -44,3 +49,25 @@ func newExportStartedEvent(sourcePath string) fileIOEvent {
|
|||
Type: EventTypeExportStarted,
|
||||
}
|
||||
}
|
||||
|
||||
func newImportStartedEvent(sourcePath string) fileIOEvent {
|
||||
return fileIOEvent{
|
||||
SourcePath: sourcePath,
|
||||
Type: EventTypeImportStarted,
|
||||
}
|
||||
}
|
||||
|
||||
func newImportCompletedEvent(targetPath string) fileIOEvent {
|
||||
return fileIOEvent{
|
||||
TargetPath: targetPath,
|
||||
Type: EventTypeImportCompleted,
|
||||
}
|
||||
}
|
||||
|
||||
func newFileImportedEvent(sourcePath, targetPath string) fileIOEvent {
|
||||
return fileIOEvent{
|
||||
TargetPath: targetPath,
|
||||
SourcePath: sourcePath,
|
||||
Type: EventTypeFileImported,
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue