Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardfeng-db committed Aug 16, 2024
1 parent 2855ef5 commit 3f43024
Show file tree
Hide file tree
Showing 21 changed files with 20,157 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .codegen.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"formatter": "make fmt",
"packages": {
".codegen/model.go.tmpl": "internal/service/{{.Name}}_tf/model.go"
},
"changelog_config": ".codegen/changelog_config.yml",
"version": {
"common/version.go": "version = \"$VERSION\""
Expand Down
54 changes: 54 additions & 0 deletions .codegen/model.go.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
/*
These generated types are for terraform plugin framework to interact with the terraform state conveniently.

These types follow the same structure as the types in go-sdk.
The only difference is that the primitive types are no longer using the go-native types, but with tfsdk types.
Plus the json tags get converted into tfsdk tags.
We use go-native types for lists and maps intentionally for the ease for converting these types into the go-sdk types.
*/

package {{.Name}}_tf

import (
{{range .ImportedPackages}}
"github.com/databricks/databricks-sdk-go/service/{{.}}"{{end}}
"github.com/databricks/databricks-sdk-go/service/{{.Name}}"
"io"
"github.com/databricks/databricks-sdk-go/marshal"
"github.com/hashicorp/terraform-plugin-framework/types"
)
{{range .Types}}
{{- if or .Fields .IsEmpty}}
{{.Comment "// " 80}}
type {{.PascalName}} struct {
{{- range .Fields}}
{{.Comment " // " 80}}
{{.PascalName}} {{if .IsOptionalObject}}*{{end}}{{template "type" .Entity}} `{{template "field-tag" . }}`{{end}}
}

{{end}}
{{end}}

{{- define "field-tag" -}}
{{if .IsJson}}tfsdk:"{{.Name}}" tf:"{{if not .Required}}optional{{end}}"{{else}}tfsdk:"-"{{end -}}
{{- end -}}

{{- define "type" -}}
{{- if not . }}any /* ERROR */
{{- else if .IsExternal }}{{.Package.Name}}.{{.PascalName}}
{{- else if .IsAny}}any
{{- else if .IsEmpty}}{{.PascalName}}
{{- else if .IsString}}types.String
{{- else if .IsBool}}types.Bool
{{- else if .IsInt64}}types.Int64
{{- else if .IsFloat64}}types.Float64
{{- else if .IsInt}}types.Int64
{{- else if .IsByteStream}}io.ReadCloser
{{- else if .ArrayValue }}[]{{template "type" .ArrayValue}}
{{- else if .MapValue }}map[string]{{template "type" .MapValue}}
{{- else if .IsObject }}{{.PascalName}}
{{- else if .Enum }}types.String
{{- else}}any /* MISSING TYPE */
{{- end -}}
{{- end -}}
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
internal/service/billing_tf/model.go linguist-generated=true
internal/service/catalog_tf/model.go linguist-generated=true
internal/service/compute_tf/model.go linguist-generated=true
internal/service/dashboards_tf/model.go linguist-generated=true
internal/service/files_tf/model.go linguist-generated=true
internal/service/iam_tf/model.go linguist-generated=true
internal/service/jobs_tf/model.go linguist-generated=true
internal/service/marketplace_tf/model.go linguist-generated=true
internal/service/ml_tf/model.go linguist-generated=true
internal/service/oauth2_tf/model.go linguist-generated=true
internal/service/pipelines_tf/model.go linguist-generated=true
internal/service/provisioning_tf/model.go linguist-generated=true
internal/service/serving_tf/model.go linguist-generated=true
internal/service/settings_tf/model.go linguist-generated=true
internal/service/sharing_tf/model.go linguist-generated=true
internal/service/sql_tf/model.go linguist-generated=true
internal/service/vectorsearch_tf/model.go linguist-generated=true
internal/service/workspace_tf/model.go linguist-generated=true
381 changes: 381 additions & 0 deletions internal/service/billing_tf/model.go

Large diffs are not rendered by default.

Loading

0 comments on commit 3f43024

Please sign in to comment.