mirror of https://github.com/databricks/cli.git
Upgrade Go SDK to v0.28
This commit is contained in:
parent
f18094d943
commit
ba6c5bb9f5
|
@ -1 +1 @@
|
|||
63caa3cb0c05045e81d3dcf2451fa990d8670f36
|
||||
d3853c8dee5806d04da2ae8910f273ffb35719a5
|
|
@ -311,7 +311,7 @@
|
|||
"description": "A unique name for the job cluster. This field is required and must be unique within the job.\n`JobTaskSettings` may refer to this field to determine which cluster to launch for the task execution."
|
||||
},
|
||||
"new_cluster": {
|
||||
"description": "If new_cluster, a description of a cluster that is created for each task.",
|
||||
"description": "If new_cluster, a description of a cluster that is created for only for this task.",
|
||||
"properties": {
|
||||
"apply_policy_default_values": {
|
||||
"description": ""
|
||||
|
@ -893,7 +893,7 @@
|
|||
"description": "An optional minimal interval in milliseconds between the start of the failed run and the subsequent retry run. The default behavior is that unsuccessful runs are immediately retried."
|
||||
},
|
||||
"new_cluster": {
|
||||
"description": "If new_cluster, a description of a cluster that is created for each task.",
|
||||
"description": "If new_cluster, a description of a cluster that is created for only for this task.",
|
||||
"properties": {
|
||||
"apply_policy_default_values": {
|
||||
"description": ""
|
||||
|
@ -1210,7 +1210,7 @@
|
|||
"description": "The path of the notebook to be run in the Databricks workspace or remote repository.\nFor notebooks stored in the Databricks workspace, the path must be absolute and begin with a slash.\nFor notebooks stored in a remote repository, the path must be relative. This field is required.\n"
|
||||
},
|
||||
"source": {
|
||||
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n"
|
||||
"description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1312,7 +1312,7 @@
|
|||
"description": "The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, adls:/, gcs:/) and workspace paths are supported. For python files stored in the Databricks workspace, the path must be absolute and begin with `/`. For files stored in a remote repository, the path must be relative. This field is required."
|
||||
},
|
||||
"source": {
|
||||
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n"
|
||||
"description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -2670,7 +2670,7 @@
|
|||
"description": "A unique name for the job cluster. This field is required and must be unique within the job.\n`JobTaskSettings` may refer to this field to determine which cluster to launch for the task execution."
|
||||
},
|
||||
"new_cluster": {
|
||||
"description": "If new_cluster, a description of a cluster that is created for each task.",
|
||||
"description": "If new_cluster, a description of a cluster that is created for only for this task.",
|
||||
"properties": {
|
||||
"apply_policy_default_values": {
|
||||
"description": ""
|
||||
|
@ -3252,7 +3252,7 @@
|
|||
"description": "An optional minimal interval in milliseconds between the start of the failed run and the subsequent retry run. The default behavior is that unsuccessful runs are immediately retried."
|
||||
},
|
||||
"new_cluster": {
|
||||
"description": "If new_cluster, a description of a cluster that is created for each task.",
|
||||
"description": "If new_cluster, a description of a cluster that is created for only for this task.",
|
||||
"properties": {
|
||||
"apply_policy_default_values": {
|
||||
"description": ""
|
||||
|
@ -3569,7 +3569,7 @@
|
|||
"description": "The path of the notebook to be run in the Databricks workspace or remote repository.\nFor notebooks stored in the Databricks workspace, the path must be absolute and begin with a slash.\nFor notebooks stored in a remote repository, the path must be relative. This field is required.\n"
|
||||
},
|
||||
"source": {
|
||||
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n"
|
||||
"description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -3671,7 +3671,7 @@
|
|||
"description": "The Python file to be executed. Cloud file URIs (such as dbfs:/, s3:/, adls:/, gcs:/) and workspace paths are supported. For python files stored in the Databricks workspace, the path must be absolute and begin with `/`. For files stored in a remote repository, the path must be relative. This field is required."
|
||||
},
|
||||
"source": {
|
||||
"description": "Optional location type of the Python file. When set to `WORKSPACE` or not specified, the file will be retrieved\nfrom the local \u003cDatabricks\u003e workspace or cloud location (if the `python_file` has a URI format). When set to `GIT`,\nthe Python file will be retrieved from a Git repository defined in `git_source`.\n\n* `WORKSPACE`: The Python file is located in a \u003cDatabricks\u003e workspace or at a cloud filesystem URI.\n* `GIT`: The Python file is located in a remote Git repository.\n"
|
||||
"description": "Optional location type of the notebook. When set to `WORKSPACE`, the notebook will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the notebook will be retrieved from a Git repository\ndefined in `git_source`. If the value is empty, the task will use `GIT` if `git_source` is defined and `WORKSPACE` otherwise.\n\n* `WORKSPACE`: Notebook is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Notebook is located in cloud Git provider.\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -74,7 +74,9 @@ func newCreate() *cobra.Command {
|
|||
// TODO: short flags
|
||||
cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
cmd.Use = "create"
|
||||
// TODO: array: ip_addresses
|
||||
|
||||
cmd.Use = "create LABEL LIST_TYPE"
|
||||
cmd.Short = `Create access list.`
|
||||
cmd.Long = `Create access list.
|
||||
|
||||
|
@ -91,10 +93,31 @@ func newCreate() *cobra.Command {
|
|||
* If the new list would block the calling user's current IP, error 400 is
|
||||
returned with error_code value INVALID_STATE.
|
||||
|
||||
It can take a few minutes for the changes to take effect.`
|
||||
It can take a few minutes for the changes to take effect.
|
||||
|
||||
Arguments:
|
||||
LABEL: Label for the IP access list. This **cannot** be empty.
|
||||
LIST_TYPE: Type of IP access list. Valid values are as follows and are
|
||||
case-sensitive:
|
||||
|
||||
* ALLOW: An allow list. Include this IP or range. * BLOCK: A block
|
||||
list. Exclude this IP or range. IP addresses in the block list are
|
||||
excluded even if they are included in an allow list.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||
if cmd.Flags().Changed("json") {
|
||||
err := cobra.ExactArgs(0)(cmd, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'label', 'list_type' in your JSON input")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
check := cobra.ExactArgs(2)
|
||||
return check(cmd, args)
|
||||
}
|
||||
|
||||
cmd.PreRunE = root.MustAccountClient
|
||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
|
@ -105,8 +128,15 @@ func newCreate() *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
||||
}
|
||||
if !cmd.Flags().Changed("json") {
|
||||
createReq.Label = args[0]
|
||||
}
|
||||
if !cmd.Flags().Changed("json") {
|
||||
_, err = fmt.Sscan(args[1], &createReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[1])
|
||||
}
|
||||
}
|
||||
|
||||
response, err := a.IpAccessLists.Create(ctx, createReq)
|
||||
|
@ -154,10 +184,7 @@ func newDelete() *cobra.Command {
|
|||
cmd.Short = `Delete access list.`
|
||||
cmd.Long = `Delete access list.
|
||||
|
||||
Deletes an IP access list, specified by its list ID.
|
||||
|
||||
Arguments:
|
||||
IP_ACCESS_LIST_ID: The ID for the corresponding IP access list.`
|
||||
Deletes an IP access list, specified by its list ID.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
|
@ -174,14 +201,14 @@ func newDelete() *cobra.Command {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Account Ip Access Lists drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The ID for the corresponding IP access list")
|
||||
id, err := cmdio.Select(ctx, names, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the id for the corresponding ip access list")
|
||||
return fmt.Errorf("expected to have ")
|
||||
}
|
||||
deleteReq.IpAccessListId = args[0]
|
||||
|
||||
|
@ -230,10 +257,7 @@ func newGet() *cobra.Command {
|
|||
cmd.Short = `Get IP access list.`
|
||||
cmd.Long = `Get IP access list.
|
||||
|
||||
Gets an IP access list, specified by its list ID.
|
||||
|
||||
Arguments:
|
||||
IP_ACCESS_LIST_ID: The ID for the corresponding IP access list.`
|
||||
Gets an IP access list, specified by its list ID.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
|
@ -250,14 +274,14 @@ func newGet() *cobra.Command {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Account Ip Access Lists drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The ID for the corresponding IP access list")
|
||||
id, err := cmdio.Select(ctx, names, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the id for the corresponding ip access list")
|
||||
return fmt.Errorf("expected to have ")
|
||||
}
|
||||
getReq.IpAccessListId = args[0]
|
||||
|
||||
|
@ -352,9 +376,9 @@ func newReplace() *cobra.Command {
|
|||
// TODO: short flags
|
||||
cmd.Flags().Var(&replaceJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
cmd.Flags().StringVar(&replaceReq.ListId, "list-id", replaceReq.ListId, `Universally unique identifier (UUID) of the IP access list.`)
|
||||
// TODO: array: ip_addresses
|
||||
|
||||
cmd.Use = "replace"
|
||||
cmd.Use = "replace IP_ACCESS_LIST_ID LABEL LIST_TYPE ENABLED"
|
||||
cmd.Short = `Replace access list.`
|
||||
cmd.Long = `Replace access list.
|
||||
|
||||
|
@ -367,10 +391,33 @@ func newReplace() *cobra.Command {
|
|||
counts as a single value. Attempts to exceed that number return error 400 with
|
||||
error_code value QUOTA_EXCEEDED. * If the resulting list would block the
|
||||
calling user's current IP, error 400 is returned with error_code value
|
||||
INVALID_STATE. It can take a few minutes for the changes to take effect.`
|
||||
INVALID_STATE. It can take a few minutes for the changes to take effect.
|
||||
|
||||
Arguments:
|
||||
IP_ACCESS_LIST_ID:
|
||||
LABEL: Label for the IP access list. This **cannot** be empty.
|
||||
LIST_TYPE: Type of IP access list. Valid values are as follows and are
|
||||
case-sensitive:
|
||||
|
||||
* ALLOW: An allow list. Include this IP or range. * BLOCK: A block
|
||||
list. Exclude this IP or range. IP addresses in the block list are
|
||||
excluded even if they are included in an allow list.
|
||||
ENABLED: Specifies whether this IP access list is enabled.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||
if cmd.Flags().Changed("json") {
|
||||
err := cobra.ExactArgs(1)(cmd, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
check := cobra.ExactArgs(4)
|
||||
return check(cmd, args)
|
||||
}
|
||||
|
||||
cmd.PreRunE = root.MustAccountClient
|
||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
|
@ -381,8 +428,22 @@ func newReplace() *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
||||
}
|
||||
replaceReq.IpAccessListId = args[0]
|
||||
if !cmd.Flags().Changed("json") {
|
||||
replaceReq.Label = args[1]
|
||||
}
|
||||
if !cmd.Flags().Changed("json") {
|
||||
_, err = fmt.Sscan(args[2], &replaceReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[2])
|
||||
}
|
||||
}
|
||||
if !cmd.Flags().Changed("json") {
|
||||
_, err = fmt.Sscan(args[3], &replaceReq.Enabled)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ENABLED: %s", args[3])
|
||||
}
|
||||
}
|
||||
|
||||
err = a.IpAccessLists.Replace(ctx, replaceReq)
|
||||
|
@ -428,9 +489,12 @@ func newUpdate() *cobra.Command {
|
|||
// TODO: short flags
|
||||
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
cmd.Flags().StringVar(&updateReq.ListId, "list-id", updateReq.ListId, `Universally unique identifier (UUID) of the IP access list.`)
|
||||
cmd.Flags().BoolVar(&updateReq.Enabled, "enabled", updateReq.Enabled, `Specifies whether this IP access list is enabled.`)
|
||||
// TODO: array: ip_addresses
|
||||
cmd.Flags().StringVar(&updateReq.Label, "label", updateReq.Label, `Label for the IP access list.`)
|
||||
cmd.Flags().Var(&updateReq.ListType, "list-type", `Type of IP access list. Supported values: [ALLOW, BLOCK]`)
|
||||
|
||||
cmd.Use = "update"
|
||||
cmd.Use = "update IP_ACCESS_LIST_ID"
|
||||
cmd.Short = `Update access list.`
|
||||
cmd.Long = `Update access list.
|
||||
|
||||
|
@ -461,9 +525,25 @@ func newUpdate() *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
||||
}
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No IP_ACCESS_LIST_ID argument specified. Loading names for Account Ip Access Lists drop-down."
|
||||
names, err := a.IpAccessLists.IpAccessListInfoLabelToListIdMap(ctx)
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Account Ip Access Lists drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have ")
|
||||
}
|
||||
updateReq.IpAccessListId = args[0]
|
||||
|
||||
err = a.IpAccessLists.Update(ctx, updateReq)
|
||||
if err != nil {
|
||||
|
|
|
@ -73,7 +73,9 @@ func newCreate() *cobra.Command {
|
|||
// TODO: short flags
|
||||
cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
cmd.Use = "create"
|
||||
// TODO: array: ip_addresses
|
||||
|
||||
cmd.Use = "create LABEL LIST_TYPE"
|
||||
cmd.Short = `Create access list.`
|
||||
cmd.Long = `Create access list.
|
||||
|
||||
|
@ -92,10 +94,31 @@ func newCreate() *cobra.Command {
|
|||
|
||||
It can take a few minutes for the changes to take effect. **Note**: Your new
|
||||
IP access list has no effect until you enable the feature. See
|
||||
:method:workspaceconf/setStatus`
|
||||
:method:workspaceconf/setStatus
|
||||
|
||||
Arguments:
|
||||
LABEL: Label for the IP access list. This **cannot** be empty.
|
||||
LIST_TYPE: Type of IP access list. Valid values are as follows and are
|
||||
case-sensitive:
|
||||
|
||||
* ALLOW: An allow list. Include this IP or range. * BLOCK: A block
|
||||
list. Exclude this IP or range. IP addresses in the block list are
|
||||
excluded even if they are included in an allow list.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||
if cmd.Flags().Changed("json") {
|
||||
err := cobra.ExactArgs(0)(cmd, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'label', 'list_type' in your JSON input")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
check := cobra.ExactArgs(2)
|
||||
return check(cmd, args)
|
||||
}
|
||||
|
||||
cmd.PreRunE = root.MustWorkspaceClient
|
||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
|
@ -106,8 +129,15 @@ func newCreate() *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
||||
}
|
||||
if !cmd.Flags().Changed("json") {
|
||||
createReq.Label = args[0]
|
||||
}
|
||||
if !cmd.Flags().Changed("json") {
|
||||
_, err = fmt.Sscan(args[1], &createReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[1])
|
||||
}
|
||||
}
|
||||
|
||||
response, err := w.IpAccessLists.Create(ctx, createReq)
|
||||
|
@ -155,10 +185,7 @@ func newDelete() *cobra.Command {
|
|||
cmd.Short = `Delete access list.`
|
||||
cmd.Long = `Delete access list.
|
||||
|
||||
Deletes an IP access list, specified by its list ID.
|
||||
|
||||
Arguments:
|
||||
IP_ACCESS_LIST_ID: The ID for the corresponding IP access list to modify.`
|
||||
Deletes an IP access list, specified by its list ID.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
|
@ -175,14 +202,14 @@ func newDelete() *cobra.Command {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Ip Access Lists drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The ID for the corresponding IP access list to modify")
|
||||
id, err := cmdio.Select(ctx, names, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the id for the corresponding ip access list to modify")
|
||||
return fmt.Errorf("expected to have ")
|
||||
}
|
||||
deleteReq.IpAccessListId = args[0]
|
||||
|
||||
|
@ -231,10 +258,7 @@ func newGet() *cobra.Command {
|
|||
cmd.Short = `Get access list.`
|
||||
cmd.Long = `Get access list.
|
||||
|
||||
Gets an IP access list, specified by its list ID.
|
||||
|
||||
Arguments:
|
||||
IP_ACCESS_LIST_ID: The ID for the corresponding IP access list to modify.`
|
||||
Gets an IP access list, specified by its list ID.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
|
@ -251,14 +275,14 @@ func newGet() *cobra.Command {
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Ip Access Lists drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "The ID for the corresponding IP access list to modify")
|
||||
id, err := cmdio.Select(ctx, names, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have the id for the corresponding ip access list to modify")
|
||||
return fmt.Errorf("expected to have ")
|
||||
}
|
||||
getReq.IpAccessListId = args[0]
|
||||
|
||||
|
@ -353,9 +377,9 @@ func newReplace() *cobra.Command {
|
|||
// TODO: short flags
|
||||
cmd.Flags().Var(&replaceJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
cmd.Flags().StringVar(&replaceReq.ListId, "list-id", replaceReq.ListId, `Universally unique identifier (UUID) of the IP access list.`)
|
||||
// TODO: array: ip_addresses
|
||||
|
||||
cmd.Use = "replace"
|
||||
cmd.Use = "replace IP_ACCESS_LIST_ID LABEL LIST_TYPE ENABLED"
|
||||
cmd.Short = `Replace access list.`
|
||||
cmd.Long = `Replace access list.
|
||||
|
||||
|
@ -370,10 +394,33 @@ func newReplace() *cobra.Command {
|
|||
calling user's current IP, error 400 is returned with error_code value
|
||||
INVALID_STATE. It can take a few minutes for the changes to take effect.
|
||||
Note that your resulting IP access list has no effect until you enable the
|
||||
feature. See :method:workspaceconf/setStatus.`
|
||||
feature. See :method:workspaceconf/setStatus.
|
||||
|
||||
Arguments:
|
||||
IP_ACCESS_LIST_ID:
|
||||
LABEL: Label for the IP access list. This **cannot** be empty.
|
||||
LIST_TYPE: Type of IP access list. Valid values are as follows and are
|
||||
case-sensitive:
|
||||
|
||||
* ALLOW: An allow list. Include this IP or range. * BLOCK: A block
|
||||
list. Exclude this IP or range. IP addresses in the block list are
|
||||
excluded even if they are included in an allow list.
|
||||
ENABLED: Specifies whether this IP access list is enabled.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||
if cmd.Flags().Changed("json") {
|
||||
err := cobra.ExactArgs(1)(cmd, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
check := cobra.ExactArgs(4)
|
||||
return check(cmd, args)
|
||||
}
|
||||
|
||||
cmd.PreRunE = root.MustWorkspaceClient
|
||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
|
@ -384,8 +431,22 @@ func newReplace() *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
||||
}
|
||||
replaceReq.IpAccessListId = args[0]
|
||||
if !cmd.Flags().Changed("json") {
|
||||
replaceReq.Label = args[1]
|
||||
}
|
||||
if !cmd.Flags().Changed("json") {
|
||||
_, err = fmt.Sscan(args[2], &replaceReq.ListType)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid LIST_TYPE: %s", args[2])
|
||||
}
|
||||
}
|
||||
if !cmd.Flags().Changed("json") {
|
||||
_, err = fmt.Sscan(args[3], &replaceReq.Enabled)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid ENABLED: %s", args[3])
|
||||
}
|
||||
}
|
||||
|
||||
err = w.IpAccessLists.Replace(ctx, replaceReq)
|
||||
|
@ -431,9 +492,12 @@ func newUpdate() *cobra.Command {
|
|||
// TODO: short flags
|
||||
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
cmd.Flags().StringVar(&updateReq.ListId, "list-id", updateReq.ListId, `Universally unique identifier (UUID) of the IP access list.`)
|
||||
cmd.Flags().BoolVar(&updateReq.Enabled, "enabled", updateReq.Enabled, `Specifies whether this IP access list is enabled.`)
|
||||
// TODO: array: ip_addresses
|
||||
cmd.Flags().StringVar(&updateReq.Label, "label", updateReq.Label, `Label for the IP access list.`)
|
||||
cmd.Flags().Var(&updateReq.ListType, "list-type", `Type of IP access list. Supported values: [ALLOW, BLOCK]`)
|
||||
|
||||
cmd.Use = "update"
|
||||
cmd.Use = "update IP_ACCESS_LIST_ID"
|
||||
cmd.Short = `Update access list.`
|
||||
cmd.Long = `Update access list.
|
||||
|
||||
|
@ -466,9 +530,25 @@ func newUpdate() *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
||||
}
|
||||
if len(args) == 0 {
|
||||
promptSpinner := cmdio.Spinner(ctx)
|
||||
promptSpinner <- "No IP_ACCESS_LIST_ID argument specified. Loading names for Ip Access Lists drop-down."
|
||||
names, err := w.IpAccessLists.IpAccessListInfoLabelToListIdMap(ctx)
|
||||
close(promptSpinner)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load names for Ip Access Lists drop-down. Please manually specify required arguments. Original error: %w", err)
|
||||
}
|
||||
id, err := cmdio.Select(ctx, names, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args = append(args, id)
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("expected to have ")
|
||||
}
|
||||
updateReq.IpAccessListId = args[0]
|
||||
|
||||
err = w.IpAccessLists.Update(ctx, updateReq)
|
||||
if err != nil {
|
||||
|
|
|
@ -103,8 +103,11 @@ func newGet() *cobra.Command {
|
|||
parent objects or root object.
|
||||
|
||||
Arguments:
|
||||
REQUEST_OBJECT_TYPE: <needs content>
|
||||
REQUEST_OBJECT_ID: `
|
||||
REQUEST_OBJECT_TYPE: The type of the request object. Can be one of the following:
|
||||
authorization, clusters, cluster-policies, directories, experiments,
|
||||
files, instance-pools, jobs, notebooks, pipelines, registered-models,
|
||||
repos, serving-endpoints, or sql-warehouses.
|
||||
REQUEST_OBJECT_ID: The id of the request object.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
|
@ -240,8 +243,11 @@ func newSet() *cobra.Command {
|
|||
parent objects or root object.
|
||||
|
||||
Arguments:
|
||||
REQUEST_OBJECT_TYPE: <needs content>
|
||||
REQUEST_OBJECT_ID: `
|
||||
REQUEST_OBJECT_TYPE: The type of the request object. Can be one of the following:
|
||||
authorization, clusters, cluster-policies, directories, experiments,
|
||||
files, instance-pools, jobs, notebooks, pipelines, registered-models,
|
||||
repos, serving-endpoints, or sql-warehouses.
|
||||
REQUEST_OBJECT_ID: The id of the request object.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
|
@ -317,8 +323,11 @@ func newUpdate() *cobra.Command {
|
|||
their parent objects or root object.
|
||||
|
||||
Arguments:
|
||||
REQUEST_OBJECT_TYPE: <needs content>
|
||||
REQUEST_OBJECT_ID: `
|
||||
REQUEST_OBJECT_TYPE: The type of the request object. Can be one of the following:
|
||||
authorization, clusters, cluster-policies, directories, experiments,
|
||||
files, instance-pools, jobs, notebooks, pipelines, registered-models,
|
||||
repos, serving-endpoints, or sql-warehouses.
|
||||
REQUEST_OBJECT_ID: The id of the request object.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ func newUpdate() *cobra.Command {
|
|||
// TODO: short flags
|
||||
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
cmd.Flags().StringVar(&updateReq.DataSourceId, "data-source-id", updateReq.DataSourceId, `Data source ID.`)
|
||||
cmd.Flags().StringVar(&updateReq.DataSourceId, "data-source-id", updateReq.DataSourceId, `Data source ID maps to the ID of the data source used by the resource and is distinct from the warehouse ID.`)
|
||||
cmd.Flags().StringVar(&updateReq.Description, "description", updateReq.Description, `General description that conveys additional information about this query such as usage notes.`)
|
||||
cmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `The title of this query that appears in list views, widget headings, and on the query page.`)
|
||||
// TODO: any: options
|
||||
|
|
|
@ -973,20 +973,29 @@ func newUpdateConfig() *cobra.Command {
|
|||
cmd.Flags().Var(&updateConfigJson, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||
|
||||
// TODO: complex arg: auto_capture_config
|
||||
// TODO: array: served_entities
|
||||
// TODO: array: served_models
|
||||
// TODO: complex arg: traffic_config
|
||||
|
||||
cmd.Use = "update-config"
|
||||
cmd.Use = "update-config NAME"
|
||||
cmd.Short = `Update a serving endpoint with a new config.`
|
||||
cmd.Long = `Update a serving endpoint with a new config.
|
||||
|
||||
Updates any combination of the serving endpoint's served entities, the compute
|
||||
configuration of those served entities, and the endpoint's traffic config. An
|
||||
endpoint that already has an update in progress can not be updated until the
|
||||
current update completes or fails.`
|
||||
current update completes or fails.
|
||||
|
||||
Arguments:
|
||||
NAME: The name of the serving endpoint to update. This field is required.`
|
||||
|
||||
cmd.Annotations = make(map[string]string)
|
||||
|
||||
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||
check := cobra.ExactArgs(1)
|
||||
return check(cmd, args)
|
||||
}
|
||||
|
||||
cmd.PreRunE = root.MustWorkspaceClient
|
||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||
ctx := cmd.Context()
|
||||
|
@ -997,9 +1006,8 @@ func newUpdateConfig() *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
|
||||
}
|
||||
updateConfigReq.Name = args[0]
|
||||
|
||||
wait, err := w.ServingEndpoints.UpdateConfig(ctx, updateConfigReq)
|
||||
if err != nil {
|
||||
|
|
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.21
|
|||
|
||||
require (
|
||||
github.com/briandowns/spinner v1.23.0 // Apache 2.0
|
||||
github.com/databricks/databricks-sdk-go v0.27.0 // Apache 2.0
|
||||
github.com/databricks/databricks-sdk-go v0.28.0 // Apache 2.0
|
||||
github.com/fatih/color v1.16.0 // MIT
|
||||
github.com/ghodss/yaml v1.0.0 // MIT + NOTICE
|
||||
github.com/google/uuid v1.5.0 // BSD-3-Clause
|
||||
|
|
|
@ -29,8 +29,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
|
|||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
||||
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||
github.com/databricks/databricks-sdk-go v0.27.0 h1:JJ9CxVE7Js08Ug/gafM1gGYx+u/je2g2I4bSYeMPPaY=
|
||||
github.com/databricks/databricks-sdk-go v0.27.0/go.mod h1:AGzQDmVUcf/J9ARx2FgObcRI5RO2VZ1jehhxFM6tA60=
|
||||
github.com/databricks/databricks-sdk-go v0.28.0 h1:4Dp/Mm85FJs+Whd/vj5DfsHoKwxTXCZ+7EQEGypDL4w=
|
||||
github.com/databricks/databricks-sdk-go v0.28.0/go.mod h1:AGzQDmVUcf/J9ARx2FgObcRI5RO2VZ1jehhxFM6tA60=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
|
Loading…
Reference in New Issue