mirror of https://github.com/databricks/cli.git
Disable prompt for storage-credentials get command (#1723)
## Changes Fixes #1079
This commit is contained in:
parent
056d203236
commit
edc08149d3
|
@ -154,6 +154,7 @@ func new{{.PascalName}}() *cobra.Command {
|
||||||
"provider-exchanges delete-listing-from-exchange"
|
"provider-exchanges delete-listing-from-exchange"
|
||||||
"provider-exchanges list-exchanges-for-listing"
|
"provider-exchanges list-exchanges-for-listing"
|
||||||
"provider-exchanges list-listings-for-exchange"
|
"provider-exchanges list-listings-for-exchange"
|
||||||
|
"storage-credentials get"
|
||||||
-}}
|
-}}
|
||||||
{{- $fullCommandName := (print $serviceName " " .KebabName) -}}
|
{{- $fullCommandName := (print $serviceName " " .KebabName) -}}
|
||||||
{{- $noPrompt := or .IsCrudCreate (in $excludeFromPrompts $fullCommandName) }}
|
{{- $noPrompt := or .IsCrudCreate (in $excludeFromPrompts $fullCommandName) }}
|
||||||
|
|
|
@ -241,28 +241,16 @@ func newGet() *cobra.Command {
|
||||||
|
|
||||||
cmd.Annotations = make(map[string]string)
|
cmd.Annotations = make(map[string]string)
|
||||||
|
|
||||||
|
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||||
|
check := root.ExactArgs(1)
|
||||||
|
return check(cmd, args)
|
||||||
|
}
|
||||||
|
|
||||||
cmd.PreRunE = root.MustWorkspaceClient
|
cmd.PreRunE = root.MustWorkspaceClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
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, catalog.ListStorageCredentialsRequest{})
|
|
||||||
close(promptSpinner)
|
|
||||||
if err != nil {
|
|
||||||
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 {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
args = append(args, id)
|
|
||||||
}
|
|
||||||
if len(args) != 1 {
|
|
||||||
return fmt.Errorf("expected to have name of the storage credential")
|
|
||||||
}
|
|
||||||
getReq.Name = args[0]
|
getReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.StorageCredentials.Get(ctx, getReq)
|
response, err := w.StorageCredentials.Get(ctx, getReq)
|
||||||
|
|
Loading…
Reference in New Issue