From f590d6786f61ac91380507e56fe3062faeae14c7 Mon Sep 17 00:00:00 2001 From: Parth Bansal Date: Mon, 23 Jun 2025 15:34:09 +0000 Subject: [PATCH 1/4] Update CLI to latest API Definitions --- .codegen/_openapi_sha | 2 +- .gitattributes | 3 +- NEXT_CHANGELOG.md | 3 + .../internal/schema/annotations_openapi.yml | 44 +- .../schema/annotations_openapi_overrides.yml | 3 + bundle/schema/jsonschema.json | 73 ++- cmd/account/log-delivery/log-delivery.go | 69 ++- .../service-principal-federation-policy.go | 10 + cmd/workspace/ai-builder/ai-builder.go | 432 +++++++++++++++++ cmd/workspace/clusters/clusters.go | 4 + cmd/workspace/cmd.go | 6 +- .../consumer-listings/consumer-listings.go | 2 +- .../consumer-providers/consumer-providers.go | 2 +- cmd/workspace/custom-llms/custom-llms.go | 287 ----------- .../dashboard-widgets/dashboard-widgets.go | 8 +- cmd/workspace/database/database.go | 7 +- cmd/workspace/experiments/experiments.go | 17 +- cmd/workspace/feature-store/feature-store.go | 449 ++++++++++++++++++ .../instance-pools/instance-pools.go | 4 + cmd/workspace/jobs/jobs.go | 4 +- cmd/workspace/pipelines/pipelines.go | 1 + .../provider-exchanges/provider-exchanges.go | 4 +- .../provider-provider-analytics-dashboards.go | 10 +- cmd/workspace/shares/shares.go | 4 +- .../storage-credentials.go | 63 +-- .../vector-search-indexes.go | 4 - go.mod | 47 +- go.sum | 199 +++----- .../google/yamlfmt/cmd/yamlfmt/config.go | 349 ++++++++++++++ .../google/yamlfmt/cmd/yamlfmt/flags.go | 128 +++++ .../google/yamlfmt/cmd/yamlfmt/main.go | 85 ++++ 31 files changed, 1782 insertions(+), 541 deletions(-) create mode 100755 cmd/workspace/ai-builder/ai-builder.go delete mode 100755 cmd/workspace/custom-llms/custom-llms.go create mode 100755 cmd/workspace/feature-store/feature-store.go create mode 100644 vendor/github.com/google/yamlfmt/cmd/yamlfmt/config.go create mode 100644 vendor/github.com/google/yamlfmt/cmd/yamlfmt/flags.go create mode 100644 vendor/github.com/google/yamlfmt/cmd/yamlfmt/main.go diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index ac1c24d104..3fbd741428 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -a8f547d3728fba835fbdda301e846829c5cbbef5 \ No newline at end of file +033bcb9242b006001e2cf3956896711681de1a8c \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 66a1ee60c5..a3d20d7603 100755 --- a/.gitattributes +++ b/.gitattributes @@ -38,6 +38,7 @@ cmd/account/workspace-assignment/workspace-assignment.go linguist-generated=true cmd/account/workspace-network-configuration/workspace-network-configuration.go linguist-generated=true cmd/account/workspaces/workspaces.go linguist-generated=true cmd/workspace/access-control/access-control.go linguist-generated=true +cmd/workspace/ai-builder/ai-builder.go linguist-generated=true cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go linguist-generated=true cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go linguist-generated=true cmd/workspace/alerts-legacy/alerts-legacy.go linguist-generated=true @@ -63,7 +64,6 @@ cmd/workspace/consumer-providers/consumer-providers.go linguist-generated=true cmd/workspace/credentials-manager/credentials-manager.go linguist-generated=true cmd/workspace/credentials/credentials.go linguist-generated=true cmd/workspace/current-user/current-user.go linguist-generated=true -cmd/workspace/custom-llms/custom-llms.go linguist-generated=true cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go linguist-generated=true cmd/workspace/dashboard-widgets/dashboard-widgets.go linguist-generated=true cmd/workspace/dashboards/dashboards.go linguist-generated=true @@ -78,6 +78,7 @@ cmd/workspace/enable-results-downloading/enable-results-downloading.go linguist- cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go linguist-generated=true cmd/workspace/experiments/experiments.go linguist-generated=true cmd/workspace/external-locations/external-locations.go linguist-generated=true +cmd/workspace/feature-store/feature-store.go linguist-generated=true cmd/workspace/forecasting/forecasting.go linguist-generated=true cmd/workspace/functions/functions.go linguist-generated=true cmd/workspace/genie/genie.go linguist-generated=true diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 4b0d91b2dc..e68240a432 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -13,3 +13,6 @@ ](https://docs.databricks.com/dev-tools/bundles/python). ([#3102](https://github.com/databricks/cli/pull/3102)) ### API Changes +* Removed `databricks custom-llms` command group. +* Added `databricks ai-builder` command group. +* Added `databricks feature-store` command group. diff --git a/bundle/internal/schema/annotations_openapi.yml b/bundle/internal/schema/annotations_openapi.yml index 3f84637d46..7ab7cbc9ca 100644 --- a/bundle/internal/schema/annotations_openapi.yml +++ b/bundle/internal/schema/annotations_openapi.yml @@ -192,6 +192,9 @@ github.com/databricks/cli/bundle/config/resources.Cluster: "policy_id": "description": |- The ID of the cluster policy used to create the cluster if applicable. + "remote_disk_throughput": + "description": |- + If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED disks. "runtime_engine": "description": |- Determines the cluster's runtime engine, either standard or Photon. @@ -232,6 +235,9 @@ github.com/databricks/cli/bundle/config/resources.Cluster: SSH public key contents that will be added to each Spark node in this cluster. The corresponding private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can be specified. + "total_initial_remote_disk_size": + "description": |- + If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED disks. "use_ml_runtime": "description": |- This field can only be used when `kind = CLASSIC_PREVIEW`. @@ -477,6 +483,11 @@ github.com/databricks/cli/bundle/config/resources.Pipeline: "edition": "description": |- Pipeline product edition. + "environment": + "description": |- + Environment specification for this pipeline used to install dependencies. + "x-databricks-preview": |- + PRIVATE "event_log": "description": |- Event log configuration for this pipeline @@ -1300,6 +1311,9 @@ github.com/databricks/databricks-sdk-go/service/compute.ClusterSpec: "policy_id": "description": |- The ID of the cluster policy used to create the cluster if applicable. + "remote_disk_throughput": + "description": |- + If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED disks. "runtime_engine": "description": |- Determines the cluster's runtime engine, either standard or Photon. @@ -1340,6 +1354,9 @@ github.com/databricks/databricks-sdk-go/service/compute.ClusterSpec: SSH public key contents that will be added to each Spark node in this cluster. The corresponding private keys can be used to login with the user name `ubuntu` on port `2200`. Up to 10 keys can be specified. + "total_initial_remote_disk_size": + "description": |- + If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED disks. "use_ml_runtime": "description": |- This field can only be used when `kind = CLASSIC_PREVIEW`. @@ -1788,12 +1805,22 @@ github.com/databricks/databricks-sdk-go/service/jobs.DashboardTask: Optional: The warehouse id to execute the dashboard with for the schedule. If not specified, the default warehouse of the dashboard will be used. github.com/databricks/databricks-sdk-go/service/jobs.DbtCloudTask: + "_": + "description": |- + Deprecated in favor of DbtPlatformTask "connection_resource_name": "description": |- The resource name of the UC connection that authenticates the dbt Cloud for this task "dbt_cloud_job_id": "description": |- Id of the dbt Cloud job to be triggered +github.com/databricks/databricks-sdk-go/service/jobs.DbtPlatformTask: + "connection_resource_name": + "description": |- + The resource name of the UC connection that authenticates the dbt platform for this task + "dbt_platform_job_id": + "description": |- + Id of the dbt platform job to be triggered. Specified as a string for maximum compatibility with clients. github.com/databricks/databricks-sdk-go/service/jobs.DbtTask: "catalog": "description": |- @@ -2549,7 +2576,12 @@ github.com/databricks/databricks-sdk-go/service/jobs.Task: The task refreshes a dashboard and sends a snapshot to subscribers. "dbt_cloud_task": "description": |- - Task type for dbt cloud + Task type for dbt cloud, deprecated in favor of the new name dbt_platform_task + "deprecation_message": |- + This field is deprecated + "x-databricks-preview": |- + PRIVATE + "dbt_platform_task": "x-databricks-preview": |- PRIVATE "dbt_task": @@ -3083,6 +3115,16 @@ github.com/databricks/databricks-sdk-go/service/pipelines.PipelineLibrary: github.com/databricks/databricks-sdk-go/service/pipelines.PipelineTrigger: "cron": {} "manual": {} +github.com/databricks/databricks-sdk-go/service/pipelines.PipelinesEnvironment: + "_": + "description": |- + The environment entity used to preserve serverless environment side panel, jobs' environment for non-notebook task, and DLT's environment for classic and serverless pipelines. + In this minimal environment spec, only pip dependencies are supported. + "dependencies": + "description": |- + List of pip dependencies, as supported by the version of pip in this environment. + Each dependency is a pip requirement file line https://pip.pypa.io/en/stable/reference/requirements-file-format/ + Allowed dependency could be , , (WSFS or Volumes in Databricks), github.com/databricks/databricks-sdk-go/service/pipelines.ReportSpec: "destination_catalog": "description": |- diff --git a/bundle/internal/schema/annotations_openapi_overrides.yml b/bundle/internal/schema/annotations_openapi_overrides.yml index f9bf48448b..b9347d9ccc 100644 --- a/bundle/internal/schema/annotations_openapi_overrides.yml +++ b/bundle/internal/schema/annotations_openapi_overrides.yml @@ -665,6 +665,9 @@ github.com/databricks/databricks-sdk-go/service/jobs.SubscriptionSubscriber: "description": |- PLACEHOLDER github.com/databricks/databricks-sdk-go/service/jobs.Task: + "dbt_platform_task": + "description": |- + PLACEHOLDER "gen_ai_compute_task": "description": |- PLACEHOLDER diff --git a/bundle/schema/jsonschema.json b/bundle/schema/jsonschema.json index 74779e0640..e91c2b7424 100644 --- a/bundle/schema/jsonschema.json +++ b/bundle/schema/jsonschema.json @@ -306,6 +306,10 @@ "description": "The ID of the cluster policy used to create the cluster if applicable.", "$ref": "#/$defs/string" }, + "remote_disk_throughput": { + "description": "If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED disks.", + "$ref": "#/$defs/int" + }, "runtime_engine": { "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.RuntimeEngine" }, @@ -329,6 +333,10 @@ "description": "SSH public key contents that will be added to each Spark node in this cluster. The\ncorresponding private keys can be used to login with the user name `ubuntu` on port `2200`.\nUp to 10 keys can be specified.", "$ref": "#/$defs/slice/string" }, + "total_initial_remote_disk_size": { + "description": "If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED disks.", + "$ref": "#/$defs/int" + }, "use_ml_runtime": { "description": "This field can only be used when `kind = CLASSIC_PREVIEW`.\n\n`effective_spark_version` is determined by `spark_version` (DBR release), this field `use_ml_runtime`, and whether `node_type_id` is gpu node or not.", "$ref": "#/$defs/bool" @@ -1013,6 +1021,12 @@ "description": "Pipeline product edition.", "$ref": "#/$defs/string" }, + "environment": { + "description": "Environment specification for this pipeline used to install dependencies.", + "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/pipelines.PipelinesEnvironment", + "x-databricks-preview": "PRIVATE", + "doNotSuggest": true + }, "event_log": { "description": "Event log configuration for this pipeline", "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/pipelines.EventLogSpec" @@ -3174,6 +3188,10 @@ "description": "The ID of the cluster policy used to create the cluster if applicable.", "$ref": "#/$defs/string" }, + "remote_disk_throughput": { + "description": "If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED disks.", + "$ref": "#/$defs/int" + }, "runtime_engine": { "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.RuntimeEngine" }, @@ -3197,6 +3215,10 @@ "description": "SSH public key contents that will be added to each Spark node in this cluster. The\ncorresponding private keys can be used to login with the user name `ubuntu` on port `2200`.\nUp to 10 keys can be specified.", "$ref": "#/$defs/slice/string" }, + "total_initial_remote_disk_size": { + "description": "If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED disks.", + "$ref": "#/$defs/int" + }, "use_ml_runtime": { "description": "This field can only be used when `kind = CLASSIC_PREVIEW`.\n\n`effective_spark_version` is determined by `spark_version` (DBR release), this field `use_ml_runtime`, and whether `node_type_id` is gpu node or not.", "$ref": "#/$defs/bool" @@ -4010,6 +4032,7 @@ "oneOf": [ { "type": "object", + "description": "Deprecated in favor of DbtPlatformTask", "properties": { "connection_resource_name": { "description": "The resource name of the UC connection that authenticates the dbt Cloud for this task", @@ -4028,6 +4051,28 @@ } ] }, + "jobs.DbtPlatformTask": { + "oneOf": [ + { + "type": "object", + "properties": { + "connection_resource_name": { + "description": "The resource name of the UC connection that authenticates the dbt platform for this task", + "$ref": "#/$defs/string" + }, + "dbt_platform_job_id": { + "description": "Id of the dbt platform job to be triggered. Specified as a string for maximum compatibility with clients.", + "$ref": "#/$defs/string" + } + }, + "additionalProperties": false + }, + { + "type": "string", + "pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}" + } + ] + }, "jobs.DbtTask": { "oneOf": [ { @@ -5402,9 +5447,16 @@ "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/jobs.DashboardTask" }, "dbt_cloud_task": { - "description": "Task type for dbt cloud", + "description": "Task type for dbt cloud, deprecated in favor of the new name dbt_platform_task", "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/jobs.DbtCloudTask", "x-databricks-preview": "PRIVATE", + "deprecationMessage": "This field is deprecated", + "doNotSuggest": true, + "deprecated": true + }, + "dbt_platform_task": { + "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/jobs.DbtPlatformTask", + "x-databricks-preview": "PRIVATE", "doNotSuggest": true }, "dbt_task": { @@ -6315,6 +6367,25 @@ } ] }, + "pipelines.PipelinesEnvironment": { + "oneOf": [ + { + "type": "object", + "description": "The environment entity used to preserve serverless environment side panel, jobs' environment for non-notebook task, and DLT's environment for classic and serverless pipelines.\nIn this minimal environment spec, only pip dependencies are supported.", + "properties": { + "dependencies": { + "description": "List of pip dependencies, as supported by the version of pip in this environment.\nEach dependency is a pip requirement file line https://pip.pypa.io/en/stable/reference/requirements-file-format/\nAllowed dependency could be \u003crequirement specifier\u003e, \u003carchive url/path\u003e, \u003clocal project path\u003e(WSFS or Volumes in Databricks), \u003cvcs project url\u003e", + "$ref": "#/$defs/slice/string" + } + }, + "additionalProperties": false + }, + { + "type": "string", + "pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}" + } + ] + }, "pipelines.ReportSpec": { "oneOf": [ { diff --git a/cmd/account/log-delivery/log-delivery.go b/cmd/account/log-delivery/log-delivery.go index 036ea0c449..1d79a867f4 100755 --- a/cmd/account/log-delivery/log-delivery.go +++ b/cmd/account/log-delivery/log-delivery.go @@ -20,10 +20,71 @@ var cmdOverrides []func(*cobra.Command) func New() *cobra.Command { cmd := &cobra.Command{ Use: "log-delivery", - Short: `These APIs manage Log delivery configurations for this account.`, - Long: `These APIs manage Log delivery configurations for this account. Log delivery - configs enable you to configure the delivery of the specified type of logs to - your storage account.`, + Short: `These APIs manage log delivery configurations for this account.`, + Long: `These APIs manage log delivery configurations for this account. The two + supported log types for this API are _billable usage logs_ and _audit logs_. + This feature is in Public Preview. This feature works with all account ID + types. + + Log delivery works with all account types. However, if your account is on the + E2 version of the platform or on a select custom plan that allows multiple + workspaces per account, you can optionally configure different storage + destinations for each workspace. Log delivery status is also provided to know + the latest status of log delivery attempts. + + The high-level flow of billable usage delivery: + + 1. **Create storage**: In AWS, [create a new AWS S3 bucket] with a specific + bucket policy. Using Databricks APIs, call the Account API to create a + [storage configuration object](:method:Storage/Create) that uses the bucket + name. + + 2. **Create credentials**: In AWS, create the appropriate AWS IAM role. For + full details, including the required IAM role policies and trust relationship, + see [Billable usage log delivery]. Using Databricks APIs, call the Account API + to create a [credential configuration object](:method:Credentials/Create) that + uses the IAM role's ARN. + + 3. **Create log delivery configuration**: Using Databricks APIs, call the + Account API to [create a log delivery + configuration](:method:LogDelivery/Create) that uses the credential and + storage configuration objects from previous steps. You can specify if the logs + should include all events of that log type in your account (_Account level_ + delivery) or only events for a specific set of workspaces (_workspace level_ + delivery). Account level log delivery applies to all current and future + workspaces plus account level logs, while workspace level log delivery solely + delivers logs related to the specified workspaces. You can create multiple + types of delivery configurations per account. + + For billable usage delivery: * For more information about billable usage logs, + see [Billable usage log delivery]. For the CSV schema, see the [Usage page]. * + The delivery location is //billable-usage/csv/, where + is the name of the optional delivery path prefix you set up during + log delivery configuration. Files are named + workspaceId=-usageMonth=.csv. * All billable usage logs + apply to specific workspaces (_workspace level_ logs). You can aggregate usage + for your entire account by creating an _account level_ delivery configuration + that delivers logs for all current and future workspaces in your account. * + The files are delivered daily by overwriting the month's CSV file for each + workspace. + + For audit log delivery: * For more information about about audit log delivery, + see [Audit log delivery], which includes information about the used JSON + schema. * The delivery location is + //workspaceId=/date=/auditlogs_.json. + Files may get overwritten with the same content multiple times to achieve + exactly-once delivery. * If the audit log delivery configuration included + specific workspace IDs, only _workspace-level_ audit logs for those workspaces + are delivered. If the log delivery configuration applies to the entire account + (_account level_ delivery configuration), the audit log delivery includes + workspace-level audit logs for all workspaces in the account as well as + account-level audit logs. See [Audit log delivery] for details. * Auditable + events are typically available in logs within 15 minutes. + + [Audit log delivery]: https://docs.databricks.com/administration-guide/account-settings/audit-logs.html + [Billable usage log delivery]: https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html + [Usage page]: https://docs.databricks.com/administration-guide/account-settings/usage.html + [create a new AWS S3 bucket]: https://docs.databricks.com/administration-guide/account-api/aws-storage.html`, GroupID: "billing", Annotations: map[string]string{ "package": "billing", diff --git a/cmd/account/service-principal-federation-policy/service-principal-federation-policy.go b/cmd/account/service-principal-federation-policy/service-principal-federation-policy.go index abd425acc5..269ca6bd3c 100755 --- a/cmd/account/service-principal-federation-policy/service-principal-federation-policy.go +++ b/cmd/account/service-principal-federation-policy/service-principal-federation-policy.go @@ -124,6 +124,8 @@ func newCreate() *cobra.Command { cmd.Use = "create SERVICE_PRINCIPAL_ID" cmd.Short = `Create service principal federation policy.` cmd.Long = `Create service principal federation policy. + + Create account federation policy. Arguments: SERVICE_PRINCIPAL_ID: The service principal id for the federation policy.` @@ -195,6 +197,8 @@ func newDelete() *cobra.Command { cmd.Use = "delete SERVICE_PRINCIPAL_ID POLICY_ID" cmd.Short = `Delete service principal federation policy.` cmd.Long = `Delete service principal federation policy. + + Delete account federation policy. Arguments: SERVICE_PRINCIPAL_ID: The service principal id for the federation policy. @@ -256,6 +260,8 @@ func newGet() *cobra.Command { cmd.Use = "get SERVICE_PRINCIPAL_ID POLICY_ID" cmd.Short = `Get service principal federation policy.` cmd.Long = `Get service principal federation policy. + + Get account federation policy. Arguments: SERVICE_PRINCIPAL_ID: The service principal id for the federation policy. @@ -320,6 +326,8 @@ func newList() *cobra.Command { cmd.Use = "list SERVICE_PRINCIPAL_ID" cmd.Short = `List service principal federation policies.` cmd.Long = `List service principal federation policies. + + List account federation policies. Arguments: SERVICE_PRINCIPAL_ID: The service principal id for the federation policy.` @@ -384,6 +392,8 @@ func newUpdate() *cobra.Command { cmd.Use = "update SERVICE_PRINCIPAL_ID POLICY_ID" cmd.Short = `Update service principal federation policy.` cmd.Long = `Update service principal federation policy. + + Update account federation policy. Arguments: SERVICE_PRINCIPAL_ID: The service principal id for the federation policy. diff --git a/cmd/workspace/ai-builder/ai-builder.go b/cmd/workspace/ai-builder/ai-builder.go new file mode 100755 index 0000000000..ab8c40e092 --- /dev/null +++ b/cmd/workspace/ai-builder/ai-builder.go @@ -0,0 +1,432 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package ai_builder + +import ( + "fmt" + + "github.com/databricks/cli/cmd/root" + "github.com/databricks/cli/libs/cmdctx" + "github.com/databricks/cli/libs/cmdio" + "github.com/databricks/cli/libs/flags" + "github.com/databricks/databricks-sdk-go/service/aibuilder" + "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: "ai-builder", + Short: `The Custom LLMs service manages state and powers the UI for the Custom LLM product.`, + Long: `The Custom LLMs service manages state and powers the UI for the Custom LLM + product.`, + GroupID: "aibuilder", + Annotations: map[string]string{ + "package": "aibuilder", + }, + + // This service is being previewed; hide from help output. + Hidden: true, + RunE: root.ReportUnknownSubcommand, + } + + // Add methods + cmd.AddCommand(newCancelOptimize()) + cmd.AddCommand(newCreateCustomLlm()) + cmd.AddCommand(newDeleteCustomLlm()) + cmd.AddCommand(newGetCustomLlm()) + cmd.AddCommand(newStartOptimize()) + cmd.AddCommand(newUpdateCustomLlm()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start cancel-optimize 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 cancelOptimizeOverrides []func( + *cobra.Command, + *aibuilder.CancelCustomLlmOptimizationRunRequest, +) + +func newCancelOptimize() *cobra.Command { + cmd := &cobra.Command{} + + var cancelOptimizeReq aibuilder.CancelCustomLlmOptimizationRunRequest + + // TODO: short flags + + cmd.Use = "cancel-optimize ID" + cmd.Short = `Cancel a Custom LLM Optimization Run.` + cmd.Long = `Cancel a Custom LLM Optimization Run.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + cancelOptimizeReq.Id = args[0] + + err = w.AiBuilder.CancelOptimize(ctx, cancelOptimizeReq) + if err != nil { + return err + } + return nil + } + + // 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 cancelOptimizeOverrides { + fn(cmd, &cancelOptimizeReq) + } + + return cmd +} + +// start create-custom-llm 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 createCustomLlmOverrides []func( + *cobra.Command, + *aibuilder.CreateCustomLlmRequest, +) + +func newCreateCustomLlm() *cobra.Command { + cmd := &cobra.Command{} + + var createCustomLlmReq aibuilder.CreateCustomLlmRequest + var createCustomLlmJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&createCustomLlmJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().StringVar(&createCustomLlmReq.AgentArtifactPath, "agent-artifact-path", createCustomLlmReq.AgentArtifactPath, `Optional: UC path for agent artifacts.`) + // TODO: array: datasets + // TODO: array: guidelines + + cmd.Use = "create-custom-llm NAME INSTRUCTIONS" + cmd.Short = `Create a Custom LLM.` + cmd.Long = `Create a Custom LLM. + + Arguments: + NAME: Name of the custom LLM. Only alphanumeric characters and dashes allowed. + INSTRUCTIONS: Instructions for the custom LLM to follow` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + if cmd.Flags().Changed("json") { + err := root.ExactArgs(0)(cmd, args) + if err != nil { + return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'instructions' in your JSON input") + } + return nil + } + check := root.ExactArgs(2) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := createCustomLlmJson.Unmarshal(&createCustomLlmReq) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + if !cmd.Flags().Changed("json") { + createCustomLlmReq.Name = args[0] + } + if !cmd.Flags().Changed("json") { + createCustomLlmReq.Instructions = args[1] + } + + response, err := w.AiBuilder.CreateCustomLlm(ctx, createCustomLlmReq) + 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 createCustomLlmOverrides { + fn(cmd, &createCustomLlmReq) + } + + return cmd +} + +// start delete-custom-llm 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 deleteCustomLlmOverrides []func( + *cobra.Command, + *aibuilder.DeleteCustomLlmRequest, +) + +func newDeleteCustomLlm() *cobra.Command { + cmd := &cobra.Command{} + + var deleteCustomLlmReq aibuilder.DeleteCustomLlmRequest + + // TODO: short flags + + cmd.Use = "delete-custom-llm ID" + cmd.Short = `Delete a Custom LLM.` + cmd.Long = `Delete a Custom LLM. + + Arguments: + ID: The id of the custom llm` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + deleteCustomLlmReq.Id = args[0] + + err = w.AiBuilder.DeleteCustomLlm(ctx, deleteCustomLlmReq) + if err != nil { + return err + } + return nil + } + + // 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 deleteCustomLlmOverrides { + fn(cmd, &deleteCustomLlmReq) + } + + return cmd +} + +// start get-custom-llm 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 getCustomLlmOverrides []func( + *cobra.Command, + *aibuilder.GetCustomLlmRequest, +) + +func newGetCustomLlm() *cobra.Command { + cmd := &cobra.Command{} + + var getCustomLlmReq aibuilder.GetCustomLlmRequest + + // TODO: short flags + + cmd.Use = "get-custom-llm ID" + cmd.Short = `Get a Custom LLM.` + cmd.Long = `Get a Custom LLM. + + Arguments: + ID: The id of the custom llm` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + getCustomLlmReq.Id = args[0] + + response, err := w.AiBuilder.GetCustomLlm(ctx, getCustomLlmReq) + 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 getCustomLlmOverrides { + fn(cmd, &getCustomLlmReq) + } + + return cmd +} + +// start start-optimize 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 startOptimizeOverrides []func( + *cobra.Command, + *aibuilder.StartCustomLlmOptimizationRunRequest, +) + +func newStartOptimize() *cobra.Command { + cmd := &cobra.Command{} + + var startOptimizeReq aibuilder.StartCustomLlmOptimizationRunRequest + + // TODO: short flags + + cmd.Use = "start-optimize ID" + cmd.Short = `Start a Custom LLM Optimization Run.` + cmd.Long = `Start a Custom LLM Optimization Run. + + Arguments: + ID: The Id of the tile.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + startOptimizeReq.Id = args[0] + + response, err := w.AiBuilder.StartOptimize(ctx, startOptimizeReq) + 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 startOptimizeOverrides { + fn(cmd, &startOptimizeReq) + } + + return cmd +} + +// start update-custom-llm 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 updateCustomLlmOverrides []func( + *cobra.Command, + *aibuilder.UpdateCustomLlmRequest, +) + +func newUpdateCustomLlm() *cobra.Command { + cmd := &cobra.Command{} + + var updateCustomLlmReq aibuilder.UpdateCustomLlmRequest + var updateCustomLlmJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateCustomLlmJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "update-custom-llm ID" + cmd.Short = `Update a Custom LLM.` + cmd.Long = `Update a Custom LLM. + + Arguments: + ID: The id of the custom llm` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := updateCustomLlmJson.Unmarshal(&updateCustomLlmReq) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } else { + return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + } + updateCustomLlmReq.Id = args[0] + + response, err := w.AiBuilder.UpdateCustomLlm(ctx, updateCustomLlmReq) + 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 updateCustomLlmOverrides { + fn(cmd, &updateCustomLlmReq) + } + + return cmd +} + +// end service AiBuilder diff --git a/cmd/workspace/clusters/clusters.go b/cmd/workspace/clusters/clusters.go index 24887ca155..fd01c887d8 100755 --- a/cmd/workspace/clusters/clusters.go +++ b/cmd/workspace/clusters/clusters.go @@ -230,11 +230,13 @@ func newCreate() *cobra.Command { cmd.Flags().StringVar(&createReq.NodeTypeId, "node-type-id", createReq.NodeTypeId, `This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster.`) cmd.Flags().IntVar(&createReq.NumWorkers, "num-workers", createReq.NumWorkers, `Number of worker nodes that this cluster should have.`) cmd.Flags().StringVar(&createReq.PolicyId, "policy-id", createReq.PolicyId, `The ID of the cluster policy used to create the cluster if applicable.`) + cmd.Flags().IntVar(&createReq.RemoteDiskThroughput, "remote-disk-throughput", createReq.RemoteDiskThroughput, `If set, what the configurable throughput (in Mb/s) for the remote disk is.`) cmd.Flags().Var(&createReq.RuntimeEngine, "runtime-engine", `Determines the cluster's runtime engine, either standard or Photon. Supported values: [NULL, PHOTON, STANDARD]`) cmd.Flags().StringVar(&createReq.SingleUserName, "single-user-name", createReq.SingleUserName, `Single user name if data_security_mode is SINGLE_USER.`) // TODO: map via StringToStringVar: spark_conf // TODO: map via StringToStringVar: spark_env_vars // TODO: array: ssh_public_keys + cmd.Flags().IntVar(&createReq.TotalInitialRemoteDiskSize, "total-initial-remote-disk-size", createReq.TotalInitialRemoteDiskSize, `If set, what the total initial volume size (in GB) of the remote disks should be.`) cmd.Flags().BoolVar(&createReq.UseMlRuntime, "use-ml-runtime", createReq.UseMlRuntime, `This field can only be used when kind = CLASSIC_PREVIEW.`) // TODO: complex arg: workload_type @@ -503,11 +505,13 @@ func newEdit() *cobra.Command { cmd.Flags().StringVar(&editReq.NodeTypeId, "node-type-id", editReq.NodeTypeId, `This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster.`) cmd.Flags().IntVar(&editReq.NumWorkers, "num-workers", editReq.NumWorkers, `Number of worker nodes that this cluster should have.`) cmd.Flags().StringVar(&editReq.PolicyId, "policy-id", editReq.PolicyId, `The ID of the cluster policy used to create the cluster if applicable.`) + cmd.Flags().IntVar(&editReq.RemoteDiskThroughput, "remote-disk-throughput", editReq.RemoteDiskThroughput, `If set, what the configurable throughput (in Mb/s) for the remote disk is.`) cmd.Flags().Var(&editReq.RuntimeEngine, "runtime-engine", `Determines the cluster's runtime engine, either standard or Photon. Supported values: [NULL, PHOTON, STANDARD]`) cmd.Flags().StringVar(&editReq.SingleUserName, "single-user-name", editReq.SingleUserName, `Single user name if data_security_mode is SINGLE_USER.`) // TODO: map via StringToStringVar: spark_conf // TODO: map via StringToStringVar: spark_env_vars // TODO: array: ssh_public_keys + cmd.Flags().IntVar(&editReq.TotalInitialRemoteDiskSize, "total-initial-remote-disk-size", editReq.TotalInitialRemoteDiskSize, `If set, what the total initial volume size (in GB) of the remote disks should be.`) cmd.Flags().BoolVar(&editReq.UseMlRuntime, "use-ml-runtime", editReq.UseMlRuntime, `This field can only be used when kind = CLASSIC_PREVIEW.`) // TODO: complex arg: workload_type diff --git a/cmd/workspace/cmd.go b/cmd/workspace/cmd.go index 545b9c486e..e84487843d 100755 --- a/cmd/workspace/cmd.go +++ b/cmd/workspace/cmd.go @@ -4,6 +4,7 @@ package workspace import ( access_control "github.com/databricks/cli/cmd/workspace/access-control" + ai_builder "github.com/databricks/cli/cmd/workspace/ai-builder" alerts "github.com/databricks/cli/cmd/workspace/alerts" alerts_legacy "github.com/databricks/cli/cmd/workspace/alerts-legacy" alerts_v2 "github.com/databricks/cli/cmd/workspace/alerts-v2" @@ -24,13 +25,13 @@ import ( credentials "github.com/databricks/cli/cmd/workspace/credentials" credentials_manager "github.com/databricks/cli/cmd/workspace/credentials-manager" current_user "github.com/databricks/cli/cmd/workspace/current-user" - custom_llms "github.com/databricks/cli/cmd/workspace/custom-llms" dashboard_widgets "github.com/databricks/cli/cmd/workspace/dashboard-widgets" dashboards "github.com/databricks/cli/cmd/workspace/dashboards" data_sources "github.com/databricks/cli/cmd/workspace/data-sources" database "github.com/databricks/cli/cmd/workspace/database" experiments "github.com/databricks/cli/cmd/workspace/experiments" external_locations "github.com/databricks/cli/cmd/workspace/external-locations" + feature_store "github.com/databricks/cli/cmd/workspace/feature-store" forecasting "github.com/databricks/cli/cmd/workspace/forecasting" functions "github.com/databricks/cli/cmd/workspace/functions" genie "github.com/databricks/cli/cmd/workspace/genie" @@ -106,6 +107,7 @@ func All() []*cobra.Command { var out []*cobra.Command out = append(out, access_control.New()) + out = append(out, ai_builder.New()) out = append(out, alerts.New()) out = append(out, alerts_legacy.New()) out = append(out, alerts_v2.New()) @@ -126,13 +128,13 @@ func All() []*cobra.Command { out = append(out, credentials.New()) out = append(out, credentials_manager.New()) out = append(out, current_user.New()) - out = append(out, custom_llms.New()) out = append(out, dashboard_widgets.New()) out = append(out, dashboards.New()) out = append(out, data_sources.New()) out = append(out, database.New()) out = append(out, experiments.New()) out = append(out, external_locations.New()) + out = append(out, feature_store.New()) out = append(out, functions.New()) out = append(out, genie.New()) out = append(out, git_credentials.New()) diff --git a/cmd/workspace/consumer-listings/consumer-listings.go b/cmd/workspace/consumer-listings/consumer-listings.go index 077c753522..5c4f8059de 100755 --- a/cmd/workspace/consumer-listings/consumer-listings.go +++ b/cmd/workspace/consumer-listings/consumer-listings.go @@ -62,7 +62,7 @@ func newBatchGet() *cobra.Command { // TODO: array: ids cmd.Use = "batch-get" - cmd.Short = `Get one batch of listings.` + cmd.Short = `Get one batch of listings. One may specify up to 50 IDs per request.` cmd.Long = `Get one batch of listings. One may specify up to 50 IDs per request. Batch get a published listing in the Databricks Marketplace that the consumer diff --git a/cmd/workspace/consumer-providers/consumer-providers.go b/cmd/workspace/consumer-providers/consumer-providers.go index 20a646b1e0..214364f792 100755 --- a/cmd/workspace/consumer-providers/consumer-providers.go +++ b/cmd/workspace/consumer-providers/consumer-providers.go @@ -60,7 +60,7 @@ func newBatchGet() *cobra.Command { // TODO: array: ids cmd.Use = "batch-get" - cmd.Short = `Get one batch of providers.` + cmd.Short = `Get one batch of providers. One may specify up to 50 IDs per request.` cmd.Long = `Get one batch of providers. One may specify up to 50 IDs per request. Batch get a provider in the Databricks Marketplace with at least one visible diff --git a/cmd/workspace/custom-llms/custom-llms.go b/cmd/workspace/custom-llms/custom-llms.go deleted file mode 100755 index 34ad043881..0000000000 --- a/cmd/workspace/custom-llms/custom-llms.go +++ /dev/null @@ -1,287 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package custom_llms - -import ( - "fmt" - - "github.com/databricks/cli/cmd/root" - "github.com/databricks/cli/libs/cmdctx" - "github.com/databricks/cli/libs/cmdio" - "github.com/databricks/cli/libs/flags" - "github.com/databricks/databricks-sdk-go/service/aibuilder" - "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: "custom-llms", - Short: `The Custom LLMs service manages state and powers the UI for the Custom LLM product.`, - Long: `The Custom LLMs service manages state and powers the UI for the Custom LLM - product.`, - GroupID: "aibuilder", - Annotations: map[string]string{ - "package": "aibuilder", - }, - - // This service is being previewed; hide from help output. - Hidden: true, - RunE: root.ReportUnknownSubcommand, - } - - // Add methods - cmd.AddCommand(newCancel()) - cmd.AddCommand(newCreate()) - cmd.AddCommand(newGet()) - cmd.AddCommand(newUpdate()) - - // Apply optional overrides to this command. - for _, fn := range cmdOverrides { - fn(cmd) - } - - return cmd -} - -// start cancel 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 cancelOverrides []func( - *cobra.Command, - *aibuilder.CancelCustomLlmOptimizationRunRequest, -) - -func newCancel() *cobra.Command { - cmd := &cobra.Command{} - - var cancelReq aibuilder.CancelCustomLlmOptimizationRunRequest - - // TODO: short flags - - cmd.Use = "cancel ID" - cmd.Short = `Cancel a Custom LLM Optimization Run.` - cmd.Long = `Cancel a Custom LLM Optimization Run.` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := root.ExactArgs(1) - return check(cmd, args) - } - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := cmdctx.WorkspaceClient(ctx) - - cancelReq.Id = args[0] - - err = w.CustomLlms.Cancel(ctx, cancelReq) - if err != nil { - return err - } - return nil - } - - // 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 cancelOverrides { - fn(cmd, &cancelReq) - } - - return cmd -} - -// start create 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 createOverrides []func( - *cobra.Command, - *aibuilder.StartCustomLlmOptimizationRunRequest, -) - -func newCreate() *cobra.Command { - cmd := &cobra.Command{} - - var createReq aibuilder.StartCustomLlmOptimizationRunRequest - - // TODO: short flags - - cmd.Use = "create ID" - cmd.Short = `Start a Custom LLM Optimization Run.` - cmd.Long = `Start a Custom LLM Optimization Run. - - Arguments: - ID: The Id of the tile.` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := root.ExactArgs(1) - return check(cmd, args) - } - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := cmdctx.WorkspaceClient(ctx) - - createReq.Id = args[0] - - response, err := w.CustomLlms.Create(ctx, createReq) - if err != nil { - return err - } - return cmdio.Render(ctx, response) - } - - // Disable completions since they are not applicable. - // Can be overridden by manual implementation in `override.go`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range createOverrides { - fn(cmd, &createReq) - } - - 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, - *aibuilder.GetCustomLlmRequest, -) - -func newGet() *cobra.Command { - cmd := &cobra.Command{} - - var getReq aibuilder.GetCustomLlmRequest - - // TODO: short flags - - cmd.Use = "get ID" - cmd.Short = `Get a Custom LLM.` - cmd.Long = `Get a Custom LLM. - - Arguments: - ID: The id of the custom llm` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := root.ExactArgs(1) - return check(cmd, args) - } - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := cmdctx.WorkspaceClient(ctx) - - getReq.Id = args[0] - - response, err := w.CustomLlms.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, - *aibuilder.UpdateCustomLlmRequest, -) - -func newUpdate() *cobra.Command { - cmd := &cobra.Command{} - - var updateReq aibuilder.UpdateCustomLlmRequest - 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 ID" - cmd.Short = `Update a Custom LLM.` - cmd.Long = `Update a Custom LLM. - - Arguments: - ID: The id of the custom llm` - - cmd.Annotations = make(map[string]string) - - cmd.Args = func(cmd *cobra.Command, args []string) error { - check := root.ExactArgs(1) - return check(cmd, args) - } - - cmd.PreRunE = root.MustWorkspaceClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - w := cmdctx.WorkspaceClient(ctx) - - if cmd.Flags().Changed("json") { - diags := updateJson.Unmarshal(&updateReq) - if diags.HasError() { - return diags.Error() - } - if len(diags) > 0 { - err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) - if err != nil { - return err - } - } - } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") - } - updateReq.Id = args[0] - - response, err := w.CustomLlms.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 CustomLlms diff --git a/cmd/workspace/dashboard-widgets/dashboard-widgets.go b/cmd/workspace/dashboard-widgets/dashboard-widgets.go index dc36f9687c..1b4a9779ae 100755 --- a/cmd/workspace/dashboard-widgets/dashboard-widgets.go +++ b/cmd/workspace/dashboard-widgets/dashboard-widgets.go @@ -67,7 +67,9 @@ func newCreate() *cobra.Command { cmd.Use = "create" cmd.Short = `Add widget to a dashboard.` - cmd.Long = `Add widget to a dashboard.` + cmd.Long = `Add widget to a dashboard. + + Add widget to a dashboard` cmd.Annotations = make(map[string]string) @@ -129,6 +131,8 @@ func newDelete() *cobra.Command { cmd.Use = "delete ID" cmd.Short = `Remove widget.` cmd.Long = `Remove widget. + + Remove widget Arguments: ID: Widget ID returned by :method:dashboardwidgets/create` @@ -187,6 +191,8 @@ func newUpdate() *cobra.Command { cmd.Use = "update ID" cmd.Short = `Update existing widget.` cmd.Long = `Update existing widget. + + Update existing widget Arguments: ID: Widget ID returned by :method:dashboardwidgets/create` diff --git a/cmd/workspace/database/database.go b/cmd/workspace/database/database.go index f955d5953f..0a7af919cd 100755 --- a/cmd/workspace/database/database.go +++ b/cmd/workspace/database/database.go @@ -26,10 +26,7 @@ func New() *cobra.Command { Annotations: map[string]string{ "package": "database", }, - - // This service is being previewed; hide from help output. - Hidden: true, - RunE: root.ReportUnknownSubcommand, + RunE: root.ReportUnknownSubcommand, } // Add methods @@ -469,7 +466,7 @@ func newDeleteDatabaseInstance() *cobra.Command { // TODO: short flags cmd.Flags().BoolVar(&deleteDatabaseInstanceReq.Force, "force", deleteDatabaseInstanceReq.Force, `By default, a instance cannot be deleted if it has descendant instances created via PITR.`) - cmd.Flags().BoolVar(&deleteDatabaseInstanceReq.Purge, "purge", deleteDatabaseInstanceReq.Purge, `If false, the database instance is soft deleted.`) + cmd.Flags().BoolVar(&deleteDatabaseInstanceReq.Purge, "purge", deleteDatabaseInstanceReq.Purge, `Note purge=false is in development.`) cmd.Use = "delete-database-instance NAME" cmd.Short = `Delete a Database Instance.` diff --git a/cmd/workspace/experiments/experiments.go b/cmd/workspace/experiments/experiments.go index 1f94baf770..ffa86cb9a7 100755 --- a/cmd/workspace/experiments/experiments.go +++ b/cmd/workspace/experiments/experiments.go @@ -1558,9 +1558,6 @@ func newLogInputs() *cobra.Command { cmd.Short = `Log inputs to a run.` cmd.Long = `Log inputs to a run. - **NOTE:** Experimental: This API may change or be removed in a future release - without warning. - Logs inputs, such as datasets and models, to an MLflow Run. Arguments: @@ -1826,8 +1823,11 @@ func newLogModel() *cobra.Command { cmd.Short = `Log a model.` cmd.Long = `Log a model. - **NOTE:** Experimental: This API may change or be removed in a future release - without warning.` + **Note:** the [Create a logged + model](/api/workspace/experiments/createloggedmodel) API replaces this + endpoint. + + Log a model to an MLflow Run.` cmd.Annotations = make(map[string]string) @@ -1897,9 +1897,6 @@ func newLogOutputs() *cobra.Command { cmd.Short = `Log outputs from a run.` cmd.Long = `Log outputs from a run. - **NOTE**: Experimental: This API may change or be removed in a future release - without warning. - Logs outputs, such as models, from an MLflow Run. Arguments: @@ -2646,8 +2643,8 @@ func newSetLoggedModelTags() *cobra.Command { // TODO: array: tags cmd.Use = "set-logged-model-tags MODEL_ID" - cmd.Short = `Set a tag for a logged model.` - cmd.Long = `Set a tag for a logged model. + cmd.Short = `Set tags for a logged model.` + cmd.Long = `Set tags for a logged model. Arguments: MODEL_ID: The ID of the logged model to set the tags on.` diff --git a/cmd/workspace/feature-store/feature-store.go b/cmd/workspace/feature-store/feature-store.go new file mode 100755 index 0000000000..38850a9a98 --- /dev/null +++ b/cmd/workspace/feature-store/feature-store.go @@ -0,0 +1,449 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package feature_store + +import ( + "fmt" + + "github.com/databricks/cli/cmd/root" + "github.com/databricks/cli/libs/cmdctx" + "github.com/databricks/cli/libs/cmdio" + "github.com/databricks/cli/libs/flags" + "github.com/databricks/databricks-sdk-go/service/ml" + "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: "feature-store", + Short: `A feature store is a centralized repository that enables data scientists to find and share features.`, + Long: `A feature store is a centralized repository that enables data scientists to + find and share features. Using a feature store also ensures that the code used + to compute feature values is the same during model training and when the model + is used for inference. + + An online store is a low-latency database used for feature lookup during + real-time model inference or serve feature for real-time applications.`, + GroupID: "ml", + Annotations: map[string]string{ + "package": "ml", + }, + + // This service is being previewed; hide from help output. + Hidden: true, + RunE: root.ReportUnknownSubcommand, + } + + // Add methods + cmd.AddCommand(newCreateOnlineStore()) + cmd.AddCommand(newDeleteOnlineStore()) + cmd.AddCommand(newGetOnlineStore()) + cmd.AddCommand(newListOnlineStores()) + cmd.AddCommand(newPublishTable()) + cmd.AddCommand(newUpdateOnlineStore()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start create-online-store 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 createOnlineStoreOverrides []func( + *cobra.Command, + *ml.CreateOnlineStoreRequest, +) + +func newCreateOnlineStore() *cobra.Command { + cmd := &cobra.Command{} + + var createOnlineStoreReq ml.CreateOnlineStoreRequest + createOnlineStoreReq.OnlineStore = ml.OnlineStore{} + var createOnlineStoreJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&createOnlineStoreJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().StringVar(&createOnlineStoreReq.OnlineStore.Capacity, "capacity", createOnlineStoreReq.OnlineStore.Capacity, `The capacity of the online store.`) + + cmd.Use = "create-online-store NAME" + cmd.Short = `Create an Online Feature Store.` + cmd.Long = `Create an Online Feature Store. + + Arguments: + NAME: The name of the online store. This is the unique identifier for the online + store.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + if cmd.Flags().Changed("json") { + err := root.ExactArgs(0)(cmd, args) + if err != nil { + return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") + } + return nil + } + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := createOnlineStoreJson.Unmarshal(&createOnlineStoreReq.OnlineStore) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + if !cmd.Flags().Changed("json") { + createOnlineStoreReq.OnlineStore.Name = args[0] + } + + response, err := w.FeatureStore.CreateOnlineStore(ctx, createOnlineStoreReq) + 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 createOnlineStoreOverrides { + fn(cmd, &createOnlineStoreReq) + } + + return cmd +} + +// start delete-online-store 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 deleteOnlineStoreOverrides []func( + *cobra.Command, + *ml.DeleteOnlineStoreRequest, +) + +func newDeleteOnlineStore() *cobra.Command { + cmd := &cobra.Command{} + + var deleteOnlineStoreReq ml.DeleteOnlineStoreRequest + + // TODO: short flags + + cmd.Use = "delete-online-store NAME" + cmd.Short = `Delete an Online Feature Store.` + cmd.Long = `Delete an Online Feature Store. + + Arguments: + NAME: Name of the online store to delete.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + deleteOnlineStoreReq.Name = args[0] + + err = w.FeatureStore.DeleteOnlineStore(ctx, deleteOnlineStoreReq) + if err != nil { + return err + } + return nil + } + + // 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 deleteOnlineStoreOverrides { + fn(cmd, &deleteOnlineStoreReq) + } + + return cmd +} + +// start get-online-store 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 getOnlineStoreOverrides []func( + *cobra.Command, + *ml.GetOnlineStoreRequest, +) + +func newGetOnlineStore() *cobra.Command { + cmd := &cobra.Command{} + + var getOnlineStoreReq ml.GetOnlineStoreRequest + + // TODO: short flags + + cmd.Use = "get-online-store NAME" + cmd.Short = `Get an Online Feature Store.` + cmd.Long = `Get an Online Feature Store. + + Arguments: + NAME: Name of the online store to get.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + getOnlineStoreReq.Name = args[0] + + response, err := w.FeatureStore.GetOnlineStore(ctx, getOnlineStoreReq) + 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 getOnlineStoreOverrides { + fn(cmd, &getOnlineStoreReq) + } + + return cmd +} + +// start list-online-stores 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 listOnlineStoresOverrides []func( + *cobra.Command, + *ml.ListOnlineStoresRequest, +) + +func newListOnlineStores() *cobra.Command { + cmd := &cobra.Command{} + + var listOnlineStoresReq ml.ListOnlineStoresRequest + + // TODO: short flags + + cmd.Flags().IntVar(&listOnlineStoresReq.PageSize, "page-size", listOnlineStoresReq.PageSize, `The maximum number of results to return.`) + cmd.Flags().StringVar(&listOnlineStoresReq.PageToken, "page-token", listOnlineStoresReq.PageToken, `Pagination token to go to the next page based on a previous query.`) + + cmd.Use = "list-online-stores" + cmd.Short = `List Online Feature Stores.` + cmd.Long = `List Online Feature Stores.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + response := w.FeatureStore.ListOnlineStores(ctx, listOnlineStoresReq) + return cmdio.RenderIterator(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 listOnlineStoresOverrides { + fn(cmd, &listOnlineStoresReq) + } + + return cmd +} + +// start publish-table 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 publishTableOverrides []func( + *cobra.Command, + *ml.PublishTableRequest, +) + +func newPublishTable() *cobra.Command { + cmd := &cobra.Command{} + + var publishTableReq ml.PublishTableRequest + var publishTableJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&publishTableJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "publish-table SOURCE_TABLE_NAME" + cmd.Short = `Publish features.` + cmd.Long = `Publish features. + + Arguments: + SOURCE_TABLE_NAME: The full three-part (catalog, schema, table) name of the source table.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := publishTableJson.Unmarshal(&publishTableReq) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } else { + return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + } + publishTableReq.SourceTableName = args[0] + + response, err := w.FeatureStore.PublishTable(ctx, publishTableReq) + 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 publishTableOverrides { + fn(cmd, &publishTableReq) + } + + return cmd +} + +// start update-online-store 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 updateOnlineStoreOverrides []func( + *cobra.Command, + *ml.UpdateOnlineStoreRequest, +) + +func newUpdateOnlineStore() *cobra.Command { + cmd := &cobra.Command{} + + var updateOnlineStoreReq ml.UpdateOnlineStoreRequest + updateOnlineStoreReq.OnlineStore = ml.OnlineStore{} + var updateOnlineStoreJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateOnlineStoreJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().StringVar(&updateOnlineStoreReq.OnlineStore.Capacity, "capacity", updateOnlineStoreReq.OnlineStore.Capacity, `The capacity of the online store.`) + + cmd.Use = "update-online-store NAME" + cmd.Short = `Update an Online Feature Store.` + cmd.Long = `Update an Online Feature Store. + + Arguments: + NAME: The name of the online store. This is the unique identifier for the online + store.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := updateOnlineStoreJson.Unmarshal(&updateOnlineStoreReq.OnlineStore) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + updateOnlineStoreReq.Name = args[0] + + response, err := w.FeatureStore.UpdateOnlineStore(ctx, updateOnlineStoreReq) + 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 updateOnlineStoreOverrides { + fn(cmd, &updateOnlineStoreReq) + } + + return cmd +} + +// end service FeatureStore diff --git a/cmd/workspace/instance-pools/instance-pools.go b/cmd/workspace/instance-pools/instance-pools.go index 4bf23399f4..a0db2e5ad5 100755 --- a/cmd/workspace/instance-pools/instance-pools.go +++ b/cmd/workspace/instance-pools/instance-pools.go @@ -94,6 +94,8 @@ func newCreate() *cobra.Command { cmd.Flags().IntVar(&createReq.MinIdleInstances, "min-idle-instances", createReq.MinIdleInstances, `Minimum number of idle instances to keep in the instance pool.`) // TODO: array: preloaded_docker_images // TODO: array: preloaded_spark_versions + cmd.Flags().IntVar(&createReq.RemoteDiskThroughput, "remote-disk-throughput", createReq.RemoteDiskThroughput, `If set, what the configurable throughput (in Mb/s) for the remote disk is.`) + cmd.Flags().IntVar(&createReq.TotalInitialRemoteDiskSize, "total-initial-remote-disk-size", createReq.TotalInitialRemoteDiskSize, `If set, what the total initial volume size (in GB) of the remote disks should be.`) cmd.Use = "create INSTANCE_POOL_NAME NODE_TYPE_ID" cmd.Short = `Create a new instance pool.` @@ -286,6 +288,8 @@ func newEdit() *cobra.Command { cmd.Flags().IntVar(&editReq.IdleInstanceAutoterminationMinutes, "idle-instance-autotermination-minutes", editReq.IdleInstanceAutoterminationMinutes, `Automatically terminates the extra instances in the pool cache after they are inactive for this time in minutes if min_idle_instances requirement is already met.`) cmd.Flags().IntVar(&editReq.MaxCapacity, "max-capacity", editReq.MaxCapacity, `Maximum number of outstanding instances to keep in the pool, including both instances used by clusters and idle instances.`) cmd.Flags().IntVar(&editReq.MinIdleInstances, "min-idle-instances", editReq.MinIdleInstances, `Minimum number of idle instances to keep in the instance pool.`) + cmd.Flags().IntVar(&editReq.RemoteDiskThroughput, "remote-disk-throughput", editReq.RemoteDiskThroughput, `If set, what the configurable throughput (in Mb/s) for the remote disk is.`) + cmd.Flags().IntVar(&editReq.TotalInitialRemoteDiskSize, "total-initial-remote-disk-size", editReq.TotalInitialRemoteDiskSize, `If set, what the total initial volume size (in GB) of the remote disks should be.`) cmd.Use = "edit INSTANCE_POOL_ID INSTANCE_POOL_NAME NODE_TYPE_ID" cmd.Short = `Edit an existing instance pool.` diff --git a/cmd/workspace/jobs/jobs.go b/cmd/workspace/jobs/jobs.go index f36bf44ee5..c30d3c69bd 100755 --- a/cmd/workspace/jobs/jobs.go +++ b/cmd/workspace/jobs/jobs.go @@ -293,9 +293,7 @@ func newCreate() *cobra.Command { cmd.Use = "create" cmd.Short = `Create a new job.` - cmd.Long = `Create a new job. - - Create a new job.` + cmd.Long = `Create a new job.` cmd.Annotations = make(map[string]string) diff --git a/cmd/workspace/pipelines/pipelines.go b/cmd/workspace/pipelines/pipelines.go index 29a9a7d5fe..6d14ad7dbd 100755 --- a/cmd/workspace/pipelines/pipelines.go +++ b/cmd/workspace/pipelines/pipelines.go @@ -965,6 +965,7 @@ func newUpdate() *cobra.Command { // TODO: complex arg: deployment cmd.Flags().BoolVar(&updateReq.Development, "development", updateReq.Development, `Whether the pipeline is in Development mode.`) cmd.Flags().StringVar(&updateReq.Edition, "edition", updateReq.Edition, `Pipeline product edition.`) + // TODO: complex arg: environment // TODO: complex arg: event_log cmd.Flags().Int64Var(&updateReq.ExpectedLastModified, "expected-last-modified", updateReq.ExpectedLastModified, `If present, the last-modified time of the pipeline settings before the edit.`) // TODO: complex arg: filters diff --git a/cmd/workspace/provider-exchanges/provider-exchanges.go b/cmd/workspace/provider-exchanges/provider-exchanges.go index cfb32b8d68..79625e820b 100755 --- a/cmd/workspace/provider-exchanges/provider-exchanges.go +++ b/cmd/workspace/provider-exchanges/provider-exchanges.go @@ -323,9 +323,7 @@ func newGet() *cobra.Command { cmd.Use = "get ID" cmd.Short = `Get an exchange.` - cmd.Long = `Get an exchange. - - Get an exchange.` + cmd.Long = `Get an exchange.` cmd.Annotations = make(map[string]string) diff --git a/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go b/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go index f0daf8fd0b..9cfd4fabd4 100755 --- a/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go +++ b/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go @@ -97,9 +97,7 @@ func newGet() *cobra.Command { cmd.Use = "get" cmd.Short = `Get provider analytics dashboard.` - cmd.Long = `Get provider analytics dashboard. - - Get provider analytics dashboard.` + cmd.Long = `Get provider analytics dashboard.` cmd.Annotations = make(map[string]string) @@ -139,9 +137,7 @@ func newGetLatestVersion() *cobra.Command { cmd.Use = "get-latest-version" cmd.Short = `Get latest version of provider analytics dashboard.` - cmd.Long = `Get latest version of provider analytics dashboard. - - Get latest version of provider analytics dashboard.` + cmd.Long = `Get latest version of provider analytics dashboard.` cmd.Annotations = make(map[string]string) @@ -191,8 +187,6 @@ func newUpdate() *cobra.Command { cmd.Use = "update ID" cmd.Short = `Update provider analytics dashboard.` cmd.Long = `Update provider analytics dashboard. - - Update provider analytics dashboard. Arguments: ID: id is immutable property and can't be updated.` diff --git a/cmd/workspace/shares/shares.go b/cmd/workspace/shares/shares.go index a094b15858..687aa17acc 100755 --- a/cmd/workspace/shares/shares.go +++ b/cmd/workspace/shares/shares.go @@ -406,8 +406,8 @@ func newUpdate() *cobra.Command { When the caller is a metastore admin, only the __owner__ field can be updated. - In the case that the share name is changed, **updateShare** requires that the - caller is both the share owner and a metastore admin. + In the case the share name is changed, **updateShare** requires that the + caller is the owner of the share and has the CREATE_SHARE privilege. If there are notebook files in the share, the __storage_root__ field cannot be updated. diff --git a/cmd/workspace/storage-credentials/storage-credentials.go b/cmd/workspace/storage-credentials/storage-credentials.go index ad757c766f..47d487e86e 100755 --- a/cmd/workspace/storage-credentials/storage-credentials.go +++ b/cmd/workspace/storage-credentials/storage-credentials.go @@ -81,7 +81,7 @@ func newCreate() *cobra.Command { // TODO: complex arg: cloudflare_api_token cmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `Comment associated with the credential.`) // 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.ReadOnly, "read-only", createReq.ReadOnly, `Whether the credential is usable only for read operations.`) cmd.Flags().BoolVar(&createReq.SkipValidation, "skip-validation", createReq.SkipValidation, `Supplying true to this argument skips validation of the created credential.`) cmd.Use = "create NAME" @@ -89,9 +89,13 @@ func newCreate() *cobra.Command { cmd.Long = `Create a storage credential. Creates a new storage credential. + + The caller must be a metastore admin or have the **CREATE_STORAGE_CREDENTIAL** + privilege on the metastore. Arguments: - NAME: The credential name. The name must be unique within the metastore.` + NAME: The credential name. The name must be unique among storage and service + credentials within the metastore.` cmd.Annotations = make(map[string]string) @@ -163,7 +167,7 @@ func newDelete() *cobra.Command { // TODO: short flags - cmd.Flags().BoolVar(&deleteReq.Force, "force", deleteReq.Force, `Force deletion even if there are dependent external locations or external tables.`) + cmd.Flags().BoolVar(&deleteReq.Force, "force", deleteReq.Force, `Force an update even if there are dependent external locations or external tables (when purpose is **STORAGE**) or dependent services (when purpose is **SERVICE**).`) cmd.Use = "delete NAME" cmd.Short = `Delete a credential.` @@ -177,28 +181,16 @@ func newDelete() *cobra.Command { cmd.Annotations = make(map[string]string) + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + cmd.PreRunE = root.MustWorkspaceClient cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { ctx := cmd.Context() w := cmdctx.WorkspaceClient(ctx) - if len(args) == 0 { - promptSpinner := cmdio.Spinner(ctx) - promptSpinner <- "No NAME argument specified. Loading names for Storage Credentials drop-down." - names, err := w.StorageCredentials.StorageCredentialInfoNameToIdMap(ctx, catalog.ListStorageCredentialsRequest{}) - close(promptSpinner) - if err != nil { - return fmt.Errorf("failed to load names for Storage Credentials drop-down. Please manually specify required arguments. Original error: %w", err) - } - id, err := cmdio.Select(ctx, names, "Name of the storage credential") - if err != nil { - return err - } - args = append(args, id) - } - if len(args) != 1 { - return fmt.Errorf("expected to have name of the storage credential") - } deleteReq.Name = args[0] err = w.StorageCredentials.Delete(ctx, deleteReq) @@ -362,10 +354,10 @@ func newUpdate() *cobra.Command { cmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `Comment associated with the credential.`) // 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().Var(&updateReq.IsolationMode, "isolation-mode", `. Supported values: [ISOLATION_MODE_ISOLATED, ISOLATION_MODE_OPEN]`) + cmd.Flags().Var(&updateReq.IsolationMode, "isolation-mode", `Whether the current securable is accessible from all workspaces or a specific set of workspaces. Supported values: [ISOLATION_MODE_ISOLATED, ISOLATION_MODE_OPEN]`) 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.`) - cmd.Flags().BoolVar(&updateReq.ReadOnly, "read-only", updateReq.ReadOnly, `Whether the storage credential is only usable for read operations.`) + cmd.Flags().BoolVar(&updateReq.ReadOnly, "read-only", updateReq.ReadOnly, `Whether the credential is usable only for read operations.`) cmd.Flags().BoolVar(&updateReq.SkipValidation, "skip-validation", updateReq.SkipValidation, `Supplying true to this argument skips validation of the updated credential.`) cmd.Use = "update NAME" @@ -373,12 +365,20 @@ func newUpdate() *cobra.Command { cmd.Long = `Update a credential. Updates a storage credential on the metastore. + + The caller must be the owner of the storage credential or a metastore admin. + If the caller is a metastore admin, only the **owner** field can be changed. Arguments: NAME: Name of the storage credential.` cmd.Annotations = make(map[string]string) + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := root.ExactArgs(1) + return check(cmd, args) + } + cmd.PreRunE = root.MustWorkspaceClient cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { ctx := cmd.Context() @@ -396,23 +396,6 @@ func newUpdate() *cobra.Command { } } } - if len(args) == 0 { - promptSpinner := cmdio.Spinner(ctx) - promptSpinner <- "No NAME argument specified. Loading names for Storage Credentials drop-down." - names, err := w.StorageCredentials.StorageCredentialInfoNameToIdMap(ctx, catalog.ListStorageCredentialsRequest{}) - close(promptSpinner) - if err != nil { - return fmt.Errorf("failed to load names for Storage Credentials drop-down. Please manually specify required arguments. Original error: %w", err) - } - id, err := cmdio.Select(ctx, names, "Name of the storage credential") - if err != nil { - return err - } - args = append(args, id) - } - if len(args) != 1 { - return fmt.Errorf("expected to have name of the storage credential") - } updateReq.Name = args[0] response, err := w.StorageCredentials.Update(ctx, updateReq) @@ -459,7 +442,7 @@ func newValidate() *cobra.Command { // 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.`) - cmd.Flags().StringVar(&validateReq.StorageCredentialName, "storage-credential-name", validateReq.StorageCredentialName, `The name of the storage credential to validate.`) + cmd.Flags().StringVar(&validateReq.StorageCredentialName, "storage-credential-name", validateReq.StorageCredentialName, `Required.`) cmd.Flags().StringVar(&validateReq.Url, "url", validateReq.Url, `The external location url to validate.`) cmd.Use = "validate" diff --git a/cmd/workspace/vector-search-indexes/vector-search-indexes.go b/cmd/workspace/vector-search-indexes/vector-search-indexes.go index 13b3f483ad..37be0bfe3d 100755 --- a/cmd/workspace/vector-search-indexes/vector-search-indexes.go +++ b/cmd/workspace/vector-search-indexes/vector-search-indexes.go @@ -256,8 +256,6 @@ func newDeleteIndex() *cobra.Command { cmd.Use = "delete-index INDEX_NAME" cmd.Short = `Delete an index.` cmd.Long = `Delete an index. - - Delete an index. Arguments: INDEX_NAME: Name of the index` @@ -314,8 +312,6 @@ func newGetIndex() *cobra.Command { cmd.Use = "get-index INDEX_NAME" cmd.Short = `Get an index.` cmd.Long = `Get an index. - - Get an index. Arguments: INDEX_NAME: Name of the index` diff --git a/go.mod b/go.mod index 493b6b4115..7abda94342 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/BurntSushi/toml v1.5.0 // MIT github.com/Masterminds/semver/v3 v3.3.1 // MIT github.com/briandowns/spinner v1.23.1 // Apache 2.0 - github.com/databricks/databricks-sdk-go v0.72.0 // Apache 2.0 + github.com/databricks/databricks-sdk-go v0.73.1 // Apache 2.0 github.com/fatih/color v1.18.0 // MIT github.com/google/uuid v1.6.0 // BSD-3-Clause github.com/gorilla/mux v1.8.1 // BSD 3-Clause @@ -28,7 +28,7 @@ require ( github.com/spf13/cobra v1.9.1 // Apache 2.0 github.com/spf13/pflag v1.0.6 // BSD-3-Clause github.com/stretchr/testify v1.10.0 // MIT - golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 + golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b golang.org/x/mod v0.25.0 golang.org/x/oauth2 v0.30.0 golang.org/x/sync v0.15.0 @@ -40,9 +40,9 @@ require ( ) require ( - cloud.google.com/go/auth v0.4.2 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect - cloud.google.com/go/compute/metadata v0.5.2 // indirect + cloud.google.com/go/auth v0.16.2 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect + cloud.google.com/go/compute/metadata v0.7.0 // indirect github.com/ProtonMail/go-crypto v1.1.6 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/bitfield/gotestdox v0.2.2 // indirect @@ -53,39 +53,36 @@ require ( github.com/dnephin/pflag v1.0.7 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect - github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/s2a-go v0.1.7 // indirect + github.com/google/s2a-go v0.1.9 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/yamlfmt v0.17.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect + github.com/googleapis/gax-go/v2 v2.14.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/kr/pretty v0.1.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/zclconf/go-cty v1.16.2 // indirect - go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect - go.opentelemetry.io/otel v1.31.0 // indirect - go.opentelemetry.io/otel/metric v1.31.0 // indirect - go.opentelemetry.io/otel/trace v1.31.0 // indirect - golang.org/x/crypto v0.38.0 // indirect - golang.org/x/net v0.40.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.33.0 // indirect - google.golang.org/api v0.182.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect - google.golang.org/grpc v1.69.4 // indirect - google.golang.org/protobuf v1.36.3 // indirect - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect + go.opentelemetry.io/otel v1.36.0 // indirect + go.opentelemetry.io/otel/metric v1.36.0 // indirect + go.opentelemetry.io/otel/trace v1.36.0 // indirect + golang.org/x/crypto v0.39.0 // indirect + golang.org/x/net v0.41.0 // indirect + golang.org/x/time v0.12.0 // indirect + golang.org/x/tools v0.34.0 // indirect + google.golang.org/api v0.238.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect + google.golang.org/grpc v1.73.0 // indirect + google.golang.org/protobuf v1.36.6 // indirect gotest.tools/gotestsum v1.12.1 // indirect ) diff --git a/go.sum b/go.sum index a78bb7696d..a87c7a8c8d 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,11 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go/auth v0.4.2 h1:sb0eyLkhRtpq5jA+a8KWw0W70YcdVca7KJ8TM0AFYDg= -cloud.google.com/go/auth v0.4.2/go.mod h1:Kqvlz1cf1sNA0D+sYJnkPQOP+JMHkuHeIgVmCRtZOLc= -cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= -cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= -cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= -cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= +cloud.google.com/go/auth v0.16.2 h1:QvBAGFPLrDeoiNjyfVunhQ10HKNYuOwZ5noee0M5df4= +cloud.google.com/go/auth v0.16.2/go.mod h1:sRBas2Y1fB1vZTdurouM0AzuYQBMZinrUYL8EufhtEA= +cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= +cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= +cloud.google.com/go/compute/metadata v0.7.0 h1:PBWF+iiAerVNe8UCHxdOt6eHLVc3ydFeOCw78U8ytSU= +cloud.google.com/go/compute/metadata v0.7.0/go.mod h1:j5MvL9PprKL39t166CoB1uVHfQMs4tFQZZcKwksXUjo= dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= @@ -24,22 +22,19 @@ github.com/bmatcuk/doublestar/v4 v4.7.1 h1:fdDeAqgT47acgwd9bd9HxJRDmc9UAmPpc+2m0 github.com/bmatcuk/doublestar/v4 v4.7.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/briandowns/spinner v1.23.1 h1:t5fDPmScwUjozhDj4FA46p5acZWIPXYE30qW2Ptu650= github.com/briandowns/spinner v1.23.1/go.mod h1:LaZeM4wm2Ywy6vO571mvhQNRcWfRUnXOs0RcKV0wYKM= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= -github.com/databricks/databricks-sdk-go v0.72.0 h1:vNS4zlpvNYiXsy/7/lzV7cuu/yOcT/1xpfuJw3+W3TA= -github.com/databricks/databricks-sdk-go v0.72.0/go.mod h1:xBtjeP9nq+6MgTewZW1EcbRkD7aDY9gZvcRPcwPhZjw= +github.com/databricks/databricks-sdk-go v0.73.1 h1:c+o2J+l37WnQWqY4muokpFL1E2a5oJVC5J+Z8oFNCeU= +github.com/databricks/databricks-sdk-go v0.73.1/go.mod h1:xBtjeP9nq+6MgTewZW1EcbRkD7aDY9gZvcRPcwPhZjw= 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= @@ -47,10 +42,6 @@ github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk= github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= @@ -65,50 +56,31 @@ github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH github.com/go-git/go-git/v5 v5.14.0 h1:/MD3lCrGjCen5WfEAzKg00MJJffKhC8gzS80ycmCi60= github.com/go-git/go-git/v5 v5.14.0/go.mod h1:Z5Xhoia5PcWA3NF8vRLURn9E5FRhSl7dGj9ItW3Wk5k= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= +github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= +github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 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/google/yamlfmt v0.17.0 h1:/tdp01rIlvLz3LgJ2NtMLnqgAadZm33P7GcPU680b+w= github.com/google/yamlfmt v0.17.0/go.mod h1:gs0UEklJOYkUJ+OOCG0hg9n+DzucKDPlJElTUasVNK8= -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.4 h1:9gWcmF85Wvq4ryPFvGFaOgPIs1AQX0d0bcbGw4Z96qg= -github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoFubselGIoBMCwI= +github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4= +github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA= +github.com/googleapis/gax-go/v2 v2.14.2 h1:eBLnkZ9635krYIPD+ag1USrOAI0Nr0QYF3+/3GqO0k0= +github.com/googleapis/gax-go/v2 v2.14.2/go.mod h1:ON64QhlJkhVtSqp4v1uaK92VyZ2gmvDQsweuyLV+8+w= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= @@ -135,11 +107,10 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -160,11 +131,10 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/quasilyte/go-ruleguard/dsl v0.3.22 h1:wd8zkOhSNr+I+8Qeciml08ivDt1pSXe60+5DqOpCjPE= github.com/quasilyte/go-ruleguard/dsl v0.3.22/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI= github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs= @@ -177,71 +147,46 @@ github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wx github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/zclconf/go-cty v1.16.2 h1:LAJSwc3v81IRBZyUVQDUdZ7hs3SYs9jv0eZJDWHD/70= github.com/zclconf/go-cty v1.16.2/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.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= -go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= -go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= -go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= -go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= -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.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= -golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -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= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 h1:q4XOmH/0opmeuJtPsbFNivyl7bCt7yRBbeEm2sC/XtQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0/go.mod h1:snMWehoOh2wsEwnvvwtDyFCxVeDAODenXHtn5vzrKjo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= +go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg= +go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E= +go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE= +go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs= +go.opentelemetry.io/otel/sdk v1.36.0 h1:b6SYIuLRs88ztox4EyrvRti80uXIFy+Sqzoh9kFULbs= +go.opentelemetry.io/otel/sdk v1.36.0/go.mod h1:+lC+mTgD+MUWfjJubi2vvXWcVxyr9rmlshZni72pXeY= +go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis= +go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4= +go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w= +go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o= +golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= -golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -249,50 +194,24 @@ golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= -golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc= -golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI= +golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= +golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.182.0 h1:if5fPvudRQ78GeRx3RayIoiuV7modtErPIZC/T2bIvE= -google.golang.org/api v0.182.0/go.mod h1:cGhjy4caqA5yXRzEhkHI8Y9mfyC2VLTlER2l08xaqtM= -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/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-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= -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.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= -google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= -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= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU= -google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/api v0.238.0 h1:+EldkglWIg/pWjkq97sd+XxH7PxakNYoe/rkSTbnvOs= +google.golang.org/api v0.238.0/go.mod h1:cOVEm2TpdAGHL2z+UwyS+kmlGr3bVWQQ6sYEqkKje50= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= +google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -304,5 +223,3 @@ gotest.tools/gotestsum v1.12.1 h1:dvcxFBTFR1QsQmrCQa4k/vDXow9altdYz4CjdW+XeBE= gotest.tools/gotestsum v1.12.1/go.mod h1:mwDmLbx9DIvr09dnAoGgQPLaSXszNpXpWo2bsQge5BE= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/config.go b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/config.go new file mode 100644 index 0000000000..712711a281 --- /dev/null +++ b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/config.go @@ -0,0 +1,349 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "errors" + "flag" + "fmt" + "os" + "path/filepath" + "runtime" + "strconv" + "strings" + + "github.com/google/yamlfmt/pkg/yaml" + "github.com/google/yamlfmt" + "github.com/google/yamlfmt/command" + "github.com/google/yamlfmt/engine" + "github.com/google/yamlfmt/internal/collections" + "github.com/google/yamlfmt/internal/logger" + "github.com/mitchellh/mapstructure" +) + +var configFileNames = collections.Set[string]{ + ".yamlfmt": {}, + ".yamlfmt.yml": {}, + ".yamlfmt.yaml": {}, + "yamlfmt.yml": {}, + "yamlfmt.yaml": {}, +} + +const configHomeDir string = "yamlfmt" + +var ( + errNoConfFlag = errors.New("config path not specified in --conf") + errConfPathInvalid = errors.New("config path specified in --conf was invalid") + errConfPathNotExist = errors.New("no config file found") + errConfPathIsDir = errors.New("config path is dir") + errNoConfigHome = errors.New("missing required env var for config home") +) + +type configPathError struct { + path string + err error +} + +func (e *configPathError) Error() string { + if errors.Is(e.err, errConfPathInvalid) { + return fmt.Sprintf("config path %s was invalid", e.path) + } + if errors.Is(e.err, errConfPathNotExist) { + return fmt.Sprintf("no config file found in directory %s", filepath.Dir(e.path)) + } + if errors.Is(e.err, errConfPathIsDir) { + return fmt.Sprintf("config path %s is a directory", e.path) + } + return e.err.Error() +} + +func (e *configPathError) Unwrap() error { + return e.err +} + +func readConfig(path string) (map[string]any, error) { + yamlBytes, err := os.ReadFile(path) + if err != nil { + return nil, err + } + var configData map[string]interface{} + err = yaml.Unmarshal(yamlBytes, &configData) + if err != nil { + return nil, err + } + return configData, nil +} + +func getConfigPath() (string, error) { + // First priority: specified in cli flag + configPath, err := getConfigPathFromFlag() + if err != nil { + // If they don't provide a conf flag, we continue. If + // a conf flag is provided and it's wrong, we consider + // that a failure state. + if !errors.Is(err, errNoConfFlag) { + return "", err + } + } else { + return configPath, nil + } + + // Second priority: in the working directory + configPath, err = getConfigPathFromDirTree() + // In this scenario, no errors are considered a failure state, + // so we continue to the next fallback if there are no errors. + if err == nil { + return configPath, nil + } + + if !*flagDisableGlobalConf { + // Third priority: in home config directory + configPath, err = getConfigPathFromConfigHome() + // In this scenario, no errors are considered a failure state, + // so we continue to the next fallback if there are no errors. + if err == nil { + return configPath, nil + } + } + + // All else fails, no path and no error (signals to + // use default config). + logger.Debug(logger.DebugCodeConfig, "No config file found, using default config") + return "", nil +} + +func getConfigPathFromFlag() (string, error) { + // First check if the global configuration was explicitly requested as that takes precedence. + if *flagGlobalConf { + logger.Debug(logger.DebugCodeConfig, "Using -global_conf flag") + return getConfigPathFromXdgConfigHome() + } + // If the global config wasn't explicitly requested, check if there was a specific configuration path supplied. + configPath := *flagConf + if configPath != "" { + logger.Debug(logger.DebugCodeConfig, "Using config path %s from -conf flag", configPath) + return configPath, validatePath(configPath) + } + + logger.Debug(logger.DebugCodeConfig, "No config path specified in -conf") + return configPath, errNoConfFlag +} + +// This function searches up the directory tree until it finds +// a config file. +func getConfigPathFromDirTree() (string, error) { + wd, err := os.Getwd() + if err != nil { + return "", err + } + absPath, err := filepath.Abs(wd) + if err != nil { + return "", err + } + dir := absPath + for dir != filepath.Dir(dir) { + configPath, err := getConfigPathFromDir(dir) + if err == nil { + logger.Debug(logger.DebugCodeConfig, "Found config at %s", configPath) + return configPath, nil + } + dir = filepath.Dir(dir) + } + return "", errConfPathNotExist +} + +func getConfigPathFromConfigHome() (string, error) { + // Build tags are a veritable pain in the behind, + // I'm putting both config home functions in this + // file. You can't stop me. + if runtime.GOOS == "windows" { + return getConfigPathFromAppDataLocal() + } + return getConfigPathFromXdgConfigHome() +} + +func getConfigPathFromXdgConfigHome() (string, error) { + configHome, configHomePresent := os.LookupEnv("XDG_CONFIG_HOME") + if !configHomePresent { + home, homePresent := os.LookupEnv("HOME") + if !homePresent { + // I fear whom's'tever does not have a $HOME set + return "", errNoConfigHome + } + configHome = filepath.Join(home, ".config") + } + homeConfigPath := filepath.Join(configHome, configHomeDir) + return getConfigPathFromDir(homeConfigPath) +} + +func getConfigPathFromAppDataLocal() (string, error) { + configHome, configHomePresent := os.LookupEnv("LOCALAPPDATA") + if !configHomePresent { + // I think you'd have to go out of your way to unset this, + // so this should only happen to sickos with broken setups. + return "", errNoConfigHome + } + homeConfigPath := filepath.Join(configHome, configHomeDir) + return getConfigPathFromDir(homeConfigPath) +} + +func getConfigPathFromDir(dir string) (string, error) { + for filename := range configFileNames { + configPath := filepath.Join(dir, filename) + if err := validatePath(configPath); err == nil { + logger.Debug(logger.DebugCodeConfig, "Found config at %s", configPath) + return configPath, nil + } + } + logger.Debug(logger.DebugCodeConfig, "No config file found in %s", dir) + return "", errConfPathNotExist +} + +func validatePath(path string) error { + info, err := os.Stat(path) + if err != nil { + if os.IsNotExist(err) { + return &configPathError{ + path: path, + err: errConfPathNotExist, + } + } + if info.IsDir() { + return &configPathError{ + path: path, + err: errConfPathIsDir, + } + } + return &configPathError{ + path: path, + err: err, + } + } + return nil +} + +func makeCommandConfigFromData(configData map[string]any) (*command.Config, error) { + config := command.Config{FormatterConfig: command.NewFormatterConfig()} + err := mapstructure.Decode(configData, &config) + if err != nil { + return nil, err + } + + // Parse overrides for formatter configuration + if len(flagFormatter) > 0 { + overrides, err := parseFormatterConfigFlag(flagFormatter) + if err != nil { + return nil, err + } + for k, v := range overrides { + if k == "type" { + config.FormatterConfig.Type = v.(string) + } + config.FormatterConfig.FormatterSettings[k] = v + } + } + + // Default to OS line endings + if config.LineEnding == "" { + config.LineEnding = yamlfmt.LineBreakStyleLF + if runtime.GOOS == "windows" { + config.LineEnding = yamlfmt.LineBreakStyleCRLF + } + } + + // Default to yaml and yml extensions + if len(config.Extensions) == 0 { + config.Extensions = []string{"yaml", "yml"} + } + + // Apply the general rule that the config takes precedence over + // the command line flags. + if !config.Doublestar { + config.Doublestar = *flagDoublestar + } + if !config.ContinueOnError { + config.ContinueOnError = *flagContinueOnError + } + if !config.GitignoreExcludes { + config.GitignoreExcludes = *flagGitignoreExcludes + } + config.GitignorePath = pickFirst(config.GitignorePath, *flagGitignorePath) + config.OutputFormat = pickFirst(config.OutputFormat, getOutputFormatFromFlag(), engine.EngineOutputDefault) + + defaultMatchType := yamlfmt.MatchTypeStandard + if config.Doublestar { + defaultMatchType = yamlfmt.MatchTypeDoublestar + } + config.MatchType = pickFirst(config.MatchType, yamlfmt.MatchType(*flagMatchType), defaultMatchType) + + // Overwrite config if includes are provided through args + if len(flag.Args()) > 0 { + config.Include = flag.Args() + } + + // Append any additional data from array flags + config.Exclude = append(config.Exclude, flagExclude...) + config.Extensions = append(config.Extensions, flagExtensions...) + + return &config, nil +} + +// pickFirst returns the first string in ss that is not empty. +func pickFirst[T ~string](ss ...T) T { + for _, s := range ss { + if s != "" { + return s + } + } + + return "" +} + +func parseFormatterConfigFlag(flagValues []string) (map[string]any, error) { + formatterValues := map[string]any{} + flagErrors := collections.Errors{} + + // Expected format: fieldname=value + for _, configField := range flagValues { + if strings.Count(configField, "=") != 1 { + flagErrors = append( + flagErrors, + fmt.Errorf("badly formatted config field: %s", configField), + ) + continue + } + + kv := strings.Split(configField, "=") + + // Try to parse as integer + vInt, err := strconv.ParseInt(kv[1], 10, 64) + if err == nil { + formatterValues[kv[0]] = vInt + continue + } + + // Try to parse as boolean + vBool, err := strconv.ParseBool(kv[1]) + if err == nil { + formatterValues[kv[0]] = vBool + continue + } + + // Fall through to parsing as string + formatterValues[kv[0]] = kv[1] + } + + return formatterValues, flagErrors.Combine() +} diff --git a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/flags.go b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/flags.go new file mode 100644 index 0000000000..e7126183b5 --- /dev/null +++ b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/flags.go @@ -0,0 +1,128 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "flag" + "fmt" + "runtime" + "strings" + + "github.com/google/yamlfmt" + "github.com/google/yamlfmt/engine" +) + +var ( + flagLint *bool = flag.Bool("lint", false, `Check if there are any differences between +source yaml and formatted yaml.`) + flagDry *bool = flag.Bool("dry", false, `Perform a dry run; show the output of a formatting +operation without performing it.`) + flagIn *bool = flag.Bool("in", false, "Format yaml read from stdin and output to stdout") + flagVersion *bool = flag.Bool("version", false, "Print yamlfmt version") + flagConf *string = flag.String("conf", "", "Read yamlfmt config from this path") + flagGlobalConf *bool = flag.Bool("global_conf", false, fmt.Sprintf("Use global yamlfmt config from %s", globalConfFlagVar())) + flagDisableGlobalConf *bool = flag.Bool("no_global_conf", false, fmt.Sprintf("Disabled usage of global yamlfmt config from %s", globalConfFlagVar())) + flagPrintConf *bool = flag.Bool("print_conf", false, "Print config") + flagDoublestar *bool = flag.Bool("dstar", false, "Use doublestar globs for include and exclude") + flagQuiet *bool = flag.Bool("quiet", false, "Print minimal output to stdout") + flagQuietShort *bool = flag.Bool("q", false, "Print minimal output to stdout") + flagVerbose *bool = flag.Bool("verbose", false, "Print additional output to stdout.") + flagVerboseShort *bool = flag.Bool("v", false, "Print additional output to stdout.") + flagContinueOnError *bool = flag.Bool("continue_on_error", false, "Continue to format files that didn't fail instead of exiting with code 1.") + flagGitignoreExcludes *bool = flag.Bool("gitignore_excludes", false, "Use a gitignore file for excludes") + flagGitignorePath *string = flag.String("gitignore_path", ".gitignore", "Path to gitignore file to use") + flagOutputFormat *string = flag.String("output_format", "default", "The engine output format") + flagMatchType *string = flag.String("match_type", "", "The file discovery method to use. Valid values: standard, doublestar, gitignore") + flagExclude = arrayFlag{} + flagFormatter = arrayFlag{} + flagExtensions = arrayFlag{} + flagDebug = arrayFlag{} +) + +func bindArrayFlags() { + flag.Var(&flagExclude, "exclude", "Paths to exclude in the chosen format (standard or doublestar)") + flag.Var(&flagFormatter, "formatter", "Config value overrides to pass to the formatter") + flag.Var(&flagExtensions, "extensions", "File extensions to use for standard path collection") + flag.Var(&flagDebug, "debug", "Debug codes to activate for debug logging") +} + +type arrayFlag []string + +// Implements flag.Value +func (a *arrayFlag) String() string { + return strings.Join(*a, " ") +} + +func (a *arrayFlag) Set(value string) error { + values := []string{value} + if strings.Contains(value, ",") { + values = strings.Split(value, ",") + } + *a = append(*a, values...) + return nil +} + +func configureHelp() { + flag.Usage = func() { + fmt.Println(`yamlfmt is a simple command line tool for formatting yaml files. + + Arguments: + + Glob paths to yaml files + Send any number of paths to yaml files specified in doublestar glob format (see: https://github.com/bmatcuk/doublestar). + Any flags must be specified before the paths. + + - or /dev/stdin + Passing in a single - or /dev/stdin will read the yaml from stdin and output the formatted result to stdout + + Flags:`) + flag.PrintDefaults() + } +} + +func getOperationFromFlag() yamlfmt.Operation { + if *flagIn || isStdinArg() { + return yamlfmt.OperationStdin + } + if *flagLint { + return yamlfmt.OperationLint + } + if *flagDry { + return yamlfmt.OperationDry + } + if *flagPrintConf { + return yamlfmt.OperationPrintConfig + } + return yamlfmt.OperationFormat +} + +func getOutputFormatFromFlag() engine.EngineOutputFormat { + return engine.EngineOutputFormat(*flagOutputFormat) +} + +func isStdinArg() bool { + if len(flag.Args()) != 1 { + return false + } + arg := flag.Args()[0] + return arg == "-" || arg == "/dev/stdin" +} + +func globalConfFlagVar() string { + if runtime.GOOS == "windows" { + return "LOCALAPPDATA" + } + return "XDG_CONFIG_HOME" +} diff --git a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/main.go b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/main.go new file mode 100644 index 0000000000..1d77f59171 --- /dev/null +++ b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/main.go @@ -0,0 +1,85 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "flag" + "fmt" + "log" + "os" + + "github.com/google/yamlfmt" + "github.com/google/yamlfmt/command" + "github.com/google/yamlfmt/formatters/basic" + "github.com/google/yamlfmt/internal/logger" +) + +var ( + version = "dev" + commit = "none" +) + +func main() { + if err := run(); err != nil { + l := log.New(os.Stderr, "", 0) + l.Fatal(err) + } +} + +func run() error { + bindArrayFlags() + configureHelp() + flag.Parse() + + if *flagVersion { + fmt.Printf("yamlfmt %s (%s)\n", version, commit) + return nil + } + + for _, code := range flagDebug { + logger.ActivateDebugCode(code) + } + + c := &command.Command{ + Operation: getOperationFromFlag(), + Registry: getFullRegistry(), + Quiet: *flagQuiet || *flagQuietShort, + Verbose: *flagVerbose || *flagVerboseShort, + } + + configData := map[string]any{} + configPath, err := getConfigPath() + if err != nil { + return err + } + if configPath != "" { + configData, err = readConfig(configPath) + if err != nil { + return err + } + } + + commandConfig, err := makeCommandConfigFromData(configData) + if err != nil { + return err + } + c.Config = commandConfig + + return c.Run() +} + +func getFullRegistry() *yamlfmt.Registry { + return yamlfmt.NewFormatterRegistry(&basic.BasicFormatterFactory{}) +} From e396ef70b6b0764baca15ff1ad927b9c84ab8d3c Mon Sep 17 00:00:00 2001 From: Parth Bansal Date: Mon, 23 Jun 2025 15:41:58 +0000 Subject: [PATCH 2/4] update --- .../google/yamlfmt/cmd/yamlfmt/config.go | 349 ------------------ .../google/yamlfmt/cmd/yamlfmt/flags.go | 128 ------- .../google/yamlfmt/cmd/yamlfmt/main.go | 85 ----- 3 files changed, 562 deletions(-) delete mode 100644 vendor/github.com/google/yamlfmt/cmd/yamlfmt/config.go delete mode 100644 vendor/github.com/google/yamlfmt/cmd/yamlfmt/flags.go delete mode 100644 vendor/github.com/google/yamlfmt/cmd/yamlfmt/main.go diff --git a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/config.go b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/config.go deleted file mode 100644 index 712711a281..0000000000 --- a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/config.go +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "errors" - "flag" - "fmt" - "os" - "path/filepath" - "runtime" - "strconv" - "strings" - - "github.com/google/yamlfmt/pkg/yaml" - "github.com/google/yamlfmt" - "github.com/google/yamlfmt/command" - "github.com/google/yamlfmt/engine" - "github.com/google/yamlfmt/internal/collections" - "github.com/google/yamlfmt/internal/logger" - "github.com/mitchellh/mapstructure" -) - -var configFileNames = collections.Set[string]{ - ".yamlfmt": {}, - ".yamlfmt.yml": {}, - ".yamlfmt.yaml": {}, - "yamlfmt.yml": {}, - "yamlfmt.yaml": {}, -} - -const configHomeDir string = "yamlfmt" - -var ( - errNoConfFlag = errors.New("config path not specified in --conf") - errConfPathInvalid = errors.New("config path specified in --conf was invalid") - errConfPathNotExist = errors.New("no config file found") - errConfPathIsDir = errors.New("config path is dir") - errNoConfigHome = errors.New("missing required env var for config home") -) - -type configPathError struct { - path string - err error -} - -func (e *configPathError) Error() string { - if errors.Is(e.err, errConfPathInvalid) { - return fmt.Sprintf("config path %s was invalid", e.path) - } - if errors.Is(e.err, errConfPathNotExist) { - return fmt.Sprintf("no config file found in directory %s", filepath.Dir(e.path)) - } - if errors.Is(e.err, errConfPathIsDir) { - return fmt.Sprintf("config path %s is a directory", e.path) - } - return e.err.Error() -} - -func (e *configPathError) Unwrap() error { - return e.err -} - -func readConfig(path string) (map[string]any, error) { - yamlBytes, err := os.ReadFile(path) - if err != nil { - return nil, err - } - var configData map[string]interface{} - err = yaml.Unmarshal(yamlBytes, &configData) - if err != nil { - return nil, err - } - return configData, nil -} - -func getConfigPath() (string, error) { - // First priority: specified in cli flag - configPath, err := getConfigPathFromFlag() - if err != nil { - // If they don't provide a conf flag, we continue. If - // a conf flag is provided and it's wrong, we consider - // that a failure state. - if !errors.Is(err, errNoConfFlag) { - return "", err - } - } else { - return configPath, nil - } - - // Second priority: in the working directory - configPath, err = getConfigPathFromDirTree() - // In this scenario, no errors are considered a failure state, - // so we continue to the next fallback if there are no errors. - if err == nil { - return configPath, nil - } - - if !*flagDisableGlobalConf { - // Third priority: in home config directory - configPath, err = getConfigPathFromConfigHome() - // In this scenario, no errors are considered a failure state, - // so we continue to the next fallback if there are no errors. - if err == nil { - return configPath, nil - } - } - - // All else fails, no path and no error (signals to - // use default config). - logger.Debug(logger.DebugCodeConfig, "No config file found, using default config") - return "", nil -} - -func getConfigPathFromFlag() (string, error) { - // First check if the global configuration was explicitly requested as that takes precedence. - if *flagGlobalConf { - logger.Debug(logger.DebugCodeConfig, "Using -global_conf flag") - return getConfigPathFromXdgConfigHome() - } - // If the global config wasn't explicitly requested, check if there was a specific configuration path supplied. - configPath := *flagConf - if configPath != "" { - logger.Debug(logger.DebugCodeConfig, "Using config path %s from -conf flag", configPath) - return configPath, validatePath(configPath) - } - - logger.Debug(logger.DebugCodeConfig, "No config path specified in -conf") - return configPath, errNoConfFlag -} - -// This function searches up the directory tree until it finds -// a config file. -func getConfigPathFromDirTree() (string, error) { - wd, err := os.Getwd() - if err != nil { - return "", err - } - absPath, err := filepath.Abs(wd) - if err != nil { - return "", err - } - dir := absPath - for dir != filepath.Dir(dir) { - configPath, err := getConfigPathFromDir(dir) - if err == nil { - logger.Debug(logger.DebugCodeConfig, "Found config at %s", configPath) - return configPath, nil - } - dir = filepath.Dir(dir) - } - return "", errConfPathNotExist -} - -func getConfigPathFromConfigHome() (string, error) { - // Build tags are a veritable pain in the behind, - // I'm putting both config home functions in this - // file. You can't stop me. - if runtime.GOOS == "windows" { - return getConfigPathFromAppDataLocal() - } - return getConfigPathFromXdgConfigHome() -} - -func getConfigPathFromXdgConfigHome() (string, error) { - configHome, configHomePresent := os.LookupEnv("XDG_CONFIG_HOME") - if !configHomePresent { - home, homePresent := os.LookupEnv("HOME") - if !homePresent { - // I fear whom's'tever does not have a $HOME set - return "", errNoConfigHome - } - configHome = filepath.Join(home, ".config") - } - homeConfigPath := filepath.Join(configHome, configHomeDir) - return getConfigPathFromDir(homeConfigPath) -} - -func getConfigPathFromAppDataLocal() (string, error) { - configHome, configHomePresent := os.LookupEnv("LOCALAPPDATA") - if !configHomePresent { - // I think you'd have to go out of your way to unset this, - // so this should only happen to sickos with broken setups. - return "", errNoConfigHome - } - homeConfigPath := filepath.Join(configHome, configHomeDir) - return getConfigPathFromDir(homeConfigPath) -} - -func getConfigPathFromDir(dir string) (string, error) { - for filename := range configFileNames { - configPath := filepath.Join(dir, filename) - if err := validatePath(configPath); err == nil { - logger.Debug(logger.DebugCodeConfig, "Found config at %s", configPath) - return configPath, nil - } - } - logger.Debug(logger.DebugCodeConfig, "No config file found in %s", dir) - return "", errConfPathNotExist -} - -func validatePath(path string) error { - info, err := os.Stat(path) - if err != nil { - if os.IsNotExist(err) { - return &configPathError{ - path: path, - err: errConfPathNotExist, - } - } - if info.IsDir() { - return &configPathError{ - path: path, - err: errConfPathIsDir, - } - } - return &configPathError{ - path: path, - err: err, - } - } - return nil -} - -func makeCommandConfigFromData(configData map[string]any) (*command.Config, error) { - config := command.Config{FormatterConfig: command.NewFormatterConfig()} - err := mapstructure.Decode(configData, &config) - if err != nil { - return nil, err - } - - // Parse overrides for formatter configuration - if len(flagFormatter) > 0 { - overrides, err := parseFormatterConfigFlag(flagFormatter) - if err != nil { - return nil, err - } - for k, v := range overrides { - if k == "type" { - config.FormatterConfig.Type = v.(string) - } - config.FormatterConfig.FormatterSettings[k] = v - } - } - - // Default to OS line endings - if config.LineEnding == "" { - config.LineEnding = yamlfmt.LineBreakStyleLF - if runtime.GOOS == "windows" { - config.LineEnding = yamlfmt.LineBreakStyleCRLF - } - } - - // Default to yaml and yml extensions - if len(config.Extensions) == 0 { - config.Extensions = []string{"yaml", "yml"} - } - - // Apply the general rule that the config takes precedence over - // the command line flags. - if !config.Doublestar { - config.Doublestar = *flagDoublestar - } - if !config.ContinueOnError { - config.ContinueOnError = *flagContinueOnError - } - if !config.GitignoreExcludes { - config.GitignoreExcludes = *flagGitignoreExcludes - } - config.GitignorePath = pickFirst(config.GitignorePath, *flagGitignorePath) - config.OutputFormat = pickFirst(config.OutputFormat, getOutputFormatFromFlag(), engine.EngineOutputDefault) - - defaultMatchType := yamlfmt.MatchTypeStandard - if config.Doublestar { - defaultMatchType = yamlfmt.MatchTypeDoublestar - } - config.MatchType = pickFirst(config.MatchType, yamlfmt.MatchType(*flagMatchType), defaultMatchType) - - // Overwrite config if includes are provided through args - if len(flag.Args()) > 0 { - config.Include = flag.Args() - } - - // Append any additional data from array flags - config.Exclude = append(config.Exclude, flagExclude...) - config.Extensions = append(config.Extensions, flagExtensions...) - - return &config, nil -} - -// pickFirst returns the first string in ss that is not empty. -func pickFirst[T ~string](ss ...T) T { - for _, s := range ss { - if s != "" { - return s - } - } - - return "" -} - -func parseFormatterConfigFlag(flagValues []string) (map[string]any, error) { - formatterValues := map[string]any{} - flagErrors := collections.Errors{} - - // Expected format: fieldname=value - for _, configField := range flagValues { - if strings.Count(configField, "=") != 1 { - flagErrors = append( - flagErrors, - fmt.Errorf("badly formatted config field: %s", configField), - ) - continue - } - - kv := strings.Split(configField, "=") - - // Try to parse as integer - vInt, err := strconv.ParseInt(kv[1], 10, 64) - if err == nil { - formatterValues[kv[0]] = vInt - continue - } - - // Try to parse as boolean - vBool, err := strconv.ParseBool(kv[1]) - if err == nil { - formatterValues[kv[0]] = vBool - continue - } - - // Fall through to parsing as string - formatterValues[kv[0]] = kv[1] - } - - return formatterValues, flagErrors.Combine() -} diff --git a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/flags.go b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/flags.go deleted file mode 100644 index e7126183b5..0000000000 --- a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/flags.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "flag" - "fmt" - "runtime" - "strings" - - "github.com/google/yamlfmt" - "github.com/google/yamlfmt/engine" -) - -var ( - flagLint *bool = flag.Bool("lint", false, `Check if there are any differences between -source yaml and formatted yaml.`) - flagDry *bool = flag.Bool("dry", false, `Perform a dry run; show the output of a formatting -operation without performing it.`) - flagIn *bool = flag.Bool("in", false, "Format yaml read from stdin and output to stdout") - flagVersion *bool = flag.Bool("version", false, "Print yamlfmt version") - flagConf *string = flag.String("conf", "", "Read yamlfmt config from this path") - flagGlobalConf *bool = flag.Bool("global_conf", false, fmt.Sprintf("Use global yamlfmt config from %s", globalConfFlagVar())) - flagDisableGlobalConf *bool = flag.Bool("no_global_conf", false, fmt.Sprintf("Disabled usage of global yamlfmt config from %s", globalConfFlagVar())) - flagPrintConf *bool = flag.Bool("print_conf", false, "Print config") - flagDoublestar *bool = flag.Bool("dstar", false, "Use doublestar globs for include and exclude") - flagQuiet *bool = flag.Bool("quiet", false, "Print minimal output to stdout") - flagQuietShort *bool = flag.Bool("q", false, "Print minimal output to stdout") - flagVerbose *bool = flag.Bool("verbose", false, "Print additional output to stdout.") - flagVerboseShort *bool = flag.Bool("v", false, "Print additional output to stdout.") - flagContinueOnError *bool = flag.Bool("continue_on_error", false, "Continue to format files that didn't fail instead of exiting with code 1.") - flagGitignoreExcludes *bool = flag.Bool("gitignore_excludes", false, "Use a gitignore file for excludes") - flagGitignorePath *string = flag.String("gitignore_path", ".gitignore", "Path to gitignore file to use") - flagOutputFormat *string = flag.String("output_format", "default", "The engine output format") - flagMatchType *string = flag.String("match_type", "", "The file discovery method to use. Valid values: standard, doublestar, gitignore") - flagExclude = arrayFlag{} - flagFormatter = arrayFlag{} - flagExtensions = arrayFlag{} - flagDebug = arrayFlag{} -) - -func bindArrayFlags() { - flag.Var(&flagExclude, "exclude", "Paths to exclude in the chosen format (standard or doublestar)") - flag.Var(&flagFormatter, "formatter", "Config value overrides to pass to the formatter") - flag.Var(&flagExtensions, "extensions", "File extensions to use for standard path collection") - flag.Var(&flagDebug, "debug", "Debug codes to activate for debug logging") -} - -type arrayFlag []string - -// Implements flag.Value -func (a *arrayFlag) String() string { - return strings.Join(*a, " ") -} - -func (a *arrayFlag) Set(value string) error { - values := []string{value} - if strings.Contains(value, ",") { - values = strings.Split(value, ",") - } - *a = append(*a, values...) - return nil -} - -func configureHelp() { - flag.Usage = func() { - fmt.Println(`yamlfmt is a simple command line tool for formatting yaml files. - - Arguments: - - Glob paths to yaml files - Send any number of paths to yaml files specified in doublestar glob format (see: https://github.com/bmatcuk/doublestar). - Any flags must be specified before the paths. - - - or /dev/stdin - Passing in a single - or /dev/stdin will read the yaml from stdin and output the formatted result to stdout - - Flags:`) - flag.PrintDefaults() - } -} - -func getOperationFromFlag() yamlfmt.Operation { - if *flagIn || isStdinArg() { - return yamlfmt.OperationStdin - } - if *flagLint { - return yamlfmt.OperationLint - } - if *flagDry { - return yamlfmt.OperationDry - } - if *flagPrintConf { - return yamlfmt.OperationPrintConfig - } - return yamlfmt.OperationFormat -} - -func getOutputFormatFromFlag() engine.EngineOutputFormat { - return engine.EngineOutputFormat(*flagOutputFormat) -} - -func isStdinArg() bool { - if len(flag.Args()) != 1 { - return false - } - arg := flag.Args()[0] - return arg == "-" || arg == "/dev/stdin" -} - -func globalConfFlagVar() string { - if runtime.GOOS == "windows" { - return "LOCALAPPDATA" - } - return "XDG_CONFIG_HOME" -} diff --git a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/main.go b/vendor/github.com/google/yamlfmt/cmd/yamlfmt/main.go deleted file mode 100644 index 1d77f59171..0000000000 --- a/vendor/github.com/google/yamlfmt/cmd/yamlfmt/main.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "flag" - "fmt" - "log" - "os" - - "github.com/google/yamlfmt" - "github.com/google/yamlfmt/command" - "github.com/google/yamlfmt/formatters/basic" - "github.com/google/yamlfmt/internal/logger" -) - -var ( - version = "dev" - commit = "none" -) - -func main() { - if err := run(); err != nil { - l := log.New(os.Stderr, "", 0) - l.Fatal(err) - } -} - -func run() error { - bindArrayFlags() - configureHelp() - flag.Parse() - - if *flagVersion { - fmt.Printf("yamlfmt %s (%s)\n", version, commit) - return nil - } - - for _, code := range flagDebug { - logger.ActivateDebugCode(code) - } - - c := &command.Command{ - Operation: getOperationFromFlag(), - Registry: getFullRegistry(), - Quiet: *flagQuiet || *flagQuietShort, - Verbose: *flagVerbose || *flagVerboseShort, - } - - configData := map[string]any{} - configPath, err := getConfigPath() - if err != nil { - return err - } - if configPath != "" { - configData, err = readConfig(configPath) - if err != nil { - return err - } - } - - commandConfig, err := makeCommandConfigFromData(configData) - if err != nil { - return err - } - c.Config = commandConfig - - return c.Run() -} - -func getFullRegistry() *yamlfmt.Registry { - return yamlfmt.NewFormatterRegistry(&basic.BasicFormatterFactory{}) -} From 94ced6865291a526b8c9cf50f699d0ce5c304fdc Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 23 Jun 2025 17:46:19 +0200 Subject: [PATCH 3/4] generate pydabs code --- .../bundles/compute/_models/cluster_spec.py | 20 ++++++++ .../databricks/bundles/jobs/__init__.py | 14 +++--- ...dbt_cloud_task.py => dbt_platform_task.py} | 22 ++++----- .../databricks/bundles/jobs/_models/task.py | 14 ++---- .../databricks/bundles/pipelines/__init__.py | 8 ++++ .../pipelines/_models/ingestion_config.py | 5 +- .../bundles/pipelines/_models/pipeline.py | 18 +++++++ .../_models/pipelines_environment.py | 47 +++++++++++++++++++ 8 files changed, 120 insertions(+), 28 deletions(-) rename experimental/python/databricks/bundles/jobs/_models/{dbt_cloud_task.py => dbt_platform_task.py} (57%) create mode 100644 experimental/python/databricks/bundles/pipelines/_models/pipelines_environment.py diff --git a/experimental/python/databricks/bundles/compute/_models/cluster_spec.py b/experimental/python/databricks/bundles/compute/_models/cluster_spec.py index 3b5187dcdb..d81a982918 100644 --- a/experimental/python/databricks/bundles/compute/_models/cluster_spec.py +++ b/experimental/python/databricks/bundles/compute/_models/cluster_spec.py @@ -199,6 +199,11 @@ class ClusterSpec: The ID of the cluster policy used to create the cluster if applicable. """ + remote_disk_throughput: VariableOrOptional[int] = None + """ + If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED disks. + """ + runtime_engine: VariableOrOptional[RuntimeEngine] = None single_user_name: VariableOrOptional[str] = None @@ -242,6 +247,11 @@ class ClusterSpec: Up to 10 keys can be specified. """ + total_initial_remote_disk_size: VariableOrOptional[int] = None + """ + If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED disks. + """ + use_ml_runtime: VariableOrOptional[bool] = None """ This field can only be used when `kind = CLASSIC_PREVIEW`. @@ -402,6 +412,11 @@ class ClusterSpecDict(TypedDict, total=False): The ID of the cluster policy used to create the cluster if applicable. """ + remote_disk_throughput: VariableOrOptional[int] + """ + If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED disks. + """ + runtime_engine: VariableOrOptional[RuntimeEngineParam] single_user_name: VariableOrOptional[str] @@ -445,6 +460,11 @@ class ClusterSpecDict(TypedDict, total=False): Up to 10 keys can be specified. """ + total_initial_remote_disk_size: VariableOrOptional[int] + """ + If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED disks. + """ + use_ml_runtime: VariableOrOptional[bool] """ This field can only be used when `kind = CLASSIC_PREVIEW`. diff --git a/experimental/python/databricks/bundles/jobs/__init__.py b/experimental/python/databricks/bundles/jobs/__init__.py index 3eb3d43185..12980c52c5 100644 --- a/experimental/python/databricks/bundles/jobs/__init__.py +++ b/experimental/python/databricks/bundles/jobs/__init__.py @@ -53,9 +53,9 @@ "DbfsStorageInfo", "DbfsStorageInfoDict", "DbfsStorageInfoParam", - "DbtCloudTask", - "DbtCloudTaskDict", - "DbtCloudTaskParam", + "DbtPlatformTask", + "DbtPlatformTaskDict", + "DbtPlatformTaskParam", "DbtTask", "DbtTaskDict", "DbtTaskParam", @@ -448,10 +448,10 @@ DashboardTaskDict, DashboardTaskParam, ) -from databricks.bundles.jobs._models.dbt_cloud_task import ( - DbtCloudTask, - DbtCloudTaskDict, - DbtCloudTaskParam, +from databricks.bundles.jobs._models.dbt_platform_task import ( + DbtPlatformTask, + DbtPlatformTaskDict, + DbtPlatformTaskParam, ) from databricks.bundles.jobs._models.dbt_task import DbtTask, DbtTaskDict, DbtTaskParam from databricks.bundles.jobs._models.file_arrival_trigger_configuration import ( diff --git a/experimental/python/databricks/bundles/jobs/_models/dbt_cloud_task.py b/experimental/python/databricks/bundles/jobs/_models/dbt_platform_task.py similarity index 57% rename from experimental/python/databricks/bundles/jobs/_models/dbt_cloud_task.py rename to experimental/python/databricks/bundles/jobs/_models/dbt_platform_task.py index d1d862c7ef..92cf53ac86 100644 --- a/experimental/python/databricks/bundles/jobs/_models/dbt_cloud_task.py +++ b/experimental/python/databricks/bundles/jobs/_models/dbt_platform_task.py @@ -10,41 +10,41 @@ @dataclass(kw_only=True) -class DbtCloudTask: +class DbtPlatformTask: """ :meta private: [EXPERIMENTAL] """ connection_resource_name: VariableOrOptional[str] = None """ - The resource name of the UC connection that authenticates the dbt Cloud for this task + The resource name of the UC connection that authenticates the dbt platform for this task """ - dbt_cloud_job_id: VariableOrOptional[int] = None + dbt_platform_job_id: VariableOrOptional[str] = None """ - Id of the dbt Cloud job to be triggered + Id of the dbt platform job to be triggered. Specified as a string for maximum compatibility with clients. """ @classmethod - def from_dict(cls, value: "DbtCloudTaskDict") -> "Self": + def from_dict(cls, value: "DbtPlatformTaskDict") -> "Self": return _transform(cls, value) - def as_dict(self) -> "DbtCloudTaskDict": + def as_dict(self) -> "DbtPlatformTaskDict": return _transform_to_json_value(self) # type:ignore -class DbtCloudTaskDict(TypedDict, total=False): +class DbtPlatformTaskDict(TypedDict, total=False): """""" connection_resource_name: VariableOrOptional[str] """ - The resource name of the UC connection that authenticates the dbt Cloud for this task + The resource name of the UC connection that authenticates the dbt platform for this task """ - dbt_cloud_job_id: VariableOrOptional[int] + dbt_platform_job_id: VariableOrOptional[str] """ - Id of the dbt Cloud job to be triggered + Id of the dbt platform job to be triggered. Specified as a string for maximum compatibility with clients. """ -DbtCloudTaskParam = DbtCloudTaskDict | DbtCloudTask +DbtPlatformTaskParam = DbtPlatformTaskDict | DbtPlatformTask diff --git a/experimental/python/databricks/bundles/jobs/_models/task.py b/experimental/python/databricks/bundles/jobs/_models/task.py index 8da07a4ab3..d20e36cc5a 100644 --- a/experimental/python/databricks/bundles/jobs/_models/task.py +++ b/experimental/python/databricks/bundles/jobs/_models/task.py @@ -28,9 +28,9 @@ DashboardTask, DashboardTaskParam, ) -from databricks.bundles.jobs._models.dbt_cloud_task import ( - DbtCloudTask, - DbtCloudTaskParam, +from databricks.bundles.jobs._models.dbt_platform_task import ( + DbtPlatformTask, + DbtPlatformTaskParam, ) from databricks.bundles.jobs._models.dbt_task import DbtTask, DbtTaskParam from databricks.bundles.jobs._models.for_each_task import ( @@ -125,11 +125,9 @@ class Task: The task refreshes a dashboard and sends a snapshot to subscribers. """ - dbt_cloud_task: VariableOrOptional[DbtCloudTask] = None + dbt_platform_task: VariableOrOptional[DbtPlatformTask] = None """ :meta private: [EXPERIMENTAL] - - Task type for dbt cloud """ dbt_task: VariableOrOptional[DbtTask] = None @@ -330,11 +328,9 @@ class TaskDict(TypedDict, total=False): The task refreshes a dashboard and sends a snapshot to subscribers. """ - dbt_cloud_task: VariableOrOptional[DbtCloudTaskParam] + dbt_platform_task: VariableOrOptional[DbtPlatformTaskParam] """ :meta private: [EXPERIMENTAL] - - Task type for dbt cloud """ dbt_task: VariableOrOptional[DbtTaskParam] diff --git a/experimental/python/databricks/bundles/pipelines/__init__.py b/experimental/python/databricks/bundles/pipelines/__init__.py index 01e7892ac4..f34f79dcb4 100644 --- a/experimental/python/databricks/bundles/pipelines/__init__.py +++ b/experimental/python/databricks/bundles/pipelines/__init__.py @@ -90,6 +90,9 @@ "PipelinePermissionLevel", "PipelinePermissionLevelParam", "PipelinePermissionParam", + "PipelinesEnvironment", + "PipelinesEnvironmentDict", + "PipelinesEnvironmentParam", "ReportSpec", "ReportSpecDict", "ReportSpecParam", @@ -291,6 +294,11 @@ PipelinePermissionLevel, PipelinePermissionLevelParam, ) +from databricks.bundles.pipelines._models.pipelines_environment import ( + PipelinesEnvironment, + PipelinesEnvironmentDict, + PipelinesEnvironmentParam, +) from databricks.bundles.pipelines._models.report_spec import ( ReportSpec, ReportSpecDict, diff --git a/experimental/python/databricks/bundles/pipelines/_models/ingestion_config.py b/experimental/python/databricks/bundles/pipelines/_models/ingestion_config.py index c452222df9..988227c43e 100644 --- a/experimental/python/databricks/bundles/pipelines/_models/ingestion_config.py +++ b/experimental/python/databricks/bundles/pipelines/_models/ingestion_config.py @@ -4,7 +4,10 @@ from databricks.bundles.core._transform import _transform from databricks.bundles.core._transform_to_json import _transform_to_json_value from databricks.bundles.core._variable import VariableOrOptional -from databricks.bundles.pipelines._models.report_spec import ReportSpec, ReportSpecParam +from databricks.bundles.pipelines._models.report_spec import ( + ReportSpec, + ReportSpecParam, +) from databricks.bundles.pipelines._models.schema_spec import SchemaSpec, SchemaSpecParam from databricks.bundles.pipelines._models.table_spec import TableSpec, TableSpecParam diff --git a/experimental/python/databricks/bundles/pipelines/_models/pipeline.py b/experimental/python/databricks/bundles/pipelines/_models/pipeline.py index 936842ea92..f4435845f4 100644 --- a/experimental/python/databricks/bundles/pipelines/_models/pipeline.py +++ b/experimental/python/databricks/bundles/pipelines/_models/pipeline.py @@ -41,6 +41,10 @@ PipelinePermission, PipelinePermissionParam, ) +from databricks.bundles.pipelines._models.pipelines_environment import ( + PipelinesEnvironment, + PipelinesEnvironmentParam, +) from databricks.bundles.pipelines._models.restart_window import ( RestartWindow, RestartWindowParam, @@ -97,6 +101,13 @@ class Pipeline(Resource): Pipeline product edition. """ + environment: VariableOrOptional[PipelinesEnvironment] = None + """ + :meta private: [EXPERIMENTAL] + + Environment specification for this pipeline used to install dependencies. + """ + event_log: VariableOrOptional[EventLogSpec] = None """ Event log configuration for this pipeline @@ -247,6 +258,13 @@ class PipelineDict(TypedDict, total=False): Pipeline product edition. """ + environment: VariableOrOptional[PipelinesEnvironmentParam] + """ + :meta private: [EXPERIMENTAL] + + Environment specification for this pipeline used to install dependencies. + """ + event_log: VariableOrOptional[EventLogSpecParam] """ Event log configuration for this pipeline diff --git a/experimental/python/databricks/bundles/pipelines/_models/pipelines_environment.py b/experimental/python/databricks/bundles/pipelines/_models/pipelines_environment.py new file mode 100644 index 0000000000..bf92d5306c --- /dev/null +++ b/experimental/python/databricks/bundles/pipelines/_models/pipelines_environment.py @@ -0,0 +1,47 @@ +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.core._transform import _transform +from databricks.bundles.core._transform_to_json import _transform_to_json_value +from databricks.bundles.core._variable import VariableOrList + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class PipelinesEnvironment: + """ + :meta private: [EXPERIMENTAL] + + The environment entity used to preserve serverless environment side panel, jobs' environment for non-notebook task, and DLT's environment for classic and serverless pipelines. + In this minimal environment spec, only pip dependencies are supported. + """ + + dependencies: VariableOrList[str] = field(default_factory=list) + """ + List of pip dependencies, as supported by the version of pip in this environment. + Each dependency is a pip requirement file line https://pip.pypa.io/en/stable/reference/requirements-file-format/ + Allowed dependency could be , , (WSFS or Volumes in Databricks), + """ + + @classmethod + def from_dict(cls, value: "PipelinesEnvironmentDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "PipelinesEnvironmentDict": + return _transform_to_json_value(self) # type:ignore + + +class PipelinesEnvironmentDict(TypedDict, total=False): + """""" + + dependencies: VariableOrList[str] + """ + List of pip dependencies, as supported by the version of pip in this environment. + Each dependency is a pip requirement file line https://pip.pypa.io/en/stable/reference/requirements-file-format/ + Allowed dependency could be , , (WSFS or Volumes in Databricks), + """ + + +PipelinesEnvironmentParam = PipelinesEnvironmentDict | PipelinesEnvironment From 8e3c12b3da298ba59b707aab9b4b876e5ec873df Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 23 Jun 2025 18:02:11 +0200 Subject: [PATCH 4/4] regenerate acc --- acceptance/help/output.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/acceptance/help/output.txt b/acceptance/help/output.txt index cdfa4d5a82..ca2a59a9d8 100644 --- a/acceptance/help/output.txt +++ b/acceptance/help/output.txt @@ -124,6 +124,9 @@ Clean Rooms clean-room-task-runs Clean room task runs are the executions of notebooks in a clean room. clean-rooms A clean room uses Delta Sharing and serverless compute to provide a secure and privacy-protecting environment where multiple parties can work together on sensitive enterprise data without direct access to each other’s data. +Database + database Database Instances provide access to a database via REST API or direct SQL. + Quality Monitor v2 quality-monitor-v2 Manage data quality of UC objects (currently support schema).