diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 013e5ffe..fb91589e 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -cdd76a98a4fca7008572b3a94427566dd286c63b \ No newline at end of file +d855b30f25a06fe84f25214efa20e7f1fffcdf9e \ No newline at end of file diff --git a/.codegen/cmds-account.go.tmpl b/.codegen/cmds-account.go.tmpl index f3da7e2c..24b6bdd7 100644 --- a/.codegen/cmds-account.go.tmpl +++ b/.codegen/cmds-account.go.tmpl @@ -7,7 +7,7 @@ package account import ( "github.com/databricks/cli/cmd/root" "github.com/spf13/cobra" - {{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) }} + {{range .Services}}{{if and .IsAccounts (not .HasParent)}}{{if not (in $excludes .KebabName) }} {{.SnakeName}} "github.com/databricks/cli/cmd/account/{{(.TrimPrefix "account").KebabName}}"{{end}}{{end}}{{end}} ) @@ -17,7 +17,7 @@ func New() *cobra.Command { Short: `Databricks Account Commands`, } - {{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) -}} + {{range .Services}}{{if and .IsAccounts (not .HasParent)}}{{if not (in $excludes .KebabName) -}} cmd.AddCommand({{.SnakeName}}.New()) {{end}}{{end}}{{end}} diff --git a/.codegen/cmds-workspace.go.tmpl b/.codegen/cmds-workspace.go.tmpl index a9daa05d..244dde61 100644 --- a/.codegen/cmds-workspace.go.tmpl +++ b/.codegen/cmds-workspace.go.tmpl @@ -14,14 +14,14 @@ package workspace import ( "github.com/databricks/cli/cmd/root" - {{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) }} + {{range .Services}}{{if and (not .IsAccounts) (not .HasParent)}}{{if not (in $excludes .KebabName) }} {{.SnakeName}} "github.com/databricks/cli/cmd/workspace/{{.KebabName}}"{{end}}{{end}}{{end}} ) func All() []*cobra.Command { var out []*cobra.Command - {{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) -}} + {{range .Services}}{{if and (not .IsAccounts) (not .HasParent)}}{{if not (in $excludes .KebabName) -}} out = append(out, {{.SnakeName}}.New()) {{end}}{{end}}{{end}} diff --git a/.codegen/service.go.tmpl b/.codegen/service.go.tmpl index ad25135a..0665b661 100644 --- a/.codegen/service.go.tmpl +++ b/.codegen/service.go.tmpl @@ -8,6 +8,10 @@ import ( "github.com/databricks/cli/cmd/root" "github.com/databricks/databricks-sdk-go/service/{{.Package.Name}}" "github.com/spf13/cobra" + + {{range .Subservices -}} + {{.SnakeName}} "github.com/databricks/cli/cmd/{{ if .ParentService.IsAccounts }}account{{ else }}workspace{{ end }}/{{.KebabName}}" + {{end}} ) {{ $excludes := @@ -34,6 +38,8 @@ import ( ]{{end}}{{end}} {{define "service"}} +{{- $excludeMethods := list "put-secret" -}} + // Slice with functions to override default command behavior. // Functions can be added from the `init()` function in manually curated files in this directory. var cmdOverrides []func(*cobra.Command) @@ -45,10 +51,12 @@ func New() *cobra.Command { Short: `{{.Summary | without "`"}}`, Long: `{{.Comment " " 80 | without "`"}}`, {{- end }} + {{- if not .HasParent }} GroupID: "{{ .Package.Name }}", Annotations: map[string]string{ "package": "{{ .Package.Name }}", }, + {{- end }} {{- if .IsPrivatePreview }} // This service is being previewed; hide from help output. @@ -56,6 +64,23 @@ func New() *cobra.Command { {{- end }} } + {{ if gt (len .Methods) 0 -}} + // Add methods + {{- range .Methods}} + {{- if in $excludeMethods .KebabName }} + {{- continue}} + {{- end}} + cmd.AddCommand(new{{.PascalName}}()) + {{- end}} + {{- end}} + + {{ if .HasSubservices }} + // Add subservices + {{- range .Subservices}} + cmd.AddCommand({{.SnakeName}}.New()) + {{- end}} + {{- end}} + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -67,8 +92,7 @@ func New() *cobra.Command { {{- $serviceName := .KebabName -}} {{range .Methods}} -{{- $excludes := list "put-secret" -}} -{{if in $excludes .KebabName }} +{{if in $excludeMethods .KebabName }} {{continue}} {{end}} // start {{.KebabName}} command @@ -242,7 +266,7 @@ func new{{.PascalName}}() *cobra.Command { return err } if {{.CamelName}}SkipWait { - {{if .Response -}} + {{if not .Response.IsEmpty -}} return cmdio.Render(ctx, wait.Response) {{- else -}} return nil @@ -291,26 +315,29 @@ func new{{.PascalName}}() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(new{{.PascalName}}()) - }) -} {{end}} // end service {{.Name}}{{end}} {{- define "method-call" -}} - {{if .Response -}} + {{if not .Response.IsEmpty -}} response{{ if not .Pagination}}, err{{end}} := {{- else -}} err = - {{- end}} {{if .Service.IsAccounts}}a{{else}}w{{end}}.{{(.Service.TrimPrefix "account").PascalName}}.{{.PascalName}}(ctx{{if .Request}}, {{.CamelName}}Req{{end}}) + {{- end}} + {{- if .Service.IsAccounts}}a{{else}}w{{end}}. + {{- if .Service.HasParent }} + {{- (.Service.ParentService.TrimPrefix "account").PascalName }}. + {{- (.Service.TrimPrefix "account").PascalName}}(). + {{- else}} + {{- (.Service.TrimPrefix "account").PascalName}}. + {{- end}} + {{- .PascalName}}(ctx{{if .Request}}, {{.CamelName}}Req{{end}}) {{- if not (and .Response .Pagination) }} if err != nil { return err } {{- end}} - {{ if .Response -}} + {{ if not .Response.IsEmpty -}} {{- if .IsResponseByteStream -}} defer response.{{.ResponseBodyField.PascalName}}.Close() return cmdio.Render{{ if .Pagination}}Iterator{{end}}(ctx, response.{{.ResponseBodyField.PascalName}}) diff --git a/.gitattributes b/.gitattributes index 09aac5e7..c7d60513 100755 --- a/.gitattributes +++ b/.gitattributes @@ -4,8 +4,10 @@ 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 cmd/account/credentials/credentials.go linguist-generated=true +cmd/account/csp-enablement-account/csp-enablement-account.go linguist-generated=true cmd/account/custom-app-integration/custom-app-integration.go linguist-generated=true cmd/account/encryption-keys/encryption-keys.go linguist-generated=true +cmd/account/esm-enablement-account/esm-enablement-account.go linguist-generated=true cmd/account/groups/groups.go linguist-generated=true cmd/account/ip-access-lists/ip-access-lists.go linguist-generated=true cmd/account/log-delivery/log-delivery.go linguist-generated=true @@ -14,6 +16,7 @@ cmd/account/metastores/metastores.go linguist-generated=true cmd/account/network-connectivity/network-connectivity.go linguist-generated=true cmd/account/networks/networks.go linguist-generated=true cmd/account/o-auth-published-apps/o-auth-published-apps.go linguist-generated=true +cmd/account/personal-compute/personal-compute.go linguist-generated=true 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 @@ -28,6 +31,7 @@ cmd/account/workspaces/workspaces.go linguist-generated=true cmd/workspace/alerts/alerts.go linguist-generated=true cmd/workspace/apps/apps.go linguist-generated=true cmd/workspace/artifact-allowlists/artifact-allowlists.go linguist-generated=true +cmd/workspace/automatic-cluster-update/automatic-cluster-update.go linguist-generated=true cmd/workspace/catalogs/catalogs.go linguist-generated=true cmd/workspace/clean-rooms/clean-rooms.go linguist-generated=true cmd/workspace/cluster-policies/cluster-policies.go linguist-generated=true @@ -35,10 +39,13 @@ 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/credentials-manager/credentials-manager.go linguist-generated=true +cmd/workspace/csp-enablement/csp-enablement.go linguist-generated=true cmd/workspace/current-user/current-user.go linguist-generated=true cmd/workspace/dashboard-widgets/dashboard-widgets.go linguist-generated=true cmd/workspace/dashboards/dashboards.go linguist-generated=true cmd/workspace/data-sources/data-sources.go linguist-generated=true +cmd/workspace/default-namespace/default-namespace.go linguist-generated=true +cmd/workspace/esm-enablement/esm-enablement.go linguist-generated=true cmd/workspace/experiments/experiments.go linguist-generated=true cmd/workspace/external-locations/external-locations.go linguist-generated=true cmd/workspace/functions/functions.go linguist-generated=true @@ -57,6 +64,7 @@ cmd/workspace/metastores/metastores.go linguist-generated=true cmd/workspace/model-registry/model-registry.go linguist-generated=true cmd/workspace/model-versions/model-versions.go linguist-generated=true cmd/workspace/online-tables/online-tables.go linguist-generated=true +cmd/workspace/permission-migration/permission-migration.go linguist-generated=true cmd/workspace/permissions/permissions.go linguist-generated=true cmd/workspace/pipelines/pipelines.go linguist-generated=true cmd/workspace/policy-families/policy-families.go linguist-generated=true @@ -68,6 +76,7 @@ cmd/workspace/recipient-activation/recipient-activation.go linguist-generated=tr cmd/workspace/recipients/recipients.go linguist-generated=true cmd/workspace/registered-models/registered-models.go linguist-generated=true cmd/workspace/repos/repos.go linguist-generated=true +cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go linguist-generated=true cmd/workspace/schemas/schemas.go linguist-generated=true cmd/workspace/secrets/secrets.go linguist-generated=true cmd/workspace/service-principals/service-principals.go linguist-generated=true diff --git a/bundle/schema/docs/bundle_descriptions.json b/bundle/schema/docs/bundle_descriptions.json index 982dd4eb..494c8c75 100644 --- a/bundle/schema/docs/bundle_descriptions.json +++ b/bundle/schema/docs/bundle_descriptions.json @@ -193,7 +193,7 @@ "description": "An optional continuous property for this job. The continuous property will ensure that there is always one run executing. Only one of `schedule` and `continuous` can be used.", "properties": { "pause_status": { - "description": "Indicate whether this schedule is paused or not." + "description": "Whether this trigger is paused or not." } } }, @@ -351,13 +351,13 @@ "description": "The number of volumes launched for each instance. Users can choose up to 10 volumes.\nThis feature is only enabled for supported node types. Legacy node types cannot specify\ncustom EBS volumes.\nFor node types with no instance store, at least one EBS volume needs to be specified;\notherwise, cluster creation will fail.\n\nThese EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc.\nInstance store volumes will be mounted at `/local_disk0`, `/local_disk1`, and etc.\n\nIf EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for\nscratch storage because heterogenously sized scratch devices can lead to inefficient disk\nutilization. If no EBS volumes are attached, Databricks will configure Spark to use instance\nstore volumes.\n\nPlease note that if EBS volumes are specified, then the Spark configuration `spark.local.dir`\nwill be overridden." }, "ebs_volume_iops": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what IOPS to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_size": { "description": "The size of each EBS volume (in GiB) launched for each instance. For general purpose\nSSD, this value must be within the range 100 - 4096. For throughput optimized HDD,\nthis value must be within the range 500 - 4096." }, "ebs_volume_throughput": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what throughput to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_type": { "description": "" @@ -725,7 +725,7 @@ "description": "An optional periodic schedule for this job. The default behavior is that the job only runs when triggered by clicking “Run Now” in the Jobs UI or sending an API request to `runNow`.", "properties": { "pause_status": { - "description": "Indicate whether this schedule is paused or not." + "description": "Whether this trigger is paused or not." }, "quartz_cron_expression": { "description": "A Cron expression using Quartz syntax that describes the schedule for a job.\nSee [Cron Trigger](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html)\nfor details. This field is required.\"\n" @@ -785,7 +785,7 @@ "description": "Optional schema to write to. This parameter is only used when a warehouse_id is also provided. If not provided, the `default` schema is used." }, "source": { - "description": "Optional location type of the project directory. When set to `WORKSPACE`, the project will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the project 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`: Project is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Project is located in cloud Git provider.\n" + "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" }, "warehouse_id": { "description": "ID of the SQL warehouse to connect to. If provided, we automatically generate and provide the profile and connection details to dbt. It can be overridden on a per-command basis by using the `--profiles-dir` command line argument." @@ -959,13 +959,13 @@ "description": "The number of volumes launched for each instance. Users can choose up to 10 volumes.\nThis feature is only enabled for supported node types. Legacy node types cannot specify\ncustom EBS volumes.\nFor node types with no instance store, at least one EBS volume needs to be specified;\notherwise, cluster creation will fail.\n\nThese EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc.\nInstance store volumes will be mounted at `/local_disk0`, `/local_disk1`, and etc.\n\nIf EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for\nscratch storage because heterogenously sized scratch devices can lead to inefficient disk\nutilization. If no EBS volumes are attached, Databricks will configure Spark to use instance\nstore volumes.\n\nPlease note that if EBS volumes are specified, then the Spark configuration `spark.local.dir`\nwill be overridden." }, "ebs_volume_iops": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what IOPS to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_size": { "description": "The size of each EBS volume (in GiB) launched for each instance. For general purpose\nSSD, this value must be within the range 100 - 4096. For throughput optimized HDD,\nthis value must be within the range 500 - 4096." }, "ebs_volume_throughput": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what throughput to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_type": { "description": "" @@ -1269,7 +1269,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 project directory. When set to `WORKSPACE`, the project will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the project 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`: Project is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Project is located in cloud Git provider.\n" + "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" } } }, @@ -1371,7 +1371,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 project directory. When set to `WORKSPACE`, the project will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the project 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`: Project is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Project is located in cloud Git provider.\n" + "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" } } }, @@ -1449,7 +1449,7 @@ "description": "Path of the SQL file. Must be relative if the source is a remote Git repository and absolute for workspace paths." }, "source": { - "description": "Optional location type of the project directory. When set to `WORKSPACE`, the project will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the project 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`: Project is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Project is located in cloud Git provider.\n" + "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" } } }, @@ -1551,7 +1551,7 @@ } }, "pause_status": { - "description": "Indicate whether this schedule is paused or not." + "description": "Whether this trigger is paused or not." }, "table": { "description": "Table trigger settings.", @@ -2061,13 +2061,13 @@ "description": "The number of volumes launched for each instance. Users can choose up to 10 volumes.\nThis feature is only enabled for supported node types. Legacy node types cannot specify\ncustom EBS volumes.\nFor node types with no instance store, at least one EBS volume needs to be specified;\notherwise, cluster creation will fail.\n\nThese EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc.\nInstance store volumes will be mounted at `/local_disk0`, `/local_disk1`, and etc.\n\nIf EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for\nscratch storage because heterogenously sized scratch devices can lead to inefficient disk\nutilization. If no EBS volumes are attached, Databricks will configure Spark to use instance\nstore volumes.\n\nPlease note that if EBS volumes are specified, then the Spark configuration `spark.local.dir`\nwill be overridden." }, "ebs_volume_iops": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what IOPS to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_size": { "description": "The size of each EBS volume (in GiB) launched for each instance. For general purpose\nSSD, this value must be within the range 100 - 4096. For throughput optimized HDD,\nthis value must be within the range 500 - 4096." }, "ebs_volume_throughput": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what throughput to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_type": { "description": "" @@ -2726,7 +2726,7 @@ "description": "An optional continuous property for this job. The continuous property will ensure that there is always one run executing. Only one of `schedule` and `continuous` can be used.", "properties": { "pause_status": { - "description": "Indicate whether this schedule is paused or not." + "description": "Whether this trigger is paused or not." } } }, @@ -2884,13 +2884,13 @@ "description": "The number of volumes launched for each instance. Users can choose up to 10 volumes.\nThis feature is only enabled for supported node types. Legacy node types cannot specify\ncustom EBS volumes.\nFor node types with no instance store, at least one EBS volume needs to be specified;\notherwise, cluster creation will fail.\n\nThese EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc.\nInstance store volumes will be mounted at `/local_disk0`, `/local_disk1`, and etc.\n\nIf EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for\nscratch storage because heterogenously sized scratch devices can lead to inefficient disk\nutilization. If no EBS volumes are attached, Databricks will configure Spark to use instance\nstore volumes.\n\nPlease note that if EBS volumes are specified, then the Spark configuration `spark.local.dir`\nwill be overridden." }, "ebs_volume_iops": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what IOPS to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_size": { "description": "The size of each EBS volume (in GiB) launched for each instance. For general purpose\nSSD, this value must be within the range 100 - 4096. For throughput optimized HDD,\nthis value must be within the range 500 - 4096." }, "ebs_volume_throughput": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what throughput to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_type": { "description": "" @@ -3258,7 +3258,7 @@ "description": "An optional periodic schedule for this job. The default behavior is that the job only runs when triggered by clicking “Run Now” in the Jobs UI or sending an API request to `runNow`.", "properties": { "pause_status": { - "description": "Indicate whether this schedule is paused or not." + "description": "Whether this trigger is paused or not." }, "quartz_cron_expression": { "description": "A Cron expression using Quartz syntax that describes the schedule for a job.\nSee [Cron Trigger](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html)\nfor details. This field is required.\"\n" @@ -3318,7 +3318,7 @@ "description": "Optional schema to write to. This parameter is only used when a warehouse_id is also provided. If not provided, the `default` schema is used." }, "source": { - "description": "Optional location type of the project directory. When set to `WORKSPACE`, the project will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the project 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`: Project is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Project is located in cloud Git provider.\n" + "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" }, "warehouse_id": { "description": "ID of the SQL warehouse to connect to. If provided, we automatically generate and provide the profile and connection details to dbt. It can be overridden on a per-command basis by using the `--profiles-dir` command line argument." @@ -3492,13 +3492,13 @@ "description": "The number of volumes launched for each instance. Users can choose up to 10 volumes.\nThis feature is only enabled for supported node types. Legacy node types cannot specify\ncustom EBS volumes.\nFor node types with no instance store, at least one EBS volume needs to be specified;\notherwise, cluster creation will fail.\n\nThese EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc.\nInstance store volumes will be mounted at `/local_disk0`, `/local_disk1`, and etc.\n\nIf EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for\nscratch storage because heterogenously sized scratch devices can lead to inefficient disk\nutilization. If no EBS volumes are attached, Databricks will configure Spark to use instance\nstore volumes.\n\nPlease note that if EBS volumes are specified, then the Spark configuration `spark.local.dir`\nwill be overridden." }, "ebs_volume_iops": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what IOPS to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_size": { "description": "The size of each EBS volume (in GiB) launched for each instance. For general purpose\nSSD, this value must be within the range 100 - 4096. For throughput optimized HDD,\nthis value must be within the range 500 - 4096." }, "ebs_volume_throughput": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what throughput to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_type": { "description": "" @@ -3802,7 +3802,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 project directory. When set to `WORKSPACE`, the project will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the project 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`: Project is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Project is located in cloud Git provider.\n" + "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" } } }, @@ -3904,7 +3904,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 project directory. When set to `WORKSPACE`, the project will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the project 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`: Project is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Project is located in cloud Git provider.\n" + "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" } } }, @@ -3982,7 +3982,7 @@ "description": "Path of the SQL file. Must be relative if the source is a remote Git repository and absolute for workspace paths." }, "source": { - "description": "Optional location type of the project directory. When set to `WORKSPACE`, the project will be retrieved\nfrom the local \u003cDatabricks\u003e workspace. When set to `GIT`, the project 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`: Project is located in \u003cDatabricks\u003e workspace.\n* `GIT`: Project is located in cloud Git provider.\n" + "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" } } }, @@ -4084,7 +4084,7 @@ } }, "pause_status": { - "description": "Indicate whether this schedule is paused or not." + "description": "Whether this trigger is paused or not." }, "table": { "description": "Table trigger settings.", @@ -4594,13 +4594,13 @@ "description": "The number of volumes launched for each instance. Users can choose up to 10 volumes.\nThis feature is only enabled for supported node types. Legacy node types cannot specify\ncustom EBS volumes.\nFor node types with no instance store, at least one EBS volume needs to be specified;\notherwise, cluster creation will fail.\n\nThese EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc.\nInstance store volumes will be mounted at `/local_disk0`, `/local_disk1`, and etc.\n\nIf EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for\nscratch storage because heterogenously sized scratch devices can lead to inefficient disk\nutilization. If no EBS volumes are attached, Databricks will configure Spark to use instance\nstore volumes.\n\nPlease note that if EBS volumes are specified, then the Spark configuration `spark.local.dir`\nwill be overridden." }, "ebs_volume_iops": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what IOPS to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_size": { "description": "The size of each EBS volume (in GiB) launched for each instance. For general purpose\nSSD, this value must be within the range 100 - 4096. For throughput optimized HDD,\nthis value must be within the range 500 - 4096." }, "ebs_volume_throughput": { - "description": "\u003cneeds content added\u003e" + "description": "If using gp3 volumes, what throughput to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used." }, "ebs_volume_type": { "description": "" diff --git a/cmd/account/access-control/access-control.go b/cmd/account/access-control/access-control.go index 36b69d01..76ad4b51 100755 --- a/cmd/account/access-control/access-control.go +++ b/cmd/account/access-control/access-control.go @@ -29,6 +29,11 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newGetAssignableRolesForResource()) + cmd.AddCommand(newGetRuleSet()) + cmd.AddCommand(newUpdateRuleSet()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -97,12 +102,6 @@ func newGetAssignableRolesForResource() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetAssignableRolesForResource()) - }) -} - // start get-rule-set command // Slice with functions to override default command behavior. @@ -172,12 +171,6 @@ func newGetRuleSet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetRuleSet()) - }) -} - // start update-rule-set command // Slice with functions to override default command behavior. @@ -239,10 +232,4 @@ func newUpdateRuleSet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateRuleSet()) - }) -} - // end service AccountAccessControl diff --git a/cmd/account/billable-usage/billable-usage.go b/cmd/account/billable-usage/billable-usage.go index bbbc9af2..d8d36bac 100755 --- a/cmd/account/billable-usage/billable-usage.go +++ b/cmd/account/billable-usage/billable-usage.go @@ -25,6 +25,9 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newDownload()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -107,10 +110,4 @@ func newDownload() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDownload()) - }) -} - // end service BillableUsage diff --git a/cmd/account/budgets/budgets.go b/cmd/account/budgets/budgets.go index dfa2f6bc..e6f87a95 100755 --- a/cmd/account/budgets/budgets.go +++ b/cmd/account/budgets/budgets.go @@ -31,6 +31,13 @@ func New() *cobra.Command { Hidden: true, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -98,12 +105,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -174,12 +175,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -251,12 +246,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -297,12 +286,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -372,10 +355,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Budgets diff --git a/cmd/account/credentials/credentials.go b/cmd/account/credentials/credentials.go index 72fcd70b..ed071cda 100755 --- a/cmd/account/credentials/credentials.go +++ b/cmd/account/credentials/credentials.go @@ -31,6 +31,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -111,12 +117,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -189,12 +189,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -266,12 +260,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -315,10 +303,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service Credentials diff --git a/cmd/account/csp-enablement-account/csp-enablement-account.go b/cmd/account/csp-enablement-account/csp-enablement-account.go new file mode 100755 index 00000000..ca2170fa --- /dev/null +++ b/cmd/account/csp-enablement-account/csp-enablement-account.go @@ -0,0 +1,159 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package csp_enablement_account + +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/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "csp-enablement-account", + Short: `The compliance security profile settings at the account level control whether to enable it for new workspaces.`, + Long: `The compliance security profile settings at the account level control whether + to enable it for new workspaces. By default, this account-level setting is + disabled for new workspaces. After workspace creation, account admins can + enable the compliance security profile individually for each workspace. + + This settings can be disabled so that new workspaces do not have compliance + security profile enabled by default.`, + } + + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start get command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var getOverrides []func( + *cobra.Command, + *settings.GetCspEnablementAccountRequest, +) + +func newGet() *cobra.Command { + cmd := &cobra.Command{} + + var getReq settings.GetCspEnablementAccountRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`) + + cmd.Use = "get" + cmd.Short = `Get the compliance security profile setting for new workspaces.` + cmd.Long = `Get the compliance security profile setting for new workspaces. + + Gets the compliance security profile setting for new workspaces.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustAccountClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + a := root.AccountClient(ctx) + + response, err := a.Settings.CspEnablementAccount().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getOverrides { + fn(cmd, &getReq) + } + + return cmd +} + +// start update command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var updateOverrides []func( + *cobra.Command, + *settings.UpdateCspEnablementAccountSettingRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq settings.UpdateCspEnablementAccountSettingRequest + var updateJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update" + cmd.Short = `Update the compliance security profile setting for new workspaces.` + cmd.Long = `Update the compliance security profile setting for new workspaces. + + Updates the value of the compliance security profile setting for new + workspaces.` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustAccountClient + cmd.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 { + return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + } + + response, err := a.Settings.CspEnablementAccount().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range updateOverrides { + fn(cmd, &updateReq) + } + + return cmd +} + +// end service CSPEnablementAccount diff --git a/cmd/account/custom-app-integration/custom-app-integration.go b/cmd/account/custom-app-integration/custom-app-integration.go index 79c0f837..79dd50c1 100755 --- a/cmd/account/custom-app-integration/custom-app-integration.go +++ b/cmd/account/custom-app-integration/custom-app-integration.go @@ -29,6 +29,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -103,12 +110,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -168,12 +169,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -232,12 +227,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -278,12 +267,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -354,10 +337,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service CustomAppIntegration diff --git a/cmd/account/encryption-keys/encryption-keys.go b/cmd/account/encryption-keys/encryption-keys.go index 3977f583..c82f385e 100755 --- a/cmd/account/encryption-keys/encryption-keys.go +++ b/cmd/account/encryption-keys/encryption-keys.go @@ -42,6 +42,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -128,12 +134,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -193,12 +193,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -271,12 +265,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -331,10 +319,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service EncryptionKeys diff --git a/cmd/account/esm-enablement-account/esm-enablement-account.go b/cmd/account/esm-enablement-account/esm-enablement-account.go new file mode 100755 index 00000000..fc793d60 --- /dev/null +++ b/cmd/account/esm-enablement-account/esm-enablement-account.go @@ -0,0 +1,157 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package esm_enablement_account + +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/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "esm-enablement-account", + Short: `The enhanced security monitoring setting at the account level controls whether to enable the feature on new workspaces.`, + Long: `The enhanced security monitoring setting at the account level controls whether + to enable the feature on new workspaces. By default, this account-level + setting is disabled for new workspaces. After workspace creation, account + admins can enable enhanced security monitoring individually for each + workspace.`, + } + + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start get command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var getOverrides []func( + *cobra.Command, + *settings.GetEsmEnablementAccountRequest, +) + +func newGet() *cobra.Command { + cmd := &cobra.Command{} + + var getReq settings.GetEsmEnablementAccountRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`) + + cmd.Use = "get" + cmd.Short = `Get the enhanced security monitoring setting for new workspaces.` + cmd.Long = `Get the enhanced security monitoring setting for new workspaces. + + Gets the enhanced security monitoring setting for new workspaces.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustAccountClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + a := root.AccountClient(ctx) + + response, err := a.Settings.EsmEnablementAccount().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getOverrides { + fn(cmd, &getReq) + } + + return cmd +} + +// start update command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var updateOverrides []func( + *cobra.Command, + *settings.UpdateEsmEnablementAccountSettingRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq settings.UpdateEsmEnablementAccountSettingRequest + var updateJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update" + cmd.Short = `Update the enhanced security monitoring setting for new workspaces.` + cmd.Long = `Update the enhanced security monitoring setting for new workspaces. + + Updates the value of the enhanced security monitoring setting for new + workspaces.` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustAccountClient + cmd.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 { + return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + } + + response, err := a.Settings.EsmEnablementAccount().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range updateOverrides { + fn(cmd, &updateReq) + } + + return cmd +} + +// end service ESMEnablementAccount diff --git a/cmd/account/groups/groups.go b/cmd/account/groups/groups.go index a068fba4..68ae1b2a 100755 --- a/cmd/account/groups/groups.go +++ b/cmd/account/groups/groups.go @@ -33,6 +33,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newPatch()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -114,12 +122,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -190,12 +192,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -266,12 +262,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -330,12 +320,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start patch command // Slice with functions to override default command behavior. @@ -417,12 +401,6 @@ func newPatch() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPatch()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -511,10 +489,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service AccountGroups diff --git a/cmd/account/ip-access-lists/ip-access-lists.go b/cmd/account/ip-access-lists/ip-access-lists.go index dd836c90..364c5a91 100755 --- a/cmd/account/ip-access-lists/ip-access-lists.go +++ b/cmd/account/ip-access-lists/ip-access-lists.go @@ -48,6 +48,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newReplace()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -158,12 +166,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -234,12 +236,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -310,12 +306,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -355,12 +345,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start replace command // Slice with functions to override default command behavior. @@ -468,12 +452,6 @@ func newReplace() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newReplace()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -570,10 +548,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service AccountIpAccessLists diff --git a/cmd/account/log-delivery/log-delivery.go b/cmd/account/log-delivery/log-delivery.go index eed8942b..f51573e9 100755 --- a/cmd/account/log-delivery/log-delivery.go +++ b/cmd/account/log-delivery/log-delivery.go @@ -85,6 +85,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newPatchStatus()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -181,12 +187,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -258,12 +258,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -319,12 +313,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start patch-status command // Slice with functions to override default command behavior. @@ -413,10 +401,4 @@ func newPatchStatus() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPatchStatus()) - }) -} - // end service LogDelivery diff --git a/cmd/account/metastore-assignments/metastore-assignments.go b/cmd/account/metastore-assignments/metastore-assignments.go index b1d0508b..013d25cf 100755 --- a/cmd/account/metastore-assignments/metastore-assignments.go +++ b/cmd/account/metastore-assignments/metastore-assignments.go @@ -27,6 +27,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -108,12 +115,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -178,12 +179,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -248,12 +243,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -310,12 +299,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -390,10 +373,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service AccountMetastoreAssignments diff --git a/cmd/account/metastores/metastores.go b/cmd/account/metastores/metastores.go index e8b7c8f7..bcccff81 100755 --- a/cmd/account/metastores/metastores.go +++ b/cmd/account/metastores/metastores.go @@ -26,6 +26,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -98,12 +105,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -164,12 +165,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -228,12 +223,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -273,12 +262,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -347,10 +330,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service AccountMetastores diff --git a/cmd/account/network-connectivity/network-connectivity.go b/cmd/account/network-connectivity/network-connectivity.go index bfe116f2..fbde0694 100755 --- a/cmd/account/network-connectivity/network-connectivity.go +++ b/cmd/account/network-connectivity/network-connectivity.go @@ -21,20 +21,23 @@ func New() *cobra.Command { Use: "network-connectivity", Short: `These APIs provide configurations for the network connectivity of your workspaces for serverless compute resources.`, Long: `These APIs provide configurations for the network connectivity of your - workspaces for serverless compute resources. This API provides stable subnets - for your workspace so that you can configure your firewalls on your Azure - Storage accounts to allow access from Databricks. You can also use the API to - provision private endpoints for Databricks to privately connect serverless - compute resources to your Azure resources using Azure Private Link. See - [configure serverless secure connectivity]. - - [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security`, + workspaces for serverless compute resources.`, GroupID: "settings", Annotations: map[string]string{ "package": "settings", }, } + // Add methods + cmd.AddCommand(newCreateNetworkConnectivityConfiguration()) + cmd.AddCommand(newCreatePrivateEndpointRule()) + cmd.AddCommand(newDeleteNetworkConnectivityConfiguration()) + cmd.AddCommand(newDeletePrivateEndpointRule()) + cmd.AddCommand(newGetNetworkConnectivityConfiguration()) + cmd.AddCommand(newGetPrivateEndpointRule()) + cmd.AddCommand(newListNetworkConnectivityConfigurations()) + cmd.AddCommand(newListPrivateEndpointRules()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -64,29 +67,14 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command { cmd.Use = "create-network-connectivity-configuration NAME REGION" cmd.Short = `Create a network connectivity configuration.` cmd.Long = `Create a network connectivity configuration. - - Creates a network connectivity configuration (NCC), which provides stable - Azure service subnets when accessing your Azure Storage accounts. You can also - use a network connectivity configuration to create Databricks-managed private - endpoints so that Databricks serverless compute resources privately access - your resources. - - **IMPORTANT**: After you create the network connectivity configuration, you - must assign one or more workspaces to the new network connectivity - configuration. You can share one network connectivity configuration with - multiple workspaces from the same Azure region within the same Databricks - account. See [configure serverless secure connectivity]. - - [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security Arguments: NAME: The name of the network connectivity configuration. The name can contain alphanumeric characters, hyphens, and underscores. The length must be between 3 and 30 characters. The name must match the regular expression ^[0-9a-zA-Z-_]{3,30}$. - REGION: The Azure region for this network connectivity configuration. Only - workspaces in the same Azure region can be attached to this network - connectivity configuration.` + REGION: The region for the network connectivity configuration. Only workspaces in + the same region can be attached to the network connectivity configuration.` cmd.Annotations = make(map[string]string) @@ -139,12 +127,6 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateNetworkConnectivityConfiguration()) - }) -} - // start create-private-endpoint-rule command // Slice with functions to override default command behavior. @@ -240,12 +222,6 @@ func newCreatePrivateEndpointRule() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreatePrivateEndpointRule()) - }) -} - // start delete-network-connectivity-configuration command // Slice with functions to override default command behavior. @@ -304,12 +280,6 @@ func newDeleteNetworkConnectivityConfiguration() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteNetworkConnectivityConfiguration()) - }) -} - // start delete-private-endpoint-rule command // Slice with functions to override default command behavior. @@ -374,12 +344,6 @@ func newDeletePrivateEndpointRule() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeletePrivateEndpointRule()) - }) -} - // start get-network-connectivity-configuration command // Slice with functions to override default command behavior. @@ -438,12 +402,6 @@ func newGetNetworkConnectivityConfiguration() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetNetworkConnectivityConfiguration()) - }) -} - // start get-private-endpoint-rule command // Slice with functions to override default command behavior. @@ -504,12 +462,6 @@ func newGetPrivateEndpointRule() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPrivateEndpointRule()) - }) -} - // start list-network-connectivity-configurations command // Slice with functions to override default command behavior. @@ -562,12 +514,6 @@ func newListNetworkConnectivityConfigurations() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListNetworkConnectivityConfigurations()) - }) -} - // start list-private-endpoint-rules command // Slice with functions to override default command behavior. @@ -625,10 +571,4 @@ func newListPrivateEndpointRules() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListPrivateEndpointRules()) - }) -} - // end service NetworkConnectivity diff --git a/cmd/account/networks/networks.go b/cmd/account/networks/networks.go index 15586bdc..6dc77297 100755 --- a/cmd/account/networks/networks.go +++ b/cmd/account/networks/networks.go @@ -28,6 +28,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -119,12 +125,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -200,12 +200,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -277,12 +271,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -329,10 +317,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service Networks diff --git a/cmd/account/o-auth-published-apps/o-auth-published-apps.go b/cmd/account/o-auth-published-apps/o-auth-published-apps.go index 1ce363ac..a9e94e5a 100755 --- a/cmd/account/o-auth-published-apps/o-auth-published-apps.go +++ b/cmd/account/o-auth-published-apps/o-auth-published-apps.go @@ -27,6 +27,9 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -88,10 +91,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service OAuthPublishedApps diff --git a/cmd/account/personal-compute/personal-compute.go b/cmd/account/personal-compute/personal-compute.go new file mode 100755 index 00000000..79090faf --- /dev/null +++ b/cmd/account/personal-compute/personal-compute.go @@ -0,0 +1,219 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package personal_compute + +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/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "personal-compute", + Short: `The Personal Compute enablement setting lets you control which users can use the Personal Compute default policy to create compute resources.`, + Long: `The Personal Compute enablement setting lets you control which users can use + the Personal Compute default policy to create compute resources. By default + all users in all workspaces have access (ON), but you can change the setting + to instead let individual workspaces configure access control (DELEGATE). + + There is only one instance of this setting per account. Since this setting has + a default value, this setting is present on all accounts even though it's + never set on a given account. Deletion reverts the value of the setting back + to the default value.`, + + // This service is being previewed; hide from help output. + Hidden: true, + } + + // Add methods + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start delete command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var deleteOverrides []func( + *cobra.Command, + *settings.DeletePersonalComputeRequest, +) + +func newDelete() *cobra.Command { + cmd := &cobra.Command{} + + var deleteReq settings.DeletePersonalComputeRequest + + // TODO: short flags + + cmd.Flags().StringVar(&deleteReq.Etag, "etag", deleteReq.Etag, `etag used for versioning.`) + + cmd.Use = "delete" + cmd.Short = `Delete Personal Compute setting.` + cmd.Long = `Delete Personal Compute setting. + + Reverts back the Personal Compute setting value to default (ON)` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustAccountClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + a := root.AccountClient(ctx) + + response, err := a.Settings.PersonalCompute().Delete(ctx, deleteReq) + 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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range deleteOverrides { + fn(cmd, &deleteReq) + } + + return cmd +} + +// start get command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var getOverrides []func( + *cobra.Command, + *settings.GetPersonalComputeRequest, +) + +func newGet() *cobra.Command { + cmd := &cobra.Command{} + + var getReq settings.GetPersonalComputeRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`) + + cmd.Use = "get" + cmd.Short = `Get Personal Compute setting.` + cmd.Long = `Get Personal Compute setting. + + Gets the value of the Personal Compute setting.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustAccountClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + a := root.AccountClient(ctx) + + response, err := a.Settings.PersonalCompute().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getOverrides { + fn(cmd, &getReq) + } + + return cmd +} + +// start update command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var updateOverrides []func( + *cobra.Command, + *settings.UpdatePersonalComputeSettingRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq settings.UpdatePersonalComputeSettingRequest + var updateJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update" + cmd.Short = `Update Personal Compute setting.` + cmd.Long = `Update Personal Compute setting. + + Updates the value of the Personal Compute setting.` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustAccountClient + cmd.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 { + return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + } + + response, err := a.Settings.PersonalCompute().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range updateOverrides { + fn(cmd, &updateReq) + } + + return cmd +} + +// end service PersonalCompute diff --git a/cmd/account/private-access/private-access.go b/cmd/account/private-access/private-access.go index 458ff827..4641223c 100755 --- a/cmd/account/private-access/private-access.go +++ b/cmd/account/private-access/private-access.go @@ -27,6 +27,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newReplace()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -133,12 +140,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -216,12 +217,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -299,12 +294,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -348,12 +337,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start replace command // Slice with functions to override default command behavior. @@ -460,10 +443,4 @@ func newReplace() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newReplace()) - }) -} - // end service PrivateAccess diff --git a/cmd/account/published-app-integration/published-app-integration.go b/cmd/account/published-app-integration/published-app-integration.go index 54cf6337..8befd39b 100755 --- a/cmd/account/published-app-integration/published-app-integration.go +++ b/cmd/account/published-app-integration/published-app-integration.go @@ -27,6 +27,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -103,12 +110,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -168,12 +169,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -232,12 +227,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -278,12 +267,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -353,10 +336,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service PublishedAppIntegration diff --git a/cmd/account/service-principal-secrets/service-principal-secrets.go b/cmd/account/service-principal-secrets/service-principal-secrets.go index 1a646e25..0239df66 100755 --- a/cmd/account/service-principal-secrets/service-principal-secrets.go +++ b/cmd/account/service-principal-secrets/service-principal-secrets.go @@ -38,6 +38,11 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -107,12 +112,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -176,12 +175,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -242,10 +235,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service ServicePrincipalSecrets diff --git a/cmd/account/service-principals/service-principals.go b/cmd/account/service-principals/service-principals.go index af18d534..b9ad194c 100755 --- a/cmd/account/service-principals/service-principals.go +++ b/cmd/account/service-principals/service-principals.go @@ -32,6 +32,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newPatch()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -112,12 +120,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -188,12 +190,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -265,12 +261,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -329,12 +319,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start patch command // Slice with functions to override default command behavior. @@ -417,12 +401,6 @@ func newPatch() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPatch()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -513,10 +491,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service AccountServicePrincipals diff --git a/cmd/account/settings/settings.go b/cmd/account/settings/settings.go index adeda73d..a750e81e 100755 --- a/cmd/account/settings/settings.go +++ b/cmd/account/settings/settings.go @@ -3,13 +3,11 @@ package settings 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/settings" "github.com/spf13/cobra" + + csp_enablement_account "github.com/databricks/cli/cmd/account/csp-enablement-account" + esm_enablement_account "github.com/databricks/cli/cmd/account/esm-enablement-account" + personal_compute "github.com/databricks/cli/cmd/account/personal-compute" ) // Slice with functions to override default command behavior. @@ -18,26 +16,20 @@ var cmdOverrides []func(*cobra.Command) func New() *cobra.Command { cmd := &cobra.Command{ - Use: "settings", - Short: `The Personal Compute enablement setting lets you control which users can use the Personal Compute default policy to create compute resources.`, - Long: `The Personal Compute enablement setting lets you control which users can use - the Personal Compute default policy to create compute resources. By default - all users in all workspaces have access (ON), but you can change the setting - to instead let individual workspaces configure access control (DELEGATE). - - There is only one instance of this setting per account. Since this setting has - a default value, this setting is present on all accounts even though it's - never set on a given account. Deletion reverts the value of the setting back - to the default value.`, + Use: "settings", + Short: `Accounts Settings API allows users to manage settings at the account level.`, + Long: `Accounts Settings API allows users to manage settings at the account level.`, GroupID: "settings", Annotations: map[string]string{ "package": "settings", }, - - // This service is being previewed; hide from help output. - Hidden: true, } + // Add subservices + cmd.AddCommand(csp_enablement_account.New()) + cmd.AddCommand(esm_enablement_account.New()) + cmd.AddCommand(personal_compute.New()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -46,191 +38,4 @@ func New() *cobra.Command { return cmd } -// start delete-personal-compute-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var deletePersonalComputeSettingOverrides []func( - *cobra.Command, - *settings.DeletePersonalComputeSettingRequest, -) - -func newDeletePersonalComputeSetting() *cobra.Command { - cmd := &cobra.Command{} - - var deletePersonalComputeSettingReq settings.DeletePersonalComputeSettingRequest - - // TODO: short flags - - cmd.Flags().StringVar(&deletePersonalComputeSettingReq.Etag, "etag", deletePersonalComputeSettingReq.Etag, `etag used for versioning.`) - - cmd.Use = "delete-personal-compute-setting" - cmd.Short = `Delete Personal Compute setting.` - cmd.Long = `Delete Personal Compute setting. - - Reverts back the Personal Compute setting value to default (ON)` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) - return check(cmd, args) - } - - cmd.PreRunE = root.MustAccountClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - a := root.AccountClient(ctx) - - response, err := a.Settings.DeletePersonalComputeSetting(ctx, deletePersonalComputeSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range deletePersonalComputeSettingOverrides { - fn(cmd, &deletePersonalComputeSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeletePersonalComputeSetting()) - }) -} - -// start get-personal-compute-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var getPersonalComputeSettingOverrides []func( - *cobra.Command, - *settings.GetPersonalComputeSettingRequest, -) - -func newGetPersonalComputeSetting() *cobra.Command { - cmd := &cobra.Command{} - - var getPersonalComputeSettingReq settings.GetPersonalComputeSettingRequest - - // TODO: short flags - - cmd.Flags().StringVar(&getPersonalComputeSettingReq.Etag, "etag", getPersonalComputeSettingReq.Etag, `etag used for versioning.`) - - cmd.Use = "get-personal-compute-setting" - cmd.Short = `Get Personal Compute setting.` - cmd.Long = `Get Personal Compute setting. - - Gets the value of the Personal Compute setting.` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) - return check(cmd, args) - } - - cmd.PreRunE = root.MustAccountClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - a := root.AccountClient(ctx) - - response, err := a.Settings.GetPersonalComputeSetting(ctx, getPersonalComputeSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range getPersonalComputeSettingOverrides { - fn(cmd, &getPersonalComputeSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPersonalComputeSetting()) - }) -} - -// start update-personal-compute-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var updatePersonalComputeSettingOverrides []func( - *cobra.Command, - *settings.UpdatePersonalComputeSettingRequest, -) - -func newUpdatePersonalComputeSetting() *cobra.Command { - cmd := &cobra.Command{} - - var updatePersonalComputeSettingReq settings.UpdatePersonalComputeSettingRequest - var updatePersonalComputeSettingJson flags.JsonFlag - - // TODO: short flags - cmd.Flags().Var(&updatePersonalComputeSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`) - - cmd.Use = "update-personal-compute-setting" - cmd.Short = `Update Personal Compute setting.` - cmd.Long = `Update Personal Compute setting. - - Updates the value of the Personal Compute setting.` - - cmd.Annotations = make(map[string]string) - - cmd.PreRunE = root.MustAccountClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - a := root.AccountClient(ctx) - - if cmd.Flags().Changed("json") { - err = updatePersonalComputeSettingJson.Unmarshal(&updatePersonalComputeSettingReq) - if err != nil { - return err - } - } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") - } - - response, err := a.Settings.UpdatePersonalComputeSetting(ctx, updatePersonalComputeSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range updatePersonalComputeSettingOverrides { - fn(cmd, &updatePersonalComputeSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePersonalComputeSetting()) - }) -} - // end service AccountSettings diff --git a/cmd/account/storage-credentials/storage-credentials.go b/cmd/account/storage-credentials/storage-credentials.go index 35b865c7..61f8521b 100755 --- a/cmd/account/storage-credentials/storage-credentials.go +++ b/cmd/account/storage-credentials/storage-credentials.go @@ -25,6 +25,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -107,12 +114,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -176,12 +177,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -244,12 +239,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -309,12 +298,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -387,10 +370,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service AccountStorageCredentials diff --git a/cmd/account/storage/storage.go b/cmd/account/storage/storage.go index d671355d..50460ed0 100755 --- a/cmd/account/storage/storage.go +++ b/cmd/account/storage/storage.go @@ -32,6 +32,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -108,12 +114,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -185,12 +185,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -261,12 +255,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -310,10 +298,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service Storage diff --git a/cmd/account/users/users.go b/cmd/account/users/users.go index f5b81f21..ab4bd95b 100755 --- a/cmd/account/users/users.go +++ b/cmd/account/users/users.go @@ -37,6 +37,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newPatch()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -120,12 +128,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -197,12 +199,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -281,12 +277,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -345,12 +335,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start patch command // Slice with functions to override default command behavior. @@ -433,12 +417,6 @@ func newPatch() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPatch()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -530,10 +508,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service AccountUsers diff --git a/cmd/account/vpc-endpoints/vpc-endpoints.go b/cmd/account/vpc-endpoints/vpc-endpoints.go index 6d80e731..0c15ca9c 100755 --- a/cmd/account/vpc-endpoints/vpc-endpoints.go +++ b/cmd/account/vpc-endpoints/vpc-endpoints.go @@ -27,6 +27,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -126,12 +132,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -210,12 +210,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -290,12 +284,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -343,10 +331,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service VpcEndpoints diff --git a/cmd/account/workspace-assignment/workspace-assignment.go b/cmd/account/workspace-assignment/workspace-assignment.go index ab82cd39..20f88524 100755 --- a/cmd/account/workspace-assignment/workspace-assignment.go +++ b/cmd/account/workspace-assignment/workspace-assignment.go @@ -28,6 +28,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -103,12 +109,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -170,12 +170,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -235,12 +229,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -318,10 +306,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service WorkspaceAssignment diff --git a/cmd/account/workspaces/workspaces.go b/cmd/account/workspaces/workspaces.go index 500a7b77..2cc0cb1a 100755 --- a/cmd/account/workspaces/workspaces.go +++ b/cmd/account/workspaces/workspaces.go @@ -35,6 +35,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -166,12 +173,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -252,12 +253,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -344,12 +339,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -396,12 +385,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -429,7 +412,7 @@ func newUpdate() *cobra.Command { cmd.Flags().StringVar(&updateReq.CredentialsId, "credentials-id", updateReq.CredentialsId, `ID of the workspace's credential configuration object.`) // TODO: map via StringToStringVar: custom_tags cmd.Flags().StringVar(&updateReq.ManagedServicesCustomerManagedKeyId, "managed-services-customer-managed-key-id", updateReq.ManagedServicesCustomerManagedKeyId, `The ID of the workspace's managed services encryption key configuration object.`) - cmd.Flags().StringVar(&updateReq.NetworkConnectivityConfigId, "network-connectivity-config-id", updateReq.NetworkConnectivityConfigId, `The ID of the network connectivity configuration object, which is the parent resource of this private endpoint rule object.`) + cmd.Flags().StringVar(&updateReq.NetworkConnectivityConfigId, "network-connectivity-config-id", updateReq.NetworkConnectivityConfigId, ``) cmd.Flags().StringVar(&updateReq.NetworkId, "network-id", updateReq.NetworkId, `The ID of the workspace's network configuration object.`) cmd.Flags().StringVar(&updateReq.StorageConfigurationId, "storage-configuration-id", updateReq.StorageConfigurationId, `The ID of the workspace's storage configuration object.`) cmd.Flags().StringVar(&updateReq.StorageCustomerManagedKeyId, "storage-customer-managed-key-id", updateReq.StorageCustomerManagedKeyId, `The ID of the key configuration object for workspace storage.`) @@ -464,7 +447,12 @@ func newUpdate() *cobra.Command { workspace to add support for front-end, back-end, or both types of connectivity. You cannot remove (downgrade) any existing front-end or back-end PrivateLink support on a workspace. - Custom tags. Given you provide an empty - custom tags, the update would not be applied. + custom tags, the update would not be applied. - Network connectivity + configuration ID to add serverless stable IP support. You can add or update + the network connectivity configuration ID to ensure the workspace uses the + same set of stable IP CIDR blocks to access your resources. You cannot remove + a network connectivity configuration from the workspace once attached, you can + only switch to another one. After calling the PATCH operation to update the workspace configuration, make repeated GET requests with the workspace ID and check the workspace @@ -476,25 +464,22 @@ func newUpdate() *cobra.Command { ### Update a running workspace You can update a Databricks workspace configuration for running workspaces for some fields, but not all fields. For a running workspace, this request supports updating the following fields only: - - Credential configuration ID - - - Network configuration ID. Used only if you already use a customer-managed - VPC. You cannot convert a running workspace from a Databricks-managed VPC to a - customer-managed VPC. You can use a network configuration update in this API - for a failed or running workspace to add support for PrivateLink, although you - also need to add a private access settings object. - - - Key configuration ID for managed services (control plane storage, such as - notebook source and Databricks SQL queries). Databricks does not directly - encrypt the data with the customer-managed key (CMK). Databricks uses both the - CMK and the Databricks managed key (DMK) that is unique to your workspace to - encrypt the Data Encryption Key (DEK). Databricks uses the DEK to encrypt your - workspace's managed services persisted data. If the workspace does not already - have a CMK for managed services, adding this ID enables managed services - encryption for new or updated data. Existing managed services data that - existed before adding the key remains not encrypted with the DEK until it is - modified. If the workspace already has customer-managed keys for managed - services, this request rotates (changes) the CMK keys and the DEK is + - Credential configuration ID - Network configuration ID. Used only if you + already use a customer-managed VPC. You cannot convert a running workspace + from a Databricks-managed VPC to a customer-managed VPC. You can use a network + configuration update in this API for a failed or running workspace to add + support for PrivateLink, although you also need to add a private access + settings object. - Key configuration ID for managed services (control plane + storage, such as notebook source and Databricks SQL queries). Databricks does + not directly encrypt the data with the customer-managed key (CMK). Databricks + uses both the CMK and the Databricks managed key (DMK) that is unique to your + workspace to encrypt the Data Encryption Key (DEK). Databricks uses the DEK to + encrypt your workspace's managed services persisted data. If the workspace + does not already have a CMK for managed services, adding this ID enables + managed services encryption for new or updated data. Existing managed services + data that existed before adding the key remains not encrypted with the DEK + until it is modified. If the workspace already has customer-managed keys for + managed services, this request rotates (changes) the CMK keys and the DEK is re-encrypted with the DMK and the new CMK. - Key configuration ID for workspace storage (root S3 bucket and, optionally, EBS volumes). You can set this only if the workspace does not already have a customer-managed key @@ -503,7 +488,12 @@ func newUpdate() *cobra.Command { upgrade a workspace to add support for front-end, back-end, or both types of connectivity. You cannot remove (downgrade) any existing front-end or back-end PrivateLink support on a workspace. - Custom tags. Given you provide an empty - custom tags, the update would not be applied. + custom tags, the update would not be applied. - Network connectivity + configuration ID to add serverless stable IP support. You can add or update + the network connectivity configuration ID to ensure the workspace uses the + same set of stable IP CIDR blocks to access your resources. You cannot remove + a network connectivity configuration from the workspace once attached, you can + only switch to another one. **Important**: To update a running workspace, your workspace must have no running compute resources that run in your workspace's VPC in the Classic data @@ -523,11 +513,9 @@ func newUpdate() *cobra.Command { This results in a total of up to 40 minutes in which you cannot create clusters. If you create or use clusters before this time interval elapses, clusters do not launch successfully, fail, or could cause other unexpected - behavior. - - * For workspaces with a customer-managed VPC, the workspace status stays at - status RUNNING and the VPC change happens immediately. A change to the - storage customer-managed key configuration ID might take a few minutes to + behavior. * For workspaces with a customer-managed VPC, the workspace status + stays at status RUNNING and the VPC change happens immediately. A change to + the storage customer-managed key configuration ID might take a few minutes to update, so continue to check the workspace until you observe that it has been updated. If the update fails, the workspace might revert silently to its original configuration. After the workspace has been updated, you cannot use @@ -621,10 +609,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Workspaces diff --git a/cmd/workspace/alerts/alerts.go b/cmd/workspace/alerts/alerts.go index 773a3487..695fa6a9 100755 --- a/cmd/workspace/alerts/alerts.go +++ b/cmd/workspace/alerts/alerts.go @@ -31,6 +31,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -103,12 +110,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -178,12 +179,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -251,12 +246,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -299,12 +288,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -372,10 +355,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Alerts diff --git a/cmd/workspace/apps/apps.go b/cmd/workspace/apps/apps.go index f0bd6acf..691584db 100755 --- a/cmd/workspace/apps/apps.go +++ b/cmd/workspace/apps/apps.go @@ -32,6 +32,14 @@ func New() *cobra.Command { Hidden: true, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDeleteApp()) + cmd.AddCommand(newGetApp()) + cmd.AddCommand(newGetAppDeploymentStatus()) + cmd.AddCommand(newGetApps()) + cmd.AddCommand(newGetEvents()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -58,7 +66,7 @@ func newCreate() *cobra.Command { // TODO: short flags cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) - // TODO: output-only field + // TODO: any: resources cmd.Use = "create" cmd.Short = `Create and deploy an application.` @@ -101,12 +109,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete-app command // Slice with functions to override default command behavior. @@ -165,12 +167,6 @@ func newDeleteApp() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteApp()) - }) -} - // start get-app command // Slice with functions to override default command behavior. @@ -229,12 +225,6 @@ func newGetApp() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetApp()) - }) -} - // start get-app-deployment-status command // Slice with functions to override default command behavior. @@ -295,12 +285,6 @@ func newGetAppDeploymentStatus() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetAppDeploymentStatus()) - }) -} - // start get-apps command // Slice with functions to override default command behavior. @@ -343,12 +327,6 @@ func newGetApps() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetApps()) - }) -} - // start get-events command // Slice with functions to override default command behavior. @@ -407,10 +385,4 @@ func newGetEvents() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetEvents()) - }) -} - // end service Apps diff --git a/cmd/workspace/artifact-allowlists/artifact-allowlists.go b/cmd/workspace/artifact-allowlists/artifact-allowlists.go index e0b36ff9..329ca9c3 100755 --- a/cmd/workspace/artifact-allowlists/artifact-allowlists.go +++ b/cmd/workspace/artifact-allowlists/artifact-allowlists.go @@ -29,6 +29,10 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -99,12 +103,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -178,10 +176,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service ArtifactAllowlists diff --git a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go new file mode 100755 index 00000000..4c6e643d --- /dev/null +++ b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go @@ -0,0 +1,157 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package automatic_cluster_update + +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/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "automatic-cluster-update", + Short: `Controls whether automatic cluster update is enabled for the current workspace.`, + Long: `Controls whether automatic cluster update is enabled for the current + workspace. By default, it is turned off.`, + } + + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start get command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var getOverrides []func( + *cobra.Command, + *settings.GetAutomaticClusterUpdateRequest, +) + +func newGet() *cobra.Command { + cmd := &cobra.Command{} + + var getReq settings.GetAutomaticClusterUpdateRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`) + + cmd.Use = "get" + cmd.Short = `Get the automatic cluster update setting.` + cmd.Long = `Get the automatic cluster update setting. + + Gets the automatic cluster update setting.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + response, err := w.Settings.AutomaticClusterUpdate().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getOverrides { + fn(cmd, &getReq) + } + + return cmd +} + +// start update command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var updateOverrides []func( + *cobra.Command, + *settings.UpdateAutomaticClusterUpdateSettingRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq settings.UpdateAutomaticClusterUpdateSettingRequest + var updateJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update" + cmd.Short = `Update the automatic cluster update setting.` + cmd.Long = `Update the automatic cluster update setting. + + Updates the automatic cluster update setting for the workspace. A fresh etag + needs to be provided in PATCH requests (as part of the setting field). The + etag can be retrieved by making a GET request before the PATCH request. If + the setting is updated concurrently, PATCH fails with 409 and the request + must be retried by using the fresh etag in the 409 response.` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustWorkspaceClient + cmd.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("please provide command input in JSON format by specifying the --json flag") + } + + response, err := w.Settings.AutomaticClusterUpdate().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range updateOverrides { + fn(cmd, &updateReq) + } + + return cmd +} + +// end service AutomaticClusterUpdate diff --git a/cmd/workspace/catalogs/catalogs.go b/cmd/workspace/catalogs/catalogs.go index 8e639023..b0876942 100755 --- a/cmd/workspace/catalogs/catalogs.go +++ b/cmd/workspace/catalogs/catalogs.go @@ -34,6 +34,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -126,12 +133,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -193,12 +194,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -259,12 +254,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -308,12 +297,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -389,10 +372,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Catalogs diff --git a/cmd/workspace/clean-rooms/clean-rooms.go b/cmd/workspace/clean-rooms/clean-rooms.go index 4cee2ce6..33facfb9 100755 --- a/cmd/workspace/clean-rooms/clean-rooms.go +++ b/cmd/workspace/clean-rooms/clean-rooms.go @@ -35,6 +35,13 @@ func New() *cobra.Command { Hidden: true, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -105,12 +112,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -170,12 +171,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -237,12 +232,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -298,12 +287,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -387,10 +370,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service CleanRooms diff --git a/cmd/workspace/cluster-policies/cluster-policies.go b/cmd/workspace/cluster-policies/cluster-policies.go index f6edee2b..15a75b1f 100755 --- a/cmd/workspace/cluster-policies/cluster-policies.go +++ b/cmd/workspace/cluster-policies/cluster-policies.go @@ -49,6 +49,17 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newEdit()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newList()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -140,12 +151,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -237,12 +242,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start edit command // Slice with functions to override default command behavior. @@ -331,12 +330,6 @@ func newEdit() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newEdit()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -407,12 +400,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -483,12 +470,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -560,12 +541,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -619,12 +594,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -706,12 +675,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -793,10 +756,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service ClusterPolicies diff --git a/cmd/workspace/clusters/clusters.go b/cmd/workspace/clusters/clusters.go index cf35b283..8d773755 100755 --- a/cmd/workspace/clusters/clusters.go +++ b/cmd/workspace/clusters/clusters.go @@ -54,6 +54,28 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newChangeOwner()) + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newEdit()) + cmd.AddCommand(newEvents()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newList()) + cmd.AddCommand(newListNodeTypes()) + cmd.AddCommand(newListZones()) + cmd.AddCommand(newPermanentDelete()) + cmd.AddCommand(newPin()) + cmd.AddCommand(newResize()) + cmd.AddCommand(newRestart()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newSparkVersions()) + cmd.AddCommand(newStart()) + cmd.AddCommand(newUnpin()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -143,12 +165,6 @@ func newChangeOwner() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newChangeOwner()) - }) -} - // start create command // Slice with functions to override default command behavior. @@ -293,12 +309,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -409,12 +419,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start edit command // Slice with functions to override default command behavior. @@ -567,12 +571,6 @@ func newEdit() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newEdit()) - }) -} - // start events command // Slice with functions to override default command behavior. @@ -669,12 +667,6 @@ func newEvents() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newEvents()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -751,12 +743,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -827,12 +813,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -904,12 +884,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -970,12 +944,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start list-node-types command // Slice with functions to override default command behavior. @@ -1019,12 +987,6 @@ func newListNodeTypes() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListNodeTypes()) - }) -} - // start list-zones command // Slice with functions to override default command behavior. @@ -1068,12 +1030,6 @@ func newListZones() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListZones()) - }) -} - // start permanent-delete command // Slice with functions to override default command behavior. @@ -1169,12 +1125,6 @@ func newPermanentDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPermanentDelete()) - }) -} - // start pin command // Slice with functions to override default command behavior. @@ -1267,12 +1217,6 @@ func newPin() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPin()) - }) -} - // start resize command // Slice with functions to override default command behavior. @@ -1384,12 +1328,6 @@ func newResize() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newResize()) - }) -} - // start restart command // Slice with functions to override default command behavior. @@ -1500,12 +1438,6 @@ func newRestart() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRestart()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -1587,12 +1519,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start spark-versions command // Slice with functions to override default command behavior. @@ -1636,12 +1562,6 @@ func newSparkVersions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSparkVersions()) - }) -} - // start start command // Slice with functions to override default command behavior. @@ -1756,12 +1676,6 @@ func newStart() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newStart()) - }) -} - // start unpin command // Slice with functions to override default command behavior. @@ -1854,12 +1768,6 @@ func newUnpin() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUnpin()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -1941,10 +1849,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service Clusters diff --git a/cmd/workspace/cmd.go b/cmd/workspace/cmd.go index e365be7d..8b0022dc 100755 --- a/cmd/workspace/cmd.go +++ b/cmd/workspace/cmd.go @@ -34,6 +34,7 @@ import ( model_registry "github.com/databricks/cli/cmd/workspace/model-registry" model_versions "github.com/databricks/cli/cmd/workspace/model-versions" online_tables "github.com/databricks/cli/cmd/workspace/online-tables" + permission_migration "github.com/databricks/cli/cmd/workspace/permission-migration" permissions "github.com/databricks/cli/cmd/workspace/permissions" pipelines "github.com/databricks/cli/cmd/workspace/pipelines" policy_families "github.com/databricks/cli/cmd/workspace/policy-families" @@ -102,6 +103,7 @@ func All() []*cobra.Command { out = append(out, model_registry.New()) out = append(out, model_versions.New()) out = append(out, online_tables.New()) + out = append(out, permission_migration.New()) out = append(out, permissions.New()) out = append(out, pipelines.New()) out = append(out, policy_families.New()) diff --git a/cmd/workspace/connections/connections.go b/cmd/workspace/connections/connections.go index f740c778..87ec52be 100755 --- a/cmd/workspace/connections/connections.go +++ b/cmd/workspace/connections/connections.go @@ -37,6 +37,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -112,12 +119,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -188,12 +189,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -264,12 +259,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -309,12 +298,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -386,10 +369,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Connections diff --git a/cmd/workspace/credentials-manager/credentials-manager.go b/cmd/workspace/credentials-manager/credentials-manager.go index 132ba51e..5a40232b 100755 --- a/cmd/workspace/credentials-manager/credentials-manager.go +++ b/cmd/workspace/credentials-manager/credentials-manager.go @@ -31,6 +31,9 @@ func New() *cobra.Command { Hidden: true, } + // Add methods + cmd.AddCommand(newExchangeToken()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -99,10 +102,4 @@ func newExchangeToken() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newExchangeToken()) - }) -} - // end service CredentialsManager diff --git a/cmd/workspace/csp-enablement/csp-enablement.go b/cmd/workspace/csp-enablement/csp-enablement.go new file mode 100755 index 00000000..5e037f2a --- /dev/null +++ b/cmd/workspace/csp-enablement/csp-enablement.go @@ -0,0 +1,160 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package csp_enablement + +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/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "csp-enablement", + Short: `Controls whether to enable the compliance security profile for the current workspace.`, + Long: `Controls whether to enable the compliance security profile for the current + workspace. Enabling it on a workspace is permanent. By default, it is turned + off. + + This settings can NOT be disabled once it is enabled.`, + } + + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start get command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var getOverrides []func( + *cobra.Command, + *settings.GetCspEnablementRequest, +) + +func newGet() *cobra.Command { + cmd := &cobra.Command{} + + var getReq settings.GetCspEnablementRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`) + + cmd.Use = "get" + cmd.Short = `Get the compliance security profile setting.` + cmd.Long = `Get the compliance security profile setting. + + Gets the compliance security profile setting.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + response, err := w.Settings.CspEnablement().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getOverrides { + fn(cmd, &getReq) + } + + return cmd +} + +// start update command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var updateOverrides []func( + *cobra.Command, + *settings.UpdateCspEnablementSettingRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq settings.UpdateCspEnablementSettingRequest + var updateJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update" + cmd.Short = `Update the compliance security profile setting.` + cmd.Long = `Update the compliance security profile setting. + + Updates the compliance security profile setting for the workspace. A fresh + etag needs to be provided in PATCH requests (as part of the setting field). + The etag can be retrieved by making a GET request before the PATCH + request. If the setting is updated concurrently, PATCH fails with 409 and + the request must be retried by using the fresh etag in the 409 response.` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustWorkspaceClient + cmd.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("please provide command input in JSON format by specifying the --json flag") + } + + response, err := w.Settings.CspEnablement().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range updateOverrides { + fn(cmd, &updateReq) + } + + return cmd +} + +// end service CSPEnablement diff --git a/cmd/workspace/current-user/current-user.go b/cmd/workspace/current-user/current-user.go index cb18e71d..a42c3ead 100755 --- a/cmd/workspace/current-user/current-user.go +++ b/cmd/workspace/current-user/current-user.go @@ -24,6 +24,9 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newMe()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -74,10 +77,4 @@ func newMe() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newMe()) - }) -} - // end service CurrentUser diff --git a/cmd/workspace/dashboard-widgets/dashboard-widgets.go b/cmd/workspace/dashboard-widgets/dashboard-widgets.go index 43a972e0..90463dd0 100755 --- a/cmd/workspace/dashboard-widgets/dashboard-widgets.go +++ b/cmd/workspace/dashboard-widgets/dashboard-widgets.go @@ -32,6 +32,11 @@ func New() *cobra.Command { Hidden: true, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -97,12 +102,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -159,12 +158,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -231,10 +224,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service DashboardWidgets diff --git a/cmd/workspace/dashboards/dashboards.go b/cmd/workspace/dashboards/dashboards.go index e07f7392..3020cb60 100755 --- a/cmd/workspace/dashboards/dashboards.go +++ b/cmd/workspace/dashboards/dashboards.go @@ -32,6 +32,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newRestore()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -97,12 +105,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -171,12 +173,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -245,12 +241,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -309,12 +299,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start restore command // Slice with functions to override default command behavior. @@ -382,12 +366,6 @@ func newRestore() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRestore()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -469,10 +447,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Dashboards diff --git a/cmd/workspace/data-sources/data-sources.go b/cmd/workspace/data-sources/data-sources.go index 969399f4..0f0f8541 100755 --- a/cmd/workspace/data-sources/data-sources.go +++ b/cmd/workspace/data-sources/data-sources.go @@ -32,6 +32,9 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -84,10 +87,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service DataSources diff --git a/cmd/workspace/default-namespace/default-namespace.go b/cmd/workspace/default-namespace/default-namespace.go new file mode 100755 index 00000000..38880dd5 --- /dev/null +++ b/cmd/workspace/default-namespace/default-namespace.go @@ -0,0 +1,229 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package default_namespace + +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/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "default-namespace", + Short: `The default namespace setting API allows users to configure the default namespace for a Databricks workspace.`, + Long: `The default namespace setting API allows users to configure the default + namespace for a Databricks workspace. + + Through this API, users can retrieve, set, or modify the default namespace + used when queries do not reference a fully qualified three-level name. For + example, if you use the API to set 'retail_prod' as the default catalog, then + a query 'SELECT * FROM myTable' would reference the object + 'retail_prod.default.myTable' (the schema 'default' is always assumed). + + This setting requires a restart of clusters and SQL warehouses to take effect. + Additionally, the default namespace only applies when using Unity + Catalog-enabled compute.`, + } + + // Add methods + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start delete command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var deleteOverrides []func( + *cobra.Command, + *settings.DeleteDefaultNamespaceRequest, +) + +func newDelete() *cobra.Command { + cmd := &cobra.Command{} + + var deleteReq settings.DeleteDefaultNamespaceRequest + + // TODO: short flags + + cmd.Flags().StringVar(&deleteReq.Etag, "etag", deleteReq.Etag, `etag used for versioning.`) + + cmd.Use = "delete" + cmd.Short = `Delete the default namespace setting.` + cmd.Long = `Delete the default namespace setting. + + Deletes the default namespace setting for the workspace. A fresh etag needs to + be provided in DELETE requests (as a query parameter). The etag can be + retrieved by making a GET request before the DELETE request. If the + setting is updated/deleted concurrently, DELETE fails with 409 and the + request must be retried by using the fresh etag in the 409 response.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + response, err := w.Settings.DefaultNamespace().Delete(ctx, deleteReq) + 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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range deleteOverrides { + fn(cmd, &deleteReq) + } + + return cmd +} + +// start get command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var getOverrides []func( + *cobra.Command, + *settings.GetDefaultNamespaceRequest, +) + +func newGet() *cobra.Command { + cmd := &cobra.Command{} + + var getReq settings.GetDefaultNamespaceRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`) + + cmd.Use = "get" + cmd.Short = `Get the default namespace setting.` + cmd.Long = `Get the default namespace setting. + + Gets the default namespace setting.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + response, err := w.Settings.DefaultNamespace().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getOverrides { + fn(cmd, &getReq) + } + + return cmd +} + +// start update command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var updateOverrides []func( + *cobra.Command, + *settings.UpdateDefaultNamespaceSettingRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq settings.UpdateDefaultNamespaceSettingRequest + var updateJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update" + cmd.Short = `Update the default namespace setting.` + cmd.Long = `Update the default namespace setting. + + Updates the default namespace setting for the workspace. A fresh etag needs to + be provided in PATCH requests (as part of the setting field). The etag can + be retrieved by making a GET request before the PATCH request. Note that + if the setting does not exist, GET returns a NOT_FOUND error and the etag is + present in the error response, which should be set in the PATCH request. If + the setting is updated concurrently, PATCH fails with 409 and the request + must be retried by using the fresh etag in the 409 response.` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustWorkspaceClient + cmd.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("please provide command input in JSON format by specifying the --json flag") + } + + response, err := w.Settings.DefaultNamespace().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range updateOverrides { + fn(cmd, &updateReq) + } + + return cmd +} + +// end service DefaultNamespace diff --git a/cmd/workspace/esm-enablement/esm-enablement.go b/cmd/workspace/esm-enablement/esm-enablement.go new file mode 100755 index 00000000..a3da246f --- /dev/null +++ b/cmd/workspace/esm-enablement/esm-enablement.go @@ -0,0 +1,162 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package esm_enablement + +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/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "esm-enablement", + Short: `Controls whether enhanced security monitoring is enabled for the current workspace.`, + Long: `Controls whether enhanced security monitoring is enabled for the current + workspace. If the compliance security profile is enabled, this is + automatically enabled. By default, it is disabled. However, if the compliance + security profile is enabled, this is automatically enabled. + + If the compliance security profile is disabled, you can enable or disable this + setting and it is not permanent.`, + } + + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start get command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var getOverrides []func( + *cobra.Command, + *settings.GetEsmEnablementRequest, +) + +func newGet() *cobra.Command { + cmd := &cobra.Command{} + + var getReq settings.GetEsmEnablementRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`) + + cmd.Use = "get" + cmd.Short = `Get the enhanced security monitoring setting.` + cmd.Long = `Get the enhanced security monitoring setting. + + Gets the enhanced security monitoring setting.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + response, err := w.Settings.EsmEnablement().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getOverrides { + fn(cmd, &getReq) + } + + return cmd +} + +// start update command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var updateOverrides []func( + *cobra.Command, + *settings.UpdateEsmEnablementSettingRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq settings.UpdateEsmEnablementSettingRequest + var updateJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update" + cmd.Short = `Update the enhanced security monitoring setting.` + cmd.Long = `Update the enhanced security monitoring setting. + + Updates the enhanced security monitoring setting for the workspace. A fresh + etag needs to be provided in PATCH requests (as part of the setting field). + The etag can be retrieved by making a GET request before the PATCH + request. If the setting is updated concurrently, PATCH fails with 409 and + the request must be retried by using the fresh etag in the 409 response.` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustWorkspaceClient + cmd.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("please provide command input in JSON format by specifying the --json flag") + } + + response, err := w.Settings.EsmEnablement().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range updateOverrides { + fn(cmd, &updateReq) + } + + return cmd +} + +// end service ESMEnablement diff --git a/cmd/workspace/experiments/experiments.go b/cmd/workspace/experiments/experiments.go index 368ec7f9..50337390 100755 --- a/cmd/workspace/experiments/experiments.go +++ b/cmd/workspace/experiments/experiments.go @@ -35,6 +35,38 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreateExperiment()) + cmd.AddCommand(newCreateRun()) + cmd.AddCommand(newDeleteExperiment()) + cmd.AddCommand(newDeleteRun()) + cmd.AddCommand(newDeleteRuns()) + cmd.AddCommand(newDeleteTag()) + cmd.AddCommand(newGetByName()) + cmd.AddCommand(newGetExperiment()) + cmd.AddCommand(newGetHistory()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newGetRun()) + cmd.AddCommand(newListArtifacts()) + cmd.AddCommand(newListExperiments()) + cmd.AddCommand(newLogBatch()) + cmd.AddCommand(newLogInputs()) + cmd.AddCommand(newLogMetric()) + cmd.AddCommand(newLogModel()) + cmd.AddCommand(newLogParam()) + cmd.AddCommand(newRestoreExperiment()) + cmd.AddCommand(newRestoreRun()) + cmd.AddCommand(newRestoreRuns()) + cmd.AddCommand(newSearchExperiments()) + cmd.AddCommand(newSearchRuns()) + cmd.AddCommand(newSetExperimentTag()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newSetTag()) + cmd.AddCommand(newUpdateExperiment()) + cmd.AddCommand(newUpdatePermissions()) + cmd.AddCommand(newUpdateRun()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -126,12 +158,6 @@ func newCreateExperiment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateExperiment()) - }) -} - // start create-run command // Slice with functions to override default command behavior. @@ -202,12 +228,6 @@ func newCreateRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateRun()) - }) -} - // start delete-experiment command // Slice with functions to override default command behavior. @@ -285,12 +305,6 @@ func newDeleteExperiment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteExperiment()) - }) -} - // start delete-run command // Slice with functions to override default command behavior. @@ -366,12 +380,6 @@ func newDeleteRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteRun()) - }) -} - // start delete-runs command // Slice with functions to override default command behavior. @@ -461,12 +469,6 @@ func newDeleteRuns() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteRuns()) - }) -} - // start delete-tag command // Slice with functions to override default command behavior. @@ -547,12 +549,6 @@ func newDeleteTag() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteTag()) - }) -} - // start get-by-name command // Slice with functions to override default command behavior. @@ -619,12 +615,6 @@ func newGetByName() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetByName()) - }) -} - // start get-experiment command // Slice with functions to override default command behavior. @@ -683,12 +673,6 @@ func newGetExperiment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetExperiment()) - }) -} - // start get-history command // Slice with functions to override default command behavior. @@ -749,12 +733,6 @@ func newGetHistory() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetHistory()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -813,12 +791,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -878,12 +850,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start get-run command // Slice with functions to override default command behavior. @@ -949,12 +915,6 @@ func newGetRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetRun()) - }) -} - // start list-artifacts command // Slice with functions to override default command behavior. @@ -1011,12 +971,6 @@ func newListArtifacts() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListArtifacts()) - }) -} - // start list-experiments command // Slice with functions to override default command behavior. @@ -1071,12 +1025,6 @@ func newListExperiments() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListExperiments()) - }) -} - // start log-batch command // Slice with functions to override default command behavior. @@ -1180,12 +1128,6 @@ func newLogBatch() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newLogBatch()) - }) -} - // start log-inputs command // Slice with functions to override default command behavior. @@ -1252,12 +1194,6 @@ func newLogInputs() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newLogInputs()) - }) -} - // start log-metric command // Slice with functions to override default command behavior. @@ -1353,12 +1289,6 @@ func newLogMetric() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newLogMetric()) - }) -} - // start log-model command // Slice with functions to override default command behavior. @@ -1425,12 +1355,6 @@ func newLogModel() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newLogModel()) - }) -} - // start log-param command // Slice with functions to override default command behavior. @@ -1516,12 +1440,6 @@ func newLogParam() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newLogParam()) - }) -} - // start restore-experiment command // Slice with functions to override default command behavior. @@ -1602,12 +1520,6 @@ func newRestoreExperiment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRestoreExperiment()) - }) -} - // start restore-run command // Slice with functions to override default command behavior. @@ -1683,12 +1595,6 @@ func newRestoreRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRestoreRun()) - }) -} - // start restore-runs command // Slice with functions to override default command behavior. @@ -1778,12 +1684,6 @@ func newRestoreRuns() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRestoreRuns()) - }) -} - // start search-experiments command // Slice with functions to override default command behavior. @@ -1849,12 +1749,6 @@ func newSearchExperiments() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSearchExperiments()) - }) -} - // start search-runs command // Slice with functions to override default command behavior. @@ -1923,12 +1817,6 @@ func newSearchRuns() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSearchRuns()) - }) -} - // start set-experiment-tag command // Slice with functions to override default command behavior. @@ -2015,12 +1903,6 @@ func newSetExperimentTag() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetExperimentTag()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -2090,12 +1972,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start set-tag command // Slice with functions to override default command behavior. @@ -2182,12 +2058,6 @@ func newSetTag() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetTag()) - }) -} - // start update-experiment command // Slice with functions to override default command behavior. @@ -2265,12 +2135,6 @@ func newUpdateExperiment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateExperiment()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -2340,12 +2204,6 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // start update-run command // Slice with functions to override default command behavior. @@ -2413,10 +2271,4 @@ func newUpdateRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateRun()) - }) -} - // end service Experiments diff --git a/cmd/workspace/external-locations/external-locations.go b/cmd/workspace/external-locations/external-locations.go index 7ddc0d84..76e46005 100755 --- a/cmd/workspace/external-locations/external-locations.go +++ b/cmd/workspace/external-locations/external-locations.go @@ -39,6 +39,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -138,12 +145,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -205,12 +206,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -271,12 +266,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -335,12 +324,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -420,10 +403,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service ExternalLocations diff --git a/cmd/workspace/functions/functions.go b/cmd/workspace/functions/functions.go index d1db1ec9..5b1b9024 100755 --- a/cmd/workspace/functions/functions.go +++ b/cmd/workspace/functions/functions.go @@ -32,6 +32,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -103,12 +110,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -187,12 +188,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -270,12 +265,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -343,12 +332,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -437,10 +420,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Functions diff --git a/cmd/workspace/git-credentials/git-credentials.go b/cmd/workspace/git-credentials/git-credentials.go index 8984a953..ca8a1c27 100755 --- a/cmd/workspace/git-credentials/git-credentials.go +++ b/cmd/workspace/git-credentials/git-credentials.go @@ -32,6 +32,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -123,12 +130,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -202,12 +203,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -281,12 +276,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -327,12 +316,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -418,10 +401,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service GitCredentials diff --git a/cmd/workspace/global-init-scripts/global-init-scripts.go b/cmd/workspace/global-init-scripts/global-init-scripts.go index de08614f..0461b451 100755 --- a/cmd/workspace/global-init-scripts/global-init-scripts.go +++ b/cmd/workspace/global-init-scripts/global-init-scripts.go @@ -35,6 +35,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -125,12 +132,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -201,12 +202,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -277,12 +272,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -325,12 +314,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -416,10 +399,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service GlobalInitScripts diff --git a/cmd/workspace/grants/grants.go b/cmd/workspace/grants/grants.go index 020e0bf8..851c3cfb 100755 --- a/cmd/workspace/grants/grants.go +++ b/cmd/workspace/grants/grants.go @@ -37,6 +37,11 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetEffective()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -110,12 +115,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-effective command // Slice with functions to override default command behavior. @@ -181,12 +180,6 @@ func newGetEffective() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetEffective()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -260,10 +253,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Grants diff --git a/cmd/workspace/groups/groups.go b/cmd/workspace/groups/groups.go index aba54b8b..2fc63220 100755 --- a/cmd/workspace/groups/groups.go +++ b/cmd/workspace/groups/groups.go @@ -33,6 +33,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newPatch()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -114,12 +122,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -190,12 +192,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -266,12 +262,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -330,12 +320,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start patch command // Slice with functions to override default command behavior. @@ -417,12 +401,6 @@ func newPatch() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPatch()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -511,10 +489,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Groups diff --git a/cmd/workspace/instance-pools/instance-pools.go b/cmd/workspace/instance-pools/instance-pools.go index c9389fef..8000365b 100755 --- a/cmd/workspace/instance-pools/instance-pools.go +++ b/cmd/workspace/instance-pools/instance-pools.go @@ -44,6 +44,17 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newEdit()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newList()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -148,12 +159,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -245,12 +250,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start edit command // Slice with functions to override default command behavior. @@ -344,12 +343,6 @@ func newEdit() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newEdit()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -420,12 +413,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -496,12 +483,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -573,12 +554,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -618,12 +593,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -705,12 +674,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -792,10 +755,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service InstancePools diff --git a/cmd/workspace/instance-profiles/instance-profiles.go b/cmd/workspace/instance-profiles/instance-profiles.go index 2077c4bf..919ec511 100755 --- a/cmd/workspace/instance-profiles/instance-profiles.go +++ b/cmd/workspace/instance-profiles/instance-profiles.go @@ -32,6 +32,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newAdd()) + cmd.AddCommand(newEdit()) + cmd.AddCommand(newList()) + cmd.AddCommand(newRemove()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -121,12 +127,6 @@ func newAdd() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newAdd()) - }) -} - // start edit command // Slice with functions to override default command behavior. @@ -220,12 +220,6 @@ func newEdit() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newEdit()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -267,12 +261,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start remove command // Slice with functions to override default command behavior. @@ -351,10 +339,4 @@ func newRemove() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRemove()) - }) -} - // end service InstanceProfiles diff --git a/cmd/workspace/ip-access-lists/ip-access-lists.go b/cmd/workspace/ip-access-lists/ip-access-lists.go index 9eb08cb4..2b6ddfa2 100755 --- a/cmd/workspace/ip-access-lists/ip-access-lists.go +++ b/cmd/workspace/ip-access-lists/ip-access-lists.go @@ -47,6 +47,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newReplace()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -159,12 +167,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -235,12 +237,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -311,12 +307,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -356,12 +346,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start replace command // Slice with functions to override default command behavior. @@ -471,12 +455,6 @@ func newReplace() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newReplace()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -575,10 +553,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service IpAccessLists diff --git a/cmd/workspace/jobs/jobs.go b/cmd/workspace/jobs/jobs.go index 957aa609..8a98e1c8 100755 --- a/cmd/workspace/jobs/jobs.go +++ b/cmd/workspace/jobs/jobs.go @@ -45,6 +45,28 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCancelAllRuns()) + cmd.AddCommand(newCancelRun()) + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newDeleteRun()) + cmd.AddCommand(newExportRun()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newGetRun()) + cmd.AddCommand(newGetRunOutput()) + cmd.AddCommand(newList()) + cmd.AddCommand(newListRuns()) + cmd.AddCommand(newRepairRun()) + cmd.AddCommand(newReset()) + cmd.AddCommand(newRunNow()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newSubmit()) + cmd.AddCommand(newUpdate()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -119,12 +141,6 @@ func newCancelAllRuns() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCancelAllRuns()) - }) -} - // start cancel-run command // Slice with functions to override default command behavior. @@ -243,12 +259,6 @@ func newCancelRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCancelRun()) - }) -} - // start create command // Slice with functions to override default command behavior. @@ -308,12 +318,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -407,12 +411,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start delete-run command // Slice with functions to override default command behavior. @@ -506,12 +504,6 @@ func newDeleteRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteRun()) - }) -} - // start export-run command // Slice with functions to override default command behavior. @@ -587,12 +579,6 @@ func newExportRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newExportRun()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -667,12 +653,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -743,12 +723,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -820,12 +794,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start get-run command // Slice with functions to override default command behavior. @@ -908,12 +876,6 @@ func newGetRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetRun()) - }) -} - // start get-run-output command // Slice with functions to override default command behavior. @@ -996,12 +958,6 @@ func newGetRunOutput() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetRunOutput()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -1058,12 +1014,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start list-runs command // Slice with functions to override default command behavior. @@ -1125,12 +1075,6 @@ func newListRuns() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListRuns()) - }) -} - // start repair-run command // Slice with functions to override default command behavior. @@ -1264,12 +1208,6 @@ func newRepairRun() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRepairRun()) - }) -} - // start reset command // Slice with functions to override default command behavior. @@ -1330,12 +1268,6 @@ func newReset() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newReset()) - }) -} - // start run-now command // Slice with functions to override default command behavior. @@ -1465,12 +1397,6 @@ func newRunNow() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRunNow()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -1552,12 +1478,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start submit command // Slice with functions to override default command behavior. @@ -1659,12 +1579,6 @@ func newSubmit() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSubmit()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -1762,12 +1676,6 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -1849,10 +1757,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service Jobs diff --git a/cmd/workspace/lakehouse-monitors/lakehouse-monitors.go b/cmd/workspace/lakehouse-monitors/lakehouse-monitors.go index 13383f36..9559d036 100755 --- a/cmd/workspace/lakehouse-monitors/lakehouse-monitors.go +++ b/cmd/workspace/lakehouse-monitors/lakehouse-monitors.go @@ -34,6 +34,16 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCancelRefresh()) + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetRefresh()) + cmd.AddCommand(newListRefreshes()) + cmd.AddCommand(newRunRefresh()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -114,12 +124,6 @@ func newCancelRefresh() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCancelRefresh()) - }) -} - // start create command // Slice with functions to override default command behavior. @@ -146,7 +150,7 @@ func newCreate() *cobra.Command { // TODO: complex arg: schedule cmd.Flags().BoolVar(&createReq.SkipBuiltinDashboard, "skip-builtin-dashboard", createReq.SkipBuiltinDashboard, `Whether to skip creating a default dashboard summarizing data quality metrics.`) // TODO: array: slicing_exprs - // TODO: output-only field + // TODO: complex arg: snapshot // TODO: complex arg: time_series cmd.Flags().StringVar(&createReq.WarehouseId, "warehouse-id", createReq.WarehouseId, `Optional argument to specify the warehouse for dashboard creation.`) @@ -223,12 +227,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -299,12 +297,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -374,12 +366,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-refresh command // Slice with functions to override default command behavior. @@ -449,12 +435,6 @@ func newGetRefresh() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetRefresh()) - }) -} - // start list-refreshes command // Slice with functions to override default command behavior. @@ -523,12 +503,6 @@ func newListRefreshes() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListRefreshes()) - }) -} - // start run-refresh command // Slice with functions to override default command behavior. @@ -597,12 +571,6 @@ func newRunRefresh() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRunRefresh()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -628,7 +596,7 @@ func newUpdate() *cobra.Command { // TODO: array: notifications // TODO: complex arg: schedule // TODO: array: slicing_exprs - // TODO: output-only field + // TODO: complex arg: snapshot // TODO: complex arg: time_series cmd.Use = "update FULL_NAME OUTPUT_SCHEMA_NAME" @@ -702,10 +670,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service LakehouseMonitors diff --git a/cmd/workspace/lakeview/lakeview.go b/cmd/workspace/lakeview/lakeview.go index a6dddd0d..a8148399 100755 --- a/cmd/workspace/lakeview/lakeview.go +++ b/cmd/workspace/lakeview/lakeview.go @@ -26,6 +26,9 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newPublish()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -103,10 +106,4 @@ func newPublish() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPublish()) - }) -} - // end service Lakeview diff --git a/cmd/workspace/libraries/libraries.go b/cmd/workspace/libraries/libraries.go index fef81c25..d6761a82 100755 --- a/cmd/workspace/libraries/libraries.go +++ b/cmd/workspace/libraries/libraries.go @@ -46,6 +46,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newAllClusterStatuses()) + cmd.AddCommand(newClusterStatus()) + cmd.AddCommand(newInstall()) + cmd.AddCommand(newUninstall()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -98,12 +104,6 @@ func newAllClusterStatuses() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newAllClusterStatuses()) - }) -} - // start cluster-status command // Slice with functions to override default command behavior. @@ -173,12 +173,6 @@ func newClusterStatus() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newClusterStatus()) - }) -} - // start install command // Slice with functions to override default command behavior. @@ -243,12 +237,6 @@ func newInstall() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newInstall()) - }) -} - // start uninstall command // Slice with functions to override default command behavior. @@ -310,10 +298,4 @@ func newUninstall() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUninstall()) - }) -} - // end service Libraries diff --git a/cmd/workspace/metastores/metastores.go b/cmd/workspace/metastores/metastores.go index d63576d4..97e77a47 100755 --- a/cmd/workspace/metastores/metastores.go +++ b/cmd/workspace/metastores/metastores.go @@ -39,6 +39,18 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newAssign()) + cmd.AddCommand(newCreate()) + cmd.AddCommand(newCurrent()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newSummary()) + cmd.AddCommand(newUnassign()) + cmd.AddCommand(newUpdate()) + cmd.AddCommand(newUpdateAssignment()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -133,12 +145,6 @@ func newAssign() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newAssign()) - }) -} - // start create command // Slice with functions to override default command behavior. @@ -221,12 +227,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start current command // Slice with functions to override default command behavior. @@ -269,12 +269,6 @@ func newCurrent() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCurrent()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -347,12 +341,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -424,12 +412,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -471,12 +453,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start summary command // Slice with functions to override default command behavior. @@ -520,12 +496,6 @@ func newSummary() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSummary()) - }) -} - // start unassign command // Slice with functions to override default command behavior. @@ -589,12 +559,6 @@ func newUnassign() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUnassign()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -683,12 +647,6 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // start update-assignment command // Slice with functions to override default command behavior. @@ -776,10 +734,4 @@ func newUpdateAssignment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateAssignment()) - }) -} - // end service Metastores diff --git a/cmd/workspace/model-registry/model-registry.go b/cmd/workspace/model-registry/model-registry.go index 9c6034b5..74e5e66e 100755 --- a/cmd/workspace/model-registry/model-registry.go +++ b/cmd/workspace/model-registry/model-registry.go @@ -34,6 +34,44 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newApproveTransitionRequest()) + cmd.AddCommand(newCreateComment()) + cmd.AddCommand(newCreateModel()) + cmd.AddCommand(newCreateModelVersion()) + cmd.AddCommand(newCreateTransitionRequest()) + cmd.AddCommand(newCreateWebhook()) + cmd.AddCommand(newDeleteComment()) + cmd.AddCommand(newDeleteModel()) + cmd.AddCommand(newDeleteModelTag()) + cmd.AddCommand(newDeleteModelVersion()) + cmd.AddCommand(newDeleteModelVersionTag()) + cmd.AddCommand(newDeleteTransitionRequest()) + cmd.AddCommand(newDeleteWebhook()) + cmd.AddCommand(newGetLatestVersions()) + cmd.AddCommand(newGetModel()) + cmd.AddCommand(newGetModelVersion()) + cmd.AddCommand(newGetModelVersionDownloadUri()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newListModels()) + cmd.AddCommand(newListTransitionRequests()) + cmd.AddCommand(newListWebhooks()) + cmd.AddCommand(newRejectTransitionRequest()) + cmd.AddCommand(newRenameModel()) + cmd.AddCommand(newSearchModelVersions()) + cmd.AddCommand(newSearchModels()) + cmd.AddCommand(newSetModelTag()) + cmd.AddCommand(newSetModelVersionTag()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newTestRegistryWebhook()) + cmd.AddCommand(newTransitionStage()) + cmd.AddCommand(newUpdateComment()) + cmd.AddCommand(newUpdateModel()) + cmd.AddCommand(newUpdateModelVersion()) + cmd.AddCommand(newUpdatePermissions()) + cmd.AddCommand(newUpdateWebhook()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -146,12 +184,6 @@ func newApproveTransitionRequest() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newApproveTransitionRequest()) - }) -} - // start create-comment command // Slice with functions to override default command behavior. @@ -237,12 +269,6 @@ func newCreateComment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateComment()) - }) -} - // start create-model command // Slice with functions to override default command behavior. @@ -324,12 +350,6 @@ func newCreateModel() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateModel()) - }) -} - // start create-model-version command // Slice with functions to override default command behavior. @@ -414,12 +434,6 @@ func newCreateModelVersion() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateModelVersion()) - }) -} - // start create-transition-request command // Slice with functions to override default command behavior. @@ -516,12 +530,6 @@ func newCreateTransitionRequest() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateTransitionRequest()) - }) -} - // start create-webhook command // Slice with functions to override default command behavior. @@ -589,12 +597,6 @@ func newCreateWebhook() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateWebhook()) - }) -} - // start delete-comment command // Slice with functions to override default command behavior. @@ -650,12 +652,6 @@ func newDeleteComment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteComment()) - }) -} - // start delete-model command // Slice with functions to override default command behavior. @@ -714,12 +710,6 @@ func newDeleteModel() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteModel()) - }) -} - // start delete-model-tag command // Slice with functions to override default command behavior. @@ -781,12 +771,6 @@ func newDeleteModelTag() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteModelTag()) - }) -} - // start delete-model-version command // Slice with functions to override default command behavior. @@ -847,12 +831,6 @@ func newDeleteModelVersion() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteModelVersion()) - }) -} - // start delete-model-version-tag command // Slice with functions to override default command behavior. @@ -916,12 +894,6 @@ func newDeleteModelVersionTag() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteModelVersionTag()) - }) -} - // start delete-transition-request command // Slice with functions to override default command behavior. @@ -1001,12 +973,6 @@ func newDeleteTransitionRequest() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteTransitionRequest()) - }) -} - // start delete-webhook command // Slice with functions to override default command behavior. @@ -1064,12 +1030,6 @@ func newDeleteWebhook() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteWebhook()) - }) -} - // start get-latest-versions command // Slice with functions to override default command behavior. @@ -1144,12 +1104,6 @@ func newGetLatestVersions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetLatestVersions()) - }) -} - // start get-model command // Slice with functions to override default command behavior. @@ -1212,12 +1166,6 @@ func newGetModel() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetModel()) - }) -} - // start get-model-version command // Slice with functions to override default command behavior. @@ -1278,12 +1226,6 @@ func newGetModelVersion() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetModelVersion()) - }) -} - // start get-model-version-download-uri command // Slice with functions to override default command behavior. @@ -1344,12 +1286,6 @@ func newGetModelVersionDownloadUri() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetModelVersionDownloadUri()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -1408,12 +1344,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -1473,12 +1403,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start list-models command // Slice with functions to override default command behavior. @@ -1533,12 +1457,6 @@ func newListModels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListModels()) - }) -} - // start list-transition-requests command // Slice with functions to override default command behavior. @@ -1596,12 +1514,6 @@ func newListTransitionRequests() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListTransitionRequests()) - }) -} - // start list-webhooks command // Slice with functions to override default command behavior. @@ -1658,12 +1570,6 @@ func newListWebhooks() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListWebhooks()) - }) -} - // start reject-transition-request command // Slice with functions to override default command behavior. @@ -1760,12 +1666,6 @@ func newRejectTransitionRequest() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRejectTransitionRequest()) - }) -} - // start rename-model command // Slice with functions to override default command behavior. @@ -1843,12 +1743,6 @@ func newRenameModel() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRenameModel()) - }) -} - // start search-model-versions command // Slice with functions to override default command behavior. @@ -1904,12 +1798,6 @@ func newSearchModelVersions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSearchModelVersions()) - }) -} - // start search-models command // Slice with functions to override default command behavior. @@ -1965,12 +1853,6 @@ func newSearchModels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSearchModels()) - }) -} - // start set-model-tag command // Slice with functions to override default command behavior. @@ -2059,12 +1941,6 @@ func newSetModelTag() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetModelTag()) - }) -} - // start set-model-version-tag command // Slice with functions to override default command behavior. @@ -2157,12 +2033,6 @@ func newSetModelVersionTag() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetModelVersionTag()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -2232,12 +2102,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start test-registry-webhook command // Slice with functions to override default command behavior. @@ -2330,12 +2194,6 @@ func newTestRegistryWebhook() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newTestRegistryWebhook()) - }) -} - // start transition-stage command // Slice with functions to override default command behavior. @@ -2444,12 +2302,6 @@ func newTransitionStage() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newTransitionStage()) - }) -} - // start update-comment command // Slice with functions to override default command behavior. @@ -2529,12 +2381,6 @@ func newUpdateComment() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateComment()) - }) -} - // start update-model command // Slice with functions to override default command behavior. @@ -2612,12 +2458,6 @@ func newUpdateModel() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateModel()) - }) -} - // start update-model-version command // Slice with functions to override default command behavior. @@ -2699,12 +2539,6 @@ func newUpdateModelVersion() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateModelVersion()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -2774,12 +2608,6 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // start update-webhook command // Slice with functions to override default command behavior. @@ -2863,10 +2691,4 @@ func newUpdateWebhook() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateWebhook()) - }) -} - // end service ModelRegistry diff --git a/cmd/workspace/model-versions/model-versions.go b/cmd/workspace/model-versions/model-versions.go index b4492cb3..b322e880 100755 --- a/cmd/workspace/model-versions/model-versions.go +++ b/cmd/workspace/model-versions/model-versions.go @@ -33,6 +33,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetByAlias()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -110,12 +117,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -184,12 +185,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-by-alias command // Slice with functions to override default command behavior. @@ -255,12 +250,6 @@ func newGetByAlias() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetByAlias()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -331,12 +320,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -417,10 +400,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service ModelVersions diff --git a/cmd/workspace/online-tables/online-tables.go b/cmd/workspace/online-tables/online-tables.go index d97c5283..2a5574da 100755 --- a/cmd/workspace/online-tables/online-tables.go +++ b/cmd/workspace/online-tables/online-tables.go @@ -26,6 +26,11 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -99,12 +104,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -165,12 +164,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -229,10 +222,4 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // end service OnlineTables diff --git a/cmd/workspace/permission-migration/permission-migration.go b/cmd/workspace/permission-migration/permission-migration.go new file mode 100755 index 00000000..a957d5ca --- /dev/null +++ b/cmd/workspace/permission-migration/permission-migration.go @@ -0,0 +1,136 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package permission_migration + +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" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "permission-migration", + Short: `This spec contains undocumented permission migration APIs used in https://github.com/databrickslabs/ucx.`, + Long: `This spec contains undocumented permission migration APIs used in + https://github.com/databrickslabs/ucx.`, + GroupID: "iam", + Annotations: map[string]string{ + "package": "iam", + }, + + // This service is being previewed; hide from help output. + Hidden: true, + } + + // Add methods + cmd.AddCommand(newMigratePermissions()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start migrate-permissions command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var migratePermissionsOverrides []func( + *cobra.Command, + *iam.PermissionMigrationRequest, +) + +func newMigratePermissions() *cobra.Command { + cmd := &cobra.Command{} + + var migratePermissionsReq iam.PermissionMigrationRequest + var migratePermissionsJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&migratePermissionsJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().IntVar(&migratePermissionsReq.Size, "size", migratePermissionsReq.Size, `The maximum number of permissions that will be migrated.`) + + cmd.Use = "migrate-permissions WORKSPACE_ID FROM_WORKSPACE_GROUP_NAME TO_ACCOUNT_GROUP_NAME" + cmd.Short = `Migrate Permissions.` + cmd.Long = `Migrate Permissions. + + Migrate a batch of permissions from a workspace local group to an account + group. + + Arguments: + WORKSPACE_ID: WorkspaceId of the associated workspace where the permission migration + will occur. Both workspace group and account group must be in this + workspace. + FROM_WORKSPACE_GROUP_NAME: The name of the workspace group that permissions will be migrated from. + TO_ACCOUNT_GROUP_NAME: The name of the account group that permissions will be migrated to.` + + 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 'workspace_id', 'from_workspace_group_name', 'to_account_group_name' in your JSON input") + } + return nil + } + check := cobra.ExactArgs(3) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + err = migratePermissionsJson.Unmarshal(&migratePermissionsReq) + if err != nil { + return err + } + } + if !cmd.Flags().Changed("json") { + _, err = fmt.Sscan(args[0], &migratePermissionsReq.WorkspaceId) + if err != nil { + return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0]) + } + } + if !cmd.Flags().Changed("json") { + migratePermissionsReq.FromWorkspaceGroupName = args[1] + } + if !cmd.Flags().Changed("json") { + migratePermissionsReq.ToAccountGroupName = args[2] + } + + response, err := w.PermissionMigration.MigratePermissions(ctx, migratePermissionsReq) + 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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range migratePermissionsOverrides { + fn(cmd, &migratePermissionsReq) + } + + return cmd +} + +// end service PermissionMigration diff --git a/cmd/workspace/permissions/permissions.go b/cmd/workspace/permissions/permissions.go index 8aeb3fc7..5bf837e3 100755 --- a/cmd/workspace/permissions/permissions.go +++ b/cmd/workspace/permissions/permissions.go @@ -71,6 +71,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newSet()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -143,12 +149,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -209,12 +209,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start set command // Slice with functions to override default command behavior. @@ -289,12 +283,6 @@ func newSet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSet()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -369,10 +357,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Permissions diff --git a/cmd/workspace/pipelines/pipelines.go b/cmd/workspace/pipelines/pipelines.go index 4c2db6aa..78f42d6c 100755 --- a/cmd/workspace/pipelines/pipelines.go +++ b/cmd/workspace/pipelines/pipelines.go @@ -41,6 +41,22 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newGetUpdate()) + cmd.AddCommand(newListPipelineEvents()) + cmd.AddCommand(newListPipelines()) + cmd.AddCommand(newListUpdates()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newStartUpdate()) + cmd.AddCommand(newStop()) + cmd.AddCommand(newUpdate()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -109,12 +125,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -182,12 +192,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -258,12 +262,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -334,12 +332,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -411,12 +403,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start get-update command // Slice with functions to override default command behavior. @@ -477,12 +463,6 @@ func newGetUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetUpdate()) - }) -} - // start list-pipeline-events command // Slice with functions to override default command behavior. @@ -552,12 +532,6 @@ func newListPipelineEvents() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListPipelineEvents()) - }) -} - // start list-pipelines command // Slice with functions to override default command behavior. @@ -613,12 +587,6 @@ func newListPipelines() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListPipelines()) - }) -} - // start list-updates command // Slice with functions to override default command behavior. @@ -693,12 +661,6 @@ func newListUpdates() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListUpdates()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -780,12 +742,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start start-update command // Slice with functions to override default command behavior. @@ -875,12 +831,6 @@ func newStartUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newStartUpdate()) - }) -} - // start stop command // Slice with functions to override default command behavior. @@ -966,12 +916,6 @@ func newStop() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newStop()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -1071,12 +1015,6 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -1158,10 +1096,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service Pipelines diff --git a/cmd/workspace/policy-families/policy-families.go b/cmd/workspace/policy-families/policy-families.go index c81d2e92..f6c07bf7 100755 --- a/cmd/workspace/policy-families/policy-families.go +++ b/cmd/workspace/policy-families/policy-families.go @@ -32,6 +32,10 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -95,12 +99,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -154,10 +152,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service PolicyFamilies diff --git a/cmd/workspace/providers/providers.go b/cmd/workspace/providers/providers.go index 25529648..93f89c98 100755 --- a/cmd/workspace/providers/providers.go +++ b/cmd/workspace/providers/providers.go @@ -29,6 +29,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newListShares()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -123,12 +131,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -200,12 +202,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -278,12 +274,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -339,12 +329,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start list-shares command // Slice with functions to override default command behavior. @@ -414,12 +398,6 @@ func newListShares() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListShares()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -506,10 +484,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Providers diff --git a/cmd/workspace/queries/queries.go b/cmd/workspace/queries/queries.go index ef2de446..f2ab6f59 100755 --- a/cmd/workspace/queries/queries.go +++ b/cmd/workspace/queries/queries.go @@ -30,6 +30,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newRestore()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -105,12 +113,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -180,12 +182,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -254,12 +250,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -319,12 +309,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start restore command // Slice with functions to override default command behavior. @@ -393,12 +377,6 @@ func newRestore() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRestore()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -483,10 +461,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Queries diff --git a/cmd/workspace/query-history/query-history.go b/cmd/workspace/query-history/query-history.go index 84746105..a0402e6d 100755 --- a/cmd/workspace/query-history/query-history.go +++ b/cmd/workspace/query-history/query-history.go @@ -24,6 +24,9 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -89,10 +92,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service QueryHistory diff --git a/cmd/workspace/query-visualizations/query-visualizations.go b/cmd/workspace/query-visualizations/query-visualizations.go index 4f04c426..4161ac7d 100755 --- a/cmd/workspace/query-visualizations/query-visualizations.go +++ b/cmd/workspace/query-visualizations/query-visualizations.go @@ -32,6 +32,11 @@ func New() *cobra.Command { Hidden: true, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -97,12 +102,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -159,12 +158,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -231,10 +224,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service QueryVisualizations diff --git a/cmd/workspace/recipient-activation/recipient-activation.go b/cmd/workspace/recipient-activation/recipient-activation.go index 5fb5c7b9..068e6bb1 100755 --- a/cmd/workspace/recipient-activation/recipient-activation.go +++ b/cmd/workspace/recipient-activation/recipient-activation.go @@ -33,6 +33,10 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newGetActivationUrlInfo()) + cmd.AddCommand(newRetrieveToken()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -99,12 +103,6 @@ func newGetActivationUrlInfo() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetActivationUrlInfo()) - }) -} - // start retrieve-token command // Slice with functions to override default command behavior. @@ -164,10 +162,4 @@ func newRetrieveToken() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRetrieveToken()) - }) -} - // end service RecipientActivation diff --git a/cmd/workspace/recipients/recipients.go b/cmd/workspace/recipients/recipients.go index d7d432b9..79786313 100755 --- a/cmd/workspace/recipients/recipients.go +++ b/cmd/workspace/recipients/recipients.go @@ -43,6 +43,15 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newRotateToken()) + cmd.AddCommand(newSharePermissions()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -142,12 +151,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -219,12 +222,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -297,12 +294,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -358,12 +349,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start rotate-token command // Slice with functions to override default command behavior. @@ -448,12 +433,6 @@ func newRotateToken() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRotateToken()) - }) -} - // start share-permissions command // Slice with functions to override default command behavior. @@ -525,12 +504,6 @@ func newSharePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSharePermissions()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -617,10 +590,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Recipients diff --git a/cmd/workspace/registered-models/registered-models.go b/cmd/workspace/registered-models/registered-models.go index 98aec3bb..6cd01c13 100755 --- a/cmd/workspace/registered-models/registered-models.go +++ b/cmd/workspace/registered-models/registered-models.go @@ -55,6 +55,15 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newDeleteAlias()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newSetAlias()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -160,12 +169,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -242,12 +245,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start delete-alias command // Slice with functions to override default command behavior. @@ -313,12 +310,6 @@ func newDeleteAlias() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteAlias()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -394,12 +385,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -466,12 +451,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start set-alias command // Slice with functions to override default command behavior. @@ -559,12 +538,6 @@ func newSetAlias() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetAlias()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -655,10 +628,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service RegisteredModels diff --git a/cmd/workspace/repos/repos.go b/cmd/workspace/repos/repos.go index 0c38183a..6a989437 100755 --- a/cmd/workspace/repos/repos.go +++ b/cmd/workspace/repos/repos.go @@ -36,6 +36,17 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newList()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newUpdate()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -130,12 +141,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -209,12 +214,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -288,12 +287,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -364,12 +357,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -441,12 +428,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -501,12 +482,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -588,12 +563,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -680,12 +649,6 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -767,10 +730,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service Repos diff --git a/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go new file mode 100755 index 00000000..d6b8a842 --- /dev/null +++ b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go @@ -0,0 +1,227 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package restrict_workspace_admins + +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/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "restrict-workspace-admins", + Short: `The Restrict Workspace Admins setting lets you control the capabilities of workspace admins.`, + Long: `The Restrict Workspace Admins setting lets you control the capabilities of + workspace admins. With the setting status set to ALLOW_ALL, workspace admins + can create service principal personal access tokens on behalf of any service + principal in their workspace. Workspace admins can also change a job owner to + any user in their workspace. And they can change the job run_as setting to any + user in their workspace or to a service principal on which they have the + Service Principal User role. With the setting status set to + RESTRICT_TOKENS_AND_JOB_RUN_AS, workspace admins can only create personal + access tokens on behalf of service principals they have the Service Principal + User role on. They can also only change a job owner to themselves. And they + can change the job run_as setting to themselves or to a service principal on + which they have the Service Principal User role.`, + } + + // Add methods + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newUpdate()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start delete command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var deleteOverrides []func( + *cobra.Command, + *settings.DeleteRestrictWorkspaceAdminRequest, +) + +func newDelete() *cobra.Command { + cmd := &cobra.Command{} + + var deleteReq settings.DeleteRestrictWorkspaceAdminRequest + + // TODO: short flags + + cmd.Flags().StringVar(&deleteReq.Etag, "etag", deleteReq.Etag, `etag used for versioning.`) + + cmd.Use = "delete" + cmd.Short = `Delete the restrict workspace admins setting.` + cmd.Long = `Delete the restrict workspace admins setting. + + Reverts the restrict workspace admins setting status for the workspace. A + fresh etag needs to be provided in DELETE requests (as a query parameter). + The etag can be retrieved by making a GET request before the DELETE request. + If the setting is updated/deleted concurrently, DELETE fails with 409 and + the request must be retried by using the fresh etag in the 409 response.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + response, err := w.Settings.RestrictWorkspaceAdmins().Delete(ctx, deleteReq) + 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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range deleteOverrides { + fn(cmd, &deleteReq) + } + + return cmd +} + +// start get command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var getOverrides []func( + *cobra.Command, + *settings.GetRestrictWorkspaceAdminRequest, +) + +func newGet() *cobra.Command { + cmd := &cobra.Command{} + + var getReq settings.GetRestrictWorkspaceAdminRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`) + + cmd.Use = "get" + cmd.Short = `Get the restrict workspace admins setting.` + cmd.Long = `Get the restrict workspace admins setting. + + Gets the restrict workspace admins setting.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + response, err := w.Settings.RestrictWorkspaceAdmins().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getOverrides { + fn(cmd, &getReq) + } + + return cmd +} + +// start update command + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var updateOverrides []func( + *cobra.Command, + *settings.UpdateRestrictWorkspaceAdminsSettingRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq settings.UpdateRestrictWorkspaceAdminsSettingRequest + var updateJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update" + cmd.Short = `Update the restrict workspace admins setting.` + cmd.Long = `Update the restrict workspace admins setting. + + Updates the restrict workspace admins setting for the workspace. A fresh etag + needs to be provided in PATCH requests (as part of the setting field). The + etag can be retrieved by making a GET request before the PATCH request. If + the setting is updated concurrently, PATCH fails with 409 and the request + must be retried by using the fresh etag in the 409 response.` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustWorkspaceClient + cmd.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("please provide command input in JSON format by specifying the --json flag") + } + + response, err := w.Settings.RestrictWorkspaceAdmins().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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range updateOverrides { + fn(cmd, &updateReq) + } + + return cmd +} + +// end service RestrictWorkspaceAdmins diff --git a/cmd/workspace/schemas/schemas.go b/cmd/workspace/schemas/schemas.go index ebdab2ab..a5efeed3 100755 --- a/cmd/workspace/schemas/schemas.go +++ b/cmd/workspace/schemas/schemas.go @@ -31,6 +31,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -124,12 +131,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -201,12 +202,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -279,12 +274,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -349,12 +338,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -443,10 +426,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Schemas diff --git a/cmd/workspace/secrets/secrets.go b/cmd/workspace/secrets/secrets.go index ec6423d0..35b84907 100755 --- a/cmd/workspace/secrets/secrets.go +++ b/cmd/workspace/secrets/secrets.go @@ -38,6 +38,18 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreateScope()) + cmd.AddCommand(newDeleteAcl()) + cmd.AddCommand(newDeleteScope()) + cmd.AddCommand(newDeleteSecret()) + cmd.AddCommand(newGetAcl()) + cmd.AddCommand(newGetSecret()) + cmd.AddCommand(newListAcls()) + cmd.AddCommand(newListScopes()) + cmd.AddCommand(newListSecrets()) + cmd.AddCommand(newPutAcl()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -127,12 +139,6 @@ func newCreateScope() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateScope()) - }) -} - // start delete-acl command // Slice with functions to override default command behavior. @@ -217,12 +223,6 @@ func newDeleteAcl() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteAcl()) - }) -} - // start delete-scope command // Slice with functions to override default command behavior. @@ -302,12 +302,6 @@ func newDeleteScope() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteScope()) - }) -} - // start delete-secret command // Slice with functions to override default command behavior. @@ -392,12 +386,6 @@ func newDeleteSecret() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteSecret()) - }) -} - // start get-acl command // Slice with functions to override default command behavior. @@ -463,12 +451,6 @@ func newGetAcl() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetAcl()) - }) -} - // start get-secret command // Slice with functions to override default command behavior. @@ -540,12 +522,6 @@ func newGetSecret() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetSecret()) - }) -} - // start list-acls command // Slice with functions to override default command behavior. @@ -606,12 +582,6 @@ func newListAcls() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListAcls()) - }) -} - // start list-scopes command // Slice with functions to override default command behavior. @@ -654,12 +624,6 @@ func newListScopes() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListScopes()) - }) -} - // start list-secrets command // Slice with functions to override default command behavior. @@ -722,12 +686,6 @@ func newListSecrets() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListSecrets()) - }) -} - // start put-acl command // Slice with functions to override default command behavior. @@ -839,10 +797,4 @@ func newPutAcl() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPutAcl()) - }) -} - // end service Secrets diff --git a/cmd/workspace/service-principals/service-principals.go b/cmd/workspace/service-principals/service-principals.go index 353c0876..d363a1ba 100755 --- a/cmd/workspace/service-principals/service-principals.go +++ b/cmd/workspace/service-principals/service-principals.go @@ -32,6 +32,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newPatch()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -112,12 +120,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -188,12 +190,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -265,12 +261,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -329,12 +319,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start patch command // Slice with functions to override default command behavior. @@ -417,12 +401,6 @@ func newPatch() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPatch()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -513,10 +491,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service ServicePrincipals diff --git a/cmd/workspace/serving-endpoints/serving-endpoints.go b/cmd/workspace/serving-endpoints/serving-endpoints.go index 9424c5e4..c4ca7d62 100755 --- a/cmd/workspace/serving-endpoints/serving-endpoints.go +++ b/cmd/workspace/serving-endpoints/serving-endpoints.go @@ -40,6 +40,23 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newBuildLogs()) + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newExportMetrics()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newList()) + cmd.AddCommand(newLogs()) + cmd.AddCommand(newPatch()) + cmd.AddCommand(newPut()) + cmd.AddCommand(newQuery()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newUpdateConfig()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -111,12 +128,6 @@ func newBuildLogs() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newBuildLogs()) - }) -} - // start create command // Slice with functions to override default command behavior. @@ -195,12 +206,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -257,12 +262,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start export-metrics command // Slice with functions to override default command behavior. @@ -323,12 +322,6 @@ func newExportMetrics() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newExportMetrics()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -387,12 +380,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -451,12 +438,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -516,12 +497,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -559,12 +534,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start logs command // Slice with functions to override default command behavior. @@ -628,12 +597,6 @@ func newLogs() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newLogs()) - }) -} - // start patch command // Slice with functions to override default command behavior. @@ -705,12 +668,6 @@ func newPatch() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPatch()) - }) -} - // start put command // Slice with functions to override default command behavior. @@ -781,12 +738,6 @@ func newPut() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPut()) - }) -} - // start query command // Slice with functions to override default command behavior. @@ -865,12 +816,6 @@ func newQuery() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newQuery()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -940,12 +885,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start update-config command // Slice with functions to override default command behavior. @@ -1038,12 +977,6 @@ func newUpdateConfig() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateConfig()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -1113,10 +1046,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service ServingEndpoints diff --git a/cmd/workspace/settings/settings.go b/cmd/workspace/settings/settings.go index 35b65eb6..38e19e83 100755 --- a/cmd/workspace/settings/settings.go +++ b/cmd/workspace/settings/settings.go @@ -3,13 +3,13 @@ package settings 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/settings" "github.com/spf13/cobra" + + automatic_cluster_update "github.com/databricks/cli/cmd/workspace/automatic-cluster-update" + csp_enablement "github.com/databricks/cli/cmd/workspace/csp-enablement" + default_namespace "github.com/databricks/cli/cmd/workspace/default-namespace" + esm_enablement "github.com/databricks/cli/cmd/workspace/esm-enablement" + restrict_workspace_admins "github.com/databricks/cli/cmd/workspace/restrict-workspace-admins" ) // Slice with functions to override default command behavior. @@ -18,26 +18,22 @@ var cmdOverrides []func(*cobra.Command) func New() *cobra.Command { cmd := &cobra.Command{ - Use: "settings", - Short: `The default namespace setting API allows users to configure the default namespace for a Databricks workspace.`, - Long: `The default namespace setting API allows users to configure the default - namespace for a Databricks workspace. - - Through this API, users can retrieve, set, or modify the default namespace - used when queries do not reference a fully qualified three-level name. For - example, if you use the API to set 'retail_prod' as the default catalog, then - a query 'SELECT * FROM myTable' would reference the object - 'retail_prod.default.myTable' (the schema 'default' is always assumed). - - This setting requires a restart of clusters and SQL warehouses to take effect. - Additionally, the default namespace only applies when using Unity - Catalog-enabled compute.`, + Use: "settings", + Short: `Workspace Settings API allows users to manage settings at the workspace level.`, + Long: `Workspace Settings API allows users to manage settings at the workspace level.`, GroupID: "settings", Annotations: map[string]string{ "package": "settings", }, } + // Add subservices + cmd.AddCommand(automatic_cluster_update.New()) + cmd.AddCommand(csp_enablement.New()) + cmd.AddCommand(default_namespace.New()) + cmd.AddCommand(esm_enablement.New()) + cmd.AddCommand(restrict_workspace_admins.New()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -46,396 +42,4 @@ func New() *cobra.Command { return cmd } -// start delete-default-namespace-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var deleteDefaultNamespaceSettingOverrides []func( - *cobra.Command, - *settings.DeleteDefaultNamespaceSettingRequest, -) - -func newDeleteDefaultNamespaceSetting() *cobra.Command { - cmd := &cobra.Command{} - - var deleteDefaultNamespaceSettingReq settings.DeleteDefaultNamespaceSettingRequest - - // TODO: short flags - - cmd.Flags().StringVar(&deleteDefaultNamespaceSettingReq.Etag, "etag", deleteDefaultNamespaceSettingReq.Etag, `etag used for versioning.`) - - cmd.Use = "delete-default-namespace-setting" - cmd.Short = `Delete the default namespace setting.` - cmd.Long = `Delete the default namespace setting. - - Deletes the default namespace setting for the workspace. A fresh etag needs to - be provided in DELETE requests (as a query parameter). The etag can be - retrieved by making a GET request before the DELETE request. If the setting is - updated/deleted concurrently, DELETE will fail with 409 and the request will - need to be retried by using the fresh etag in the 409 response.` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) - return check(cmd, args) - } - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := root.WorkspaceClient(ctx) - - response, err := w.Settings.DeleteDefaultNamespaceSetting(ctx, deleteDefaultNamespaceSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range deleteDefaultNamespaceSettingOverrides { - fn(cmd, &deleteDefaultNamespaceSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteDefaultNamespaceSetting()) - }) -} - -// start delete-restrict-workspace-admins-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var deleteRestrictWorkspaceAdminsSettingOverrides []func( - *cobra.Command, - *settings.DeleteRestrictWorkspaceAdminsSettingRequest, -) - -func newDeleteRestrictWorkspaceAdminsSetting() *cobra.Command { - cmd := &cobra.Command{} - - var deleteRestrictWorkspaceAdminsSettingReq settings.DeleteRestrictWorkspaceAdminsSettingRequest - - // TODO: short flags - - cmd.Flags().StringVar(&deleteRestrictWorkspaceAdminsSettingReq.Etag, "etag", deleteRestrictWorkspaceAdminsSettingReq.Etag, `etag used for versioning.`) - - cmd.Use = "delete-restrict-workspace-admins-setting" - cmd.Short = `Delete the restrict workspace admins setting.` - cmd.Long = `Delete the restrict workspace admins setting. - - Reverts the restrict workspace admins setting status for the workspace. A - fresh etag needs to be provided in DELETE requests (as a query parameter). The - etag can be retrieved by making a GET request before the DELETE request. If - the setting is updated/deleted concurrently, DELETE will fail with 409 and the - request will need to be retried by using the fresh etag in the 409 response.` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) - return check(cmd, args) - } - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := root.WorkspaceClient(ctx) - - response, err := w.Settings.DeleteRestrictWorkspaceAdminsSetting(ctx, deleteRestrictWorkspaceAdminsSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range deleteRestrictWorkspaceAdminsSettingOverrides { - fn(cmd, &deleteRestrictWorkspaceAdminsSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteRestrictWorkspaceAdminsSetting()) - }) -} - -// start get-default-namespace-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var getDefaultNamespaceSettingOverrides []func( - *cobra.Command, - *settings.GetDefaultNamespaceSettingRequest, -) - -func newGetDefaultNamespaceSetting() *cobra.Command { - cmd := &cobra.Command{} - - var getDefaultNamespaceSettingReq settings.GetDefaultNamespaceSettingRequest - - // TODO: short flags - - cmd.Flags().StringVar(&getDefaultNamespaceSettingReq.Etag, "etag", getDefaultNamespaceSettingReq.Etag, `etag used for versioning.`) - - cmd.Use = "get-default-namespace-setting" - cmd.Short = `Get the default namespace setting.` - cmd.Long = `Get the default namespace setting. - - Gets the default namespace setting.` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) - return check(cmd, args) - } - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := root.WorkspaceClient(ctx) - - response, err := w.Settings.GetDefaultNamespaceSetting(ctx, getDefaultNamespaceSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range getDefaultNamespaceSettingOverrides { - fn(cmd, &getDefaultNamespaceSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetDefaultNamespaceSetting()) - }) -} - -// start get-restrict-workspace-admins-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var getRestrictWorkspaceAdminsSettingOverrides []func( - *cobra.Command, - *settings.GetRestrictWorkspaceAdminsSettingRequest, -) - -func newGetRestrictWorkspaceAdminsSetting() *cobra.Command { - cmd := &cobra.Command{} - - var getRestrictWorkspaceAdminsSettingReq settings.GetRestrictWorkspaceAdminsSettingRequest - - // TODO: short flags - - cmd.Flags().StringVar(&getRestrictWorkspaceAdminsSettingReq.Etag, "etag", getRestrictWorkspaceAdminsSettingReq.Etag, `etag used for versioning.`) - - cmd.Use = "get-restrict-workspace-admins-setting" - cmd.Short = `Get the restrict workspace admins setting.` - cmd.Long = `Get the restrict workspace admins setting. - - Gets the restrict workspace admins setting.` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(0) - return check(cmd, args) - } - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := root.WorkspaceClient(ctx) - - response, err := w.Settings.GetRestrictWorkspaceAdminsSetting(ctx, getRestrictWorkspaceAdminsSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range getRestrictWorkspaceAdminsSettingOverrides { - fn(cmd, &getRestrictWorkspaceAdminsSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetRestrictWorkspaceAdminsSetting()) - }) -} - -// start update-default-namespace-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var updateDefaultNamespaceSettingOverrides []func( - *cobra.Command, - *settings.UpdateDefaultNamespaceSettingRequest, -) - -func newUpdateDefaultNamespaceSetting() *cobra.Command { - cmd := &cobra.Command{} - - var updateDefaultNamespaceSettingReq settings.UpdateDefaultNamespaceSettingRequest - var updateDefaultNamespaceSettingJson flags.JsonFlag - - // TODO: short flags - cmd.Flags().Var(&updateDefaultNamespaceSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`) - - cmd.Use = "update-default-namespace-setting" - cmd.Short = `Update the default namespace setting.` - cmd.Long = `Update the default namespace setting. - - Updates the default namespace setting for the workspace. A fresh etag needs to - be provided in PATCH requests (as part of the setting field). The etag can be - retrieved by making a GET request before the PATCH request. Note that if the - setting does not exist, GET will return a NOT_FOUND error and the etag will be - present in the error response, which should be set in the PATCH request. If - the setting is updated concurrently, PATCH will fail with 409 and the request - will need to be retried by using the fresh etag in the 409 response.` - - cmd.Annotations = make(map[string]string) - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := root.WorkspaceClient(ctx) - - if cmd.Flags().Changed("json") { - err = updateDefaultNamespaceSettingJson.Unmarshal(&updateDefaultNamespaceSettingReq) - if err != nil { - return err - } - } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") - } - - response, err := w.Settings.UpdateDefaultNamespaceSetting(ctx, updateDefaultNamespaceSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range updateDefaultNamespaceSettingOverrides { - fn(cmd, &updateDefaultNamespaceSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateDefaultNamespaceSetting()) - }) -} - -// start update-restrict-workspace-admins-setting command - -// Slice with functions to override default command behavior. -// Functions can be added from the `init()` function in manually curated files in this directory. -var updateRestrictWorkspaceAdminsSettingOverrides []func( - *cobra.Command, - *settings.UpdateRestrictWorkspaceAdminsSettingRequest, -) - -func newUpdateRestrictWorkspaceAdminsSetting() *cobra.Command { - cmd := &cobra.Command{} - - var updateRestrictWorkspaceAdminsSettingReq settings.UpdateRestrictWorkspaceAdminsSettingRequest - var updateRestrictWorkspaceAdminsSettingJson flags.JsonFlag - - // TODO: short flags - cmd.Flags().Var(&updateRestrictWorkspaceAdminsSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`) - - cmd.Use = "update-restrict-workspace-admins-setting" - cmd.Short = `Update the restrict workspace admins setting.` - cmd.Long = `Update the restrict workspace admins setting. - - Updates the restrict workspace admins setting for the workspace. A fresh etag - needs to be provided in PATCH requests (as part of the setting field). The - etag can be retrieved by making a GET request before the PATCH request. If the - setting is updated concurrently, PATCH will fail with 409 and the request will - need to be retried by using the fresh etag in the 409 response.` - - cmd.Annotations = make(map[string]string) - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := root.WorkspaceClient(ctx) - - if cmd.Flags().Changed("json") { - err = updateRestrictWorkspaceAdminsSettingJson.Unmarshal(&updateRestrictWorkspaceAdminsSettingReq) - if err != nil { - return err - } - } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") - } - - response, err := w.Settings.UpdateRestrictWorkspaceAdminsSetting(ctx, updateRestrictWorkspaceAdminsSettingReq) - 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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range updateRestrictWorkspaceAdminsSettingOverrides { - fn(cmd, &updateRestrictWorkspaceAdminsSettingReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateRestrictWorkspaceAdminsSetting()) - }) -} - // end service Settings diff --git a/cmd/workspace/shares/shares.go b/cmd/workspace/shares/shares.go index 2c0479a0..b849f84f 100755 --- a/cmd/workspace/shares/shares.go +++ b/cmd/workspace/shares/shares.go @@ -31,6 +31,15 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newSharePermissions()) + cmd.AddCommand(newUpdate()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -118,12 +127,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -183,12 +186,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -250,12 +247,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -297,12 +288,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start share-permissions command // Slice with functions to override default command behavior. @@ -362,12 +347,6 @@ func newSharePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSharePermissions()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -452,12 +431,6 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -530,10 +503,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service Shares diff --git a/cmd/workspace/storage-credentials/storage-credentials.go b/cmd/workspace/storage-credentials/storage-credentials.go index 4a0d8f30..b763d193 100755 --- a/cmd/workspace/storage-credentials/storage-credentials.go +++ b/cmd/workspace/storage-credentials/storage-credentials.go @@ -39,6 +39,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newUpdate()) + cmd.AddCommand(newValidate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -70,7 +78,7 @@ func newCreate() *cobra.Command { // TODO: complex arg: azure_service_principal // TODO: complex arg: cloudflare_api_token cmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `Comment associated with the credential.`) - // TODO: output-only field + // TODO: complex arg: databricks_gcp_service_account cmd.Flags().BoolVar(&createReq.ReadOnly, "read-only", createReq.ReadOnly, `Whether the storage credential is only usable for read operations.`) cmd.Flags().BoolVar(&createReq.SkipValidation, "skip-validation", createReq.SkipValidation, `Supplying true to this argument skips validation of the created credential.`) @@ -131,12 +139,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -210,12 +212,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -288,12 +284,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -352,12 +342,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -381,7 +365,7 @@ func newUpdate() *cobra.Command { // TODO: complex arg: azure_service_principal // TODO: complex arg: cloudflare_api_token cmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `Comment associated with the credential.`) - // TODO: output-only field + // TODO: complex arg: databricks_gcp_service_account cmd.Flags().BoolVar(&updateReq.Force, "force", updateReq.Force, `Force update even if there are dependent external locations or external tables.`) cmd.Flags().StringVar(&updateReq.NewName, "new-name", updateReq.NewName, `New name for the storage credential.`) cmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `Username of current owner of credential.`) @@ -448,12 +432,6 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // start validate command // Slice with functions to override default command behavior. @@ -476,10 +454,10 @@ func newValidate() *cobra.Command { // TODO: complex arg: azure_managed_identity // TODO: complex arg: azure_service_principal // TODO: complex arg: cloudflare_api_token - // TODO: output-only field + // TODO: complex arg: databricks_gcp_service_account cmd.Flags().StringVar(&validateReq.ExternalLocationName, "external-location-name", validateReq.ExternalLocationName, `The name of an existing external location to validate.`) cmd.Flags().BoolVar(&validateReq.ReadOnly, "read-only", validateReq.ReadOnly, `Whether the storage credential is only usable for read operations.`) - // TODO: any: storage_credential_name + cmd.Flags().StringVar(&validateReq.StorageCredentialName, "storage-credential-name", validateReq.StorageCredentialName, `The name of the storage credential to validate.`) cmd.Flags().StringVar(&validateReq.Url, "url", validateReq.Url, `The external location url to validate.`) cmd.Use = "validate" @@ -537,10 +515,4 @@ func newValidate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newValidate()) - }) -} - // end service StorageCredentials diff --git a/cmd/workspace/system-schemas/system-schemas.go b/cmd/workspace/system-schemas/system-schemas.go index 9b2392a6..d8135ac2 100755 --- a/cmd/workspace/system-schemas/system-schemas.go +++ b/cmd/workspace/system-schemas/system-schemas.go @@ -28,6 +28,11 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newDisable()) + cmd.AddCommand(newEnable()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -100,12 +105,6 @@ func newDisable() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDisable()) - }) -} - // start enable command // Slice with functions to override default command behavior. @@ -170,12 +169,6 @@ func newEnable() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newEnable()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -232,10 +225,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service SystemSchemas diff --git a/cmd/workspace/table-constraints/table-constraints.go b/cmd/workspace/table-constraints/table-constraints.go index e17b9540..d5597ab3 100755 --- a/cmd/workspace/table-constraints/table-constraints.go +++ b/cmd/workspace/table-constraints/table-constraints.go @@ -39,6 +39,10 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -115,12 +119,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -196,10 +194,4 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // end service TableConstraints diff --git a/cmd/workspace/tables/tables.go b/cmd/workspace/tables/tables.go index d4e76587..1ee6b0d5 100755 --- a/cmd/workspace/tables/tables.go +++ b/cmd/workspace/tables/tables.go @@ -35,6 +35,14 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newDelete()) + cmd.AddCommand(newExists()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newList()) + cmd.AddCommand(newListSummaries()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -117,12 +125,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start exists command // Slice with functions to override default command behavior. @@ -200,12 +202,6 @@ func newExists() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newExists()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -284,12 +280,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -358,12 +348,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start list-summaries command // Slice with functions to override default command behavior. @@ -446,12 +430,6 @@ func newListSummaries() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListSummaries()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -539,10 +517,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Tables diff --git a/cmd/workspace/token-management/token-management.go b/cmd/workspace/token-management/token-management.go index 1c2e2c37..5209ff16 100755 --- a/cmd/workspace/token-management/token-management.go +++ b/cmd/workspace/token-management/token-management.go @@ -29,6 +29,16 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreateOboToken()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newList()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -130,12 +140,6 @@ func newCreateOboToken() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateOboToken()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -206,12 +210,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -282,12 +280,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -330,12 +322,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -379,12 +365,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -438,12 +418,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -509,12 +483,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -580,10 +548,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service TokenManagement diff --git a/cmd/workspace/tokens/tokens.go b/cmd/workspace/tokens/tokens.go index 5550acfa..bdb99d60 100755 --- a/cmd/workspace/tokens/tokens.go +++ b/cmd/workspace/tokens/tokens.go @@ -28,6 +28,11 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newList()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -104,12 +109,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -203,12 +202,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -248,10 +241,4 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // end service Tokens diff --git a/cmd/workspace/users/users.go b/cmd/workspace/users/users.go index 078a712e..676b10a0 100755 --- a/cmd/workspace/users/users.go +++ b/cmd/workspace/users/users.go @@ -37,6 +37,18 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newList()) + cmd.AddCommand(newPatch()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newUpdate()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -120,12 +132,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -197,12 +203,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -281,12 +281,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -329,12 +323,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -378,12 +366,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -442,12 +424,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start patch command // Slice with functions to override default command behavior. @@ -530,12 +506,6 @@ func newPatch() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newPatch()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -601,12 +571,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -698,12 +662,6 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -769,10 +727,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service Users diff --git a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go index d6863b66..a8d3d3ee 100755 --- a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go +++ b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go @@ -28,6 +28,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreateEndpoint()) + cmd.AddCommand(newDeleteEndpoint()) + cmd.AddCommand(newGetEndpoint()) + cmd.AddCommand(newListEndpoints()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -142,12 +148,6 @@ func newCreateEndpoint() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateEndpoint()) - }) -} - // start delete-endpoint command // Slice with functions to override default command behavior. @@ -164,18 +164,17 @@ func newDeleteEndpoint() *cobra.Command { // TODO: short flags - cmd.Use = "delete-endpoint ENDPOINT_NAME NAME" + cmd.Use = "delete-endpoint ENDPOINT_NAME" cmd.Short = `Delete an endpoint.` cmd.Long = `Delete an endpoint. Arguments: - ENDPOINT_NAME: Name of the endpoint - NAME: Name of the endpoint to delete` + ENDPOINT_NAME: Name of the endpoint` cmd.Annotations = make(map[string]string) cmd.Args = func(cmd *cobra.Command, args []string) error { - check := cobra.ExactArgs(2) + check := cobra.ExactArgs(1) return check(cmd, args) } @@ -185,7 +184,6 @@ func newDeleteEndpoint() *cobra.Command { w := root.WorkspaceClient(ctx) deleteEndpointReq.EndpointName = args[0] - deleteEndpointReq.Name = args[1] err = w.VectorSearchEndpoints.DeleteEndpoint(ctx, deleteEndpointReq) if err != nil { @@ -206,12 +204,6 @@ func newDeleteEndpoint() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteEndpoint()) - }) -} - // start get-endpoint command // Slice with functions to override default command behavior. @@ -268,12 +260,6 @@ func newGetEndpoint() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetEndpoint()) - }) -} - // start list-endpoints command // Slice with functions to override default command behavior. @@ -324,10 +310,4 @@ func newListEndpoints() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListEndpoints()) - }) -} - // end service VectorSearchEndpoints diff --git a/cmd/workspace/vector-search-indexes/vector-search-indexes.go b/cmd/workspace/vector-search-indexes/vector-search-indexes.go index 6beca7d2..a9b9f51d 100755 --- a/cmd/workspace/vector-search-indexes/vector-search-indexes.go +++ b/cmd/workspace/vector-search-indexes/vector-search-indexes.go @@ -35,6 +35,16 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreateIndex()) + cmd.AddCommand(newDeleteDataVectorIndex()) + cmd.AddCommand(newDeleteIndex()) + cmd.AddCommand(newGetIndex()) + cmd.AddCommand(newListIndexes()) + cmd.AddCommand(newQueryIndex()) + cmd.AddCommand(newSyncIndex()) + cmd.AddCommand(newUpsertDataVectorIndex()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -63,9 +73,8 @@ func newCreateIndex() *cobra.Command { // TODO: complex arg: delta_sync_index_spec // TODO: complex arg: direct_access_index_spec - cmd.Flags().StringVar(&createIndexReq.EndpointName, "endpoint-name", createIndexReq.EndpointName, `Name of the endpoint to be used for serving the index.`) - cmd.Use = "create-index NAME PRIMARY_KEY INDEX_TYPE" + cmd.Use = "create-index NAME ENDPOINT_NAME PRIMARY_KEY INDEX_TYPE" cmd.Short = `Create an index.` cmd.Long = `Create an index. @@ -73,6 +82,7 @@ func newCreateIndex() *cobra.Command { Arguments: NAME: Name of the index + ENDPOINT_NAME: Name of the endpoint to be used for serving the index PRIMARY_KEY: Primary key of the index INDEX_TYPE: There are 2 types of Vector Search indexes: @@ -88,11 +98,11 @@ func newCreateIndex() *cobra.Command { 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 'name', 'primary_key', 'index_type' in your JSON input") + return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'endpoint_name', 'primary_key', 'index_type' in your JSON input") } return nil } - check := cobra.ExactArgs(3) + check := cobra.ExactArgs(4) return check(cmd, args) } @@ -111,12 +121,15 @@ func newCreateIndex() *cobra.Command { createIndexReq.Name = args[0] } if !cmd.Flags().Changed("json") { - createIndexReq.PrimaryKey = args[1] + createIndexReq.EndpointName = args[1] } if !cmd.Flags().Changed("json") { - _, err = fmt.Sscan(args[2], &createIndexReq.IndexType) + createIndexReq.PrimaryKey = args[2] + } + if !cmd.Flags().Changed("json") { + _, err = fmt.Sscan(args[3], &createIndexReq.IndexType) if err != nil { - return fmt.Errorf("invalid INDEX_TYPE: %s", args[2]) + return fmt.Errorf("invalid INDEX_TYPE: %s", args[3]) } } @@ -139,12 +152,6 @@ func newCreateIndex() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreateIndex()) - }) -} - // start delete-data-vector-index command // Slice with functions to override default command behavior. @@ -163,14 +170,14 @@ func newDeleteDataVectorIndex() *cobra.Command { // TODO: short flags cmd.Flags().Var(&deleteDataVectorIndexJson, "json", `either inline JSON string or @path/to/file.json with request body`) - cmd.Use = "delete-data-vector-index NAME" + cmd.Use = "delete-data-vector-index INDEX_NAME" cmd.Short = `Delete data from index.` cmd.Long = `Delete data from index. Handles the deletion of data from a specified vector index. Arguments: - NAME: Name of the vector index where data is to be deleted. Must be a Direct + INDEX_NAME: Name of the vector index where data is to be deleted. Must be a Direct Vector Access Index.` cmd.Annotations = make(map[string]string) @@ -193,7 +200,7 @@ func newDeleteDataVectorIndex() *cobra.Command { } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") } - deleteDataVectorIndexReq.Name = args[0] + deleteDataVectorIndexReq.IndexName = args[0] response, err := w.VectorSearchIndexes.DeleteDataVectorIndex(ctx, deleteDataVectorIndexReq) if err != nil { @@ -214,12 +221,6 @@ func newDeleteDataVectorIndex() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteDataVectorIndex()) - }) -} - // start delete-index command // Slice with functions to override default command behavior. @@ -278,12 +279,6 @@ func newDeleteIndex() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDeleteIndex()) - }) -} - // start get-index command // Slice with functions to override default command behavior. @@ -342,12 +337,6 @@ func newGetIndex() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetIndex()) - }) -} - // start list-indexes command // Slice with functions to override default command behavior. @@ -405,12 +394,6 @@ func newListIndexes() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newListIndexes()) - }) -} - // start query-index command // Slice with functions to override default command behavior. @@ -484,12 +467,6 @@ func newQueryIndex() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newQueryIndex()) - }) -} - // start sync-index command // Slice with functions to override default command behavior. @@ -548,12 +525,6 @@ func newSyncIndex() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSyncIndex()) - }) -} - // start upsert-data-vector-index command // Slice with functions to override default command behavior. @@ -572,14 +543,14 @@ func newUpsertDataVectorIndex() *cobra.Command { // TODO: short flags cmd.Flags().Var(&upsertDataVectorIndexJson, "json", `either inline JSON string or @path/to/file.json with request body`) - cmd.Use = "upsert-data-vector-index NAME INPUTS_JSON" + cmd.Use = "upsert-data-vector-index INDEX_NAME INPUTS_JSON" cmd.Short = `Upsert data into an index.` cmd.Long = `Upsert data into an index. Handles the upserting of data into a specified vector index. Arguments: - NAME: Name of the vector index where data is to be upserted. Must be a Direct + INDEX_NAME: Name of the vector index where data is to be upserted. Must be a Direct Vector Access Index. INPUTS_JSON: JSON string representing the data to be upserted.` @@ -589,7 +560,7 @@ func newUpsertDataVectorIndex() *cobra.Command { if cmd.Flags().Changed("json") { err := cobra.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'inputs_json' in your JSON input") + return fmt.Errorf("when --json flag is specified, provide only INDEX_NAME as positional arguments. Provide 'inputs_json' in your JSON input") } return nil } @@ -608,7 +579,7 @@ func newUpsertDataVectorIndex() *cobra.Command { return err } } - upsertDataVectorIndexReq.Name = args[0] + upsertDataVectorIndexReq.IndexName = args[0] if !cmd.Flags().Changed("json") { upsertDataVectorIndexReq.InputsJson = args[1] } @@ -632,10 +603,4 @@ func newUpsertDataVectorIndex() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpsertDataVectorIndex()) - }) -} - // end service VectorSearchIndexes diff --git a/cmd/workspace/volumes/volumes.go b/cmd/workspace/volumes/volumes.go index 12cafeaf..5a2991b9 100755 --- a/cmd/workspace/volumes/volumes.go +++ b/cmd/workspace/volumes/volumes.go @@ -34,6 +34,13 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newList()) + cmd.AddCommand(newRead()) + cmd.AddCommand(newUpdate()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -152,12 +159,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -232,12 +233,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -308,12 +303,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start read command // Slice with functions to override default command behavior. @@ -389,12 +378,6 @@ func newRead() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newRead()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -484,10 +467,4 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // end service Volumes diff --git a/cmd/workspace/warehouses/warehouses.go b/cmd/workspace/warehouses/warehouses.go index 2e9282a8..3d1f0543 100755 --- a/cmd/workspace/warehouses/warehouses.go +++ b/cmd/workspace/warehouses/warehouses.go @@ -30,6 +30,21 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newEdit()) + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newGetWorkspaceWarehouseConfig()) + cmd.AddCommand(newList()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newSetWorkspaceWarehouseConfig()) + cmd.AddCommand(newStart()) + cmd.AddCommand(newStop()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -138,12 +153,6 @@ func newCreate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - // start delete command // Slice with functions to override default command behavior. @@ -214,12 +223,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start edit command // Slice with functions to override default command behavior. @@ -336,12 +339,6 @@ func newEdit() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newEdit()) - }) -} - // start get command // Slice with functions to override default command behavior. @@ -417,12 +414,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -493,12 +484,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -570,12 +555,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start get-workspace-warehouse-config command // Slice with functions to override default command behavior. @@ -619,12 +598,6 @@ func newGetWorkspaceWarehouseConfig() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetWorkspaceWarehouseConfig()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -677,12 +650,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -764,12 +731,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start set-workspace-warehouse-config command // Slice with functions to override default command behavior. @@ -843,12 +804,6 @@ func newSetWorkspaceWarehouseConfig() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetWorkspaceWarehouseConfig()) - }) -} - // start start command // Slice with functions to override default command behavior. @@ -943,12 +898,6 @@ func newStart() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newStart()) - }) -} - // start stop command // Slice with functions to override default command behavior. @@ -1043,12 +992,6 @@ func newStop() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newStop()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -1130,10 +1073,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service Warehouses diff --git a/cmd/workspace/workspace-bindings/workspace-bindings.go b/cmd/workspace/workspace-bindings/workspace-bindings.go index f8d31fa4..3543f1e9 100755 --- a/cmd/workspace/workspace-bindings/workspace-bindings.go +++ b/cmd/workspace/workspace-bindings/workspace-bindings.go @@ -42,6 +42,12 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newGet()) + cmd.AddCommand(newGetBindings()) + cmd.AddCommand(newUpdate()) + cmd.AddCommand(newUpdateBindings()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -109,12 +115,6 @@ func newGet() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - // start get-bindings command // Slice with functions to override default command behavior. @@ -176,12 +176,6 @@ func newGetBindings() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetBindings()) - }) -} - // start update command // Slice with functions to override default command behavior. @@ -252,12 +246,6 @@ func newUpdate() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdate()) - }) -} - // start update-bindings command // Slice with functions to override default command behavior. @@ -330,10 +318,4 @@ func newUpdateBindings() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdateBindings()) - }) -} - // end service WorkspaceBindings diff --git a/cmd/workspace/workspace-conf/workspace-conf.go b/cmd/workspace/workspace-conf/workspace-conf.go index 99207ffa..87ea86c8 100755 --- a/cmd/workspace/workspace-conf/workspace-conf.go +++ b/cmd/workspace/workspace-conf/workspace-conf.go @@ -27,6 +27,10 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newGetStatus()) + cmd.AddCommand(newSetStatus()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -90,12 +94,6 @@ func newGetStatus() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetStatus()) - }) -} - // start set-status command // Slice with functions to override default command behavior. @@ -156,10 +154,4 @@ func newSetStatus() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetStatus()) - }) -} - // end service WorkspaceConf diff --git a/cmd/workspace/workspace/workspace.go b/cmd/workspace/workspace/workspace.go index 4fb63f0c..42517c43 100755 --- a/cmd/workspace/workspace/workspace.go +++ b/cmd/workspace/workspace/workspace.go @@ -31,6 +31,18 @@ func New() *cobra.Command { }, } + // Add methods + cmd.AddCommand(newDelete()) + cmd.AddCommand(newExport()) + cmd.AddCommand(newGetPermissionLevels()) + cmd.AddCommand(newGetPermissions()) + cmd.AddCommand(newGetStatus()) + cmd.AddCommand(newImport()) + cmd.AddCommand(newList()) + cmd.AddCommand(newMkdirs()) + cmd.AddCommand(newSetPermissions()) + cmd.AddCommand(newUpdatePermissions()) + // Apply optional overrides to this command. for _, fn := range cmdOverrides { fn(cmd) @@ -138,12 +150,6 @@ func newDelete() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) - }) -} - // start export command // Slice with functions to override default command behavior. @@ -231,12 +237,6 @@ func newExport() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newExport()) - }) -} - // start get-permission-levels command // Slice with functions to override default command behavior. @@ -297,12 +297,6 @@ func newGetPermissionLevels() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissionLevels()) - }) -} - // start get-permissions command // Slice with functions to override default command behavior. @@ -364,12 +358,6 @@ func newGetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetPermissions()) - }) -} - // start get-status command // Slice with functions to override default command behavior. @@ -429,12 +417,6 @@ func newGetStatus() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGetStatus()) - }) -} - // start import command // Slice with functions to override default command behavior. @@ -528,12 +510,6 @@ func newImport() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newImport()) - }) -} - // start list command // Slice with functions to override default command behavior. @@ -593,12 +569,6 @@ func newList() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newList()) - }) -} - // start mkdirs command // Slice with functions to override default command behavior. @@ -696,12 +666,6 @@ func newMkdirs() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newMkdirs()) - }) -} - // start set-permissions command // Slice with functions to override default command behavior. @@ -773,12 +737,6 @@ func newSetPermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newSetPermissions()) - }) -} - // start update-permissions command // Slice with functions to override default command behavior. @@ -850,10 +808,4 @@ func newUpdatePermissions() *cobra.Command { return cmd } -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newUpdatePermissions()) - }) -} - // end service Workspace diff --git a/go.mod b/go.mod index 49521f64..1f040cda 100644 --- a/go.mod +++ b/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.33.0 // Apache 2.0 + github.com/databricks/databricks-sdk-go v0.34.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.6.0 // BSD-3-Clause @@ -20,7 +20,7 @@ require ( github.com/spf13/cobra v1.8.0 // Apache 2.0 github.com/spf13/pflag v1.0.5 // BSD-3-Clause github.com/stretchr/testify v1.9.0 // MIT - golang.org/x/exp v0.0.0-20231006140011-7918f672742d + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 golang.org/x/mod v0.15.0 golang.org/x/oauth2 v0.17.0 golang.org/x/sync v0.6.0 @@ -32,7 +32,7 @@ require ( require gopkg.in/yaml.v3 v3.0.1 require ( - cloud.google.com/go/compute v1.23.3 // indirect + cloud.google.com/go/compute v1.23.4 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect @@ -54,18 +54,18 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/zclconf/go-cty v1.14.1 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect - go.opentelemetry.io/otel v1.22.0 // indirect - go.opentelemetry.io/otel/metric v1.22.0 // indirect - go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect + go.opentelemetry.io/otel v1.23.0 // indirect + go.opentelemetry.io/otel/metric v1.23.0 // indirect + go.opentelemetry.io/otel/trace v1.23.0 // indirect golang.org/x/crypto v0.19.0 // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.161.0 // indirect + google.golang.org/api v0.166.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect - google.golang.org/grpc v1.60.1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect + google.golang.org/grpc v1.61.1 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 4b273bc3..de5f07cf 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= -cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= +cloud.google.com/go/compute v1.23.4 h1:EBT9Nw4q3zyE7G45Wvv3MzolIrCJEuHys5muLY0wvAw= +cloud.google.com/go/compute v1.23.4/go.mod h1:/EJMj55asU6kAFnuZET8zqgwgJ9FvXWXOkkfQZa4ioI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= @@ -28,8 +28,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.33.0 h1:0ldeP8aPnpKLV/mvNKsOVijOaLLo6TxRGdIwrEf2rlQ= -github.com/databricks/databricks-sdk-go v0.33.0/go.mod h1:yyXGdhEfXBBsIoTm0mdl8QN0xzCQPUVZTozMM/7wVuI= +github.com/databricks/databricks-sdk-go v0.34.0 h1:z4JjgcCk99jAGxx3JgkMsniJFtReWhtAxkgyvtdFqCs= +github.com/databricks/databricks-sdk-go v0.34.0/go.mod h1:MGNWVPqxYCW1vj/xD7DeLT8uChi4lgTFum+iIwDxd/Q= 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= @@ -94,8 +94,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= -github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= +github.com/googleapis/gax-go/v2 v2.12.1 h1:9F8GV9r9ztXyAi00gsMQHNoF51xPZm8uj1dpYt2ZETM= +github.com/googleapis/gax-go/v2 v2.12.1/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= @@ -160,24 +160,24 @@ github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= -go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= -go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= -go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= -go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= -go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= -go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 h1:P+/g8GpuJGYbOp2tAdKrIPUX9JO02q8Q0YNlHolpibA= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0/go.mod h1:tIKj3DbO8N9Y2xo52og3irLsPI4GW02DSMtrVgNMgxg= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 h1:doUP+ExOpH3spVTLS0FcWGLnQrPct/hD/bCPbDRUEAU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0/go.mod h1:rdENBZMT2OE6Ne/KLwpiXudnAsbdrdBaqBvTN8M8BgA= +go.opentelemetry.io/otel v1.23.0 h1:Df0pqjqExIywbMCMTxkAwzjLZtRf+bBKLbUcpxO2C9E= +go.opentelemetry.io/otel v1.23.0/go.mod h1:YCycw9ZeKhcJFrb34iVSkyT0iczq/zYDtZYFufObyB0= +go.opentelemetry.io/otel/metric v1.23.0 h1:pazkx7ss4LFVVYSxYew7L5I6qvLXHA0Ap2pwV+9Cnpo= +go.opentelemetry.io/otel/metric v1.23.0/go.mod h1:MqUW2X2a6Q8RN96E2/nqNoT+z9BSms20Jb7Bbp+HiTo= +go.opentelemetry.io/otel/trace v1.23.0 h1:37Ik5Ib7xfYVb4V1UtnT97T1jI+AoIYkJyPkuL4iJgI= +go.opentelemetry.io/otel/trace v1.23.0/go.mod h1:GSGTbIClEsuZrGIzoEHqsVfxgn5UkggkflQwDScNUsk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -239,12 +239,12 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.161.0 h1:oYzk/bs26WN10AV7iU7MVJVXBH8oCPS2hHyBiEeFoSU= -google.golang.org/api v0.161.0/go.mod h1:0mu0TpK33qnydLvWqbImq2b1eQ5FHRSDCBzAxX9ZHyw= +google.golang.org/api v0.166.0 h1:6m4NUwrZYhAaVIHZWxaKjw1L1vNAjtMwORmKRyEEo24= +google.golang.org/api v0.166.0/go.mod h1:4FcBc686KFi7QI/U51/2GKKevfZMpM17sCdibqe/bSA= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= @@ -252,15 +252,15 @@ google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 h1:hZB7eLIaYlW9qXRfCq/qDaPdbeY3757uARz5Vvfv+cY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:YUWgXUFRPfoYK1IHMuxH5K6nPEXSCzIMljnQ59lLRCk= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=