Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Go SDK to v0.34.0 #1256

Merged
merged 5 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codegen/_openapi_sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cdd76a98a4fca7008572b3a94427566dd286c63b
d855b30f25a06fe84f25214efa20e7f1fffcdf9e
4 changes: 2 additions & 2 deletions .codegen/cmds-account.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package account
import (
"github.com/databricks/cli/cmd/root"
"github.com/spf13/cobra"
{{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) }}
{{range .Services}}{{if and .IsAccounts (not .HasParent)}}{{if not (in $excludes .KebabName) }}
{{.SnakeName}} "github.com/databricks/cli/cmd/account/{{(.TrimPrefix "account").KebabName}}"{{end}}{{end}}{{end}}
)

Expand All @@ -17,7 +17,7 @@ func New() *cobra.Command {
Short: `Databricks Account Commands`,
}

{{range .Services}}{{if .IsAccounts}}{{if not (in $excludes .KebabName) -}}
{{range .Services}}{{if and .IsAccounts (not .HasParent)}}{{if not (in $excludes .KebabName) -}}
cmd.AddCommand({{.SnakeName}}.New())
{{end}}{{end}}{{end}}

Expand Down
4 changes: 2 additions & 2 deletions .codegen/cmds-workspace.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ package workspace

import (
"github.com/databricks/cli/cmd/root"
{{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) }}
{{range .Services}}{{if and (not .IsAccounts) (not .HasParent)}}{{if not (in $excludes .KebabName) }}
{{.SnakeName}} "github.com/databricks/cli/cmd/workspace/{{.KebabName}}"{{end}}{{end}}{{end}}
)

func All() []*cobra.Command {
var out []*cobra.Command

{{range .Services}}{{if not .IsAccounts}}{{if not (in $excludes .KebabName) -}}
{{range .Services}}{{if and (not .IsAccounts) (not .HasParent)}}{{if not (in $excludes .KebabName) -}}
out = append(out, {{.SnakeName}}.New())
{{end}}{{end}}{{end}}

Expand Down
49 changes: 38 additions & 11 deletions .codegen/service.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (
"github.com/databricks/cli/cmd/root"
"github.com/databricks/databricks-sdk-go/service/{{.Package.Name}}"
"github.com/spf13/cobra"

{{range .Subservices -}}
{{.SnakeName}} "github.com/databricks/cli/cmd/{{ if .ParentService.IsAccounts }}account{{ else }}workspace{{ end }}/{{.KebabName}}"
{{end}}
)

{{ $excludes :=
Expand All @@ -34,6 +38,8 @@ import (
]{{end}}{{end}}

{{define "service"}}
{{- $excludeMethods := list "put-secret" -}}

// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var cmdOverrides []func(*cobra.Command)
Expand All @@ -45,17 +51,36 @@ func New() *cobra.Command {
Short: `{{.Summary | without "`"}}`,
Long: `{{.Comment " " 80 | without "`"}}`,
{{- end }}
{{- if not .HasParent }}
pietern marked this conversation as resolved.
Show resolved Hide resolved
GroupID: "{{ .Package.Name }}",
Annotations: map[string]string{
"package": "{{ .Package.Name }}",
},
{{- end }}
{{- if .IsPrivatePreview }}

// This service is being previewed; hide from help output.
Hidden: true,
{{- end }}
}

{{ if gt (len .Methods) 0 -}}
// Add methods
{{- range .Methods}}
{{- if in $excludeMethods .KebabName }}
{{- continue}}
{{- end}}
cmd.AddCommand(new{{.PascalName}}())
{{- end}}
{{- end}}

{{ if .HasSubservices }}
// Add subservices
{{- range .Subservices}}
cmd.AddCommand({{.SnakeName}}.New())
{{- end}}
{{- end}}

// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
Expand All @@ -67,8 +92,7 @@ func New() *cobra.Command {
{{- $serviceName := .KebabName -}}
{{range .Methods}}

{{- $excludes := list "put-secret" -}}
{{if in $excludes .KebabName }}
{{if in $excludeMethods .KebabName }}
{{continue}}
{{end}}
// start {{.KebabName}} command
Expand Down Expand Up @@ -242,7 +266,7 @@ func new{{.PascalName}}() *cobra.Command {
return err
}
if {{.CamelName}}SkipWait {
{{if .Response -}}
{{if not .Response.IsEmpty -}}
return cmdio.Render(ctx, wait.Response)
{{- else -}}
return nil
Expand Down Expand Up @@ -291,26 +315,29 @@ func new{{.PascalName}}() *cobra.Command {
return cmd
}

func init() {
cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) {
cmd.AddCommand(new{{.PascalName}}())
})
}
{{end}}
// end service {{.Name}}{{end}}

{{- define "method-call" -}}
{{if .Response -}}
{{if not .Response.IsEmpty -}}
response{{ if not .Pagination}}, err{{end}} :=
{{- else -}}
err =
{{- end}} {{if .Service.IsAccounts}}a{{else}}w{{end}}.{{(.Service.TrimPrefix "account").PascalName}}.{{.PascalName}}(ctx{{if .Request}}, {{.CamelName}}Req{{end}})
{{- end}}
{{- if .Service.IsAccounts}}a{{else}}w{{end}}.
{{- if .Service.HasParent }}
{{- (.Service.ParentService.TrimPrefix "account").PascalName }}.
{{- (.Service.TrimPrefix "account").PascalName}}().
{{- else}}
{{- (.Service.TrimPrefix "account").PascalName}}.
{{- end}}
{{- .PascalName}}(ctx{{if .Request}}, {{.CamelName}}Req{{end}})
{{- if not (and .Response .Pagination) }}
if err != nil {
return err
}
{{- end}}
{{ if .Response -}}
{{ if not .Response.IsEmpty -}}
{{- if .IsResponseByteStream -}}
defer response.{{.ResponseBodyField.PascalName}}.Close()
return cmdio.Render{{ if .Pagination}}Iterator{{end}}(ctx, response.{{.ResponseBodyField.PascalName}})
Expand Down
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ cmd/account/billable-usage/billable-usage.go linguist-generated=true
cmd/account/budgets/budgets.go linguist-generated=true
cmd/account/cmd.go linguist-generated=true
cmd/account/credentials/credentials.go linguist-generated=true
cmd/account/csp-enablement-account/csp-enablement-account.go linguist-generated=true
cmd/account/custom-app-integration/custom-app-integration.go linguist-generated=true
cmd/account/encryption-keys/encryption-keys.go linguist-generated=true
cmd/account/esm-enablement-account/esm-enablement-account.go linguist-generated=true
cmd/account/groups/groups.go linguist-generated=true
cmd/account/ip-access-lists/ip-access-lists.go linguist-generated=true
cmd/account/log-delivery/log-delivery.go linguist-generated=true
Expand All @@ -14,6 +16,7 @@ cmd/account/metastores/metastores.go linguist-generated=true
cmd/account/network-connectivity/network-connectivity.go linguist-generated=true
cmd/account/networks/networks.go linguist-generated=true
cmd/account/o-auth-published-apps/o-auth-published-apps.go linguist-generated=true
cmd/account/personal-compute/personal-compute.go linguist-generated=true
cmd/account/private-access/private-access.go linguist-generated=true
cmd/account/published-app-integration/published-app-integration.go linguist-generated=true
cmd/account/service-principal-secrets/service-principal-secrets.go linguist-generated=true
Expand All @@ -28,17 +31,21 @@ cmd/account/workspaces/workspaces.go linguist-generated=true
cmd/workspace/alerts/alerts.go linguist-generated=true
cmd/workspace/apps/apps.go linguist-generated=true
cmd/workspace/artifact-allowlists/artifact-allowlists.go linguist-generated=true
cmd/workspace/automatic-cluster-update/automatic-cluster-update.go linguist-generated=true
cmd/workspace/catalogs/catalogs.go linguist-generated=true
cmd/workspace/clean-rooms/clean-rooms.go linguist-generated=true
cmd/workspace/cluster-policies/cluster-policies.go linguist-generated=true
cmd/workspace/clusters/clusters.go linguist-generated=true
cmd/workspace/cmd.go linguist-generated=true
cmd/workspace/connections/connections.go linguist-generated=true
cmd/workspace/credentials-manager/credentials-manager.go linguist-generated=true
cmd/workspace/csp-enablement/csp-enablement.go linguist-generated=true
cmd/workspace/current-user/current-user.go linguist-generated=true
cmd/workspace/dashboard-widgets/dashboard-widgets.go linguist-generated=true
cmd/workspace/dashboards/dashboards.go linguist-generated=true
cmd/workspace/data-sources/data-sources.go linguist-generated=true
cmd/workspace/default-namespace/default-namespace.go linguist-generated=true
cmd/workspace/esm-enablement/esm-enablement.go linguist-generated=true
cmd/workspace/experiments/experiments.go linguist-generated=true
cmd/workspace/external-locations/external-locations.go linguist-generated=true
cmd/workspace/functions/functions.go linguist-generated=true
Expand All @@ -57,6 +64,7 @@ cmd/workspace/metastores/metastores.go linguist-generated=true
cmd/workspace/model-registry/model-registry.go linguist-generated=true
cmd/workspace/model-versions/model-versions.go linguist-generated=true
cmd/workspace/online-tables/online-tables.go linguist-generated=true
cmd/workspace/permission-migration/permission-migration.go linguist-generated=true
cmd/workspace/permissions/permissions.go linguist-generated=true
cmd/workspace/pipelines/pipelines.go linguist-generated=true
cmd/workspace/policy-families/policy-families.go linguist-generated=true
Expand All @@ -68,6 +76,7 @@ cmd/workspace/recipient-activation/recipient-activation.go linguist-generated=tr
cmd/workspace/recipients/recipients.go linguist-generated=true
cmd/workspace/registered-models/registered-models.go linguist-generated=true
cmd/workspace/repos/repos.go linguist-generated=true
cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go linguist-generated=true
cmd/workspace/schemas/schemas.go linguist-generated=true
cmd/workspace/secrets/secrets.go linguist-generated=true
cmd/workspace/service-principals/service-principals.go linguist-generated=true
Expand Down
Loading
Loading