-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'terraform-plugin-framework' into main-16July
- Loading branch information
Showing
25 changed files
with
30,021 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// 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}} | ||
} | ||
|
||
{{else if .MapValue}}{{.Comment "// " 80}} | ||
type {{.PascalName}} {{template "type" .}} | ||
{{else if .Enum}}{{.Comment "// " 80}} | ||
type {{.PascalName}} string | ||
{{range .Enum }} | ||
{{.Comment "// " 80}} | ||
const {{.Entity.PascalName}}{{.PascalName}} {{.Entity.PascalName}} = `{{.Content}}`{{end}} | ||
|
||
// String representation for [fmt.Print] | ||
func (f *{{.PascalName}}) String() string { | ||
return string(*f) | ||
} | ||
|
||
// Set raw string value and validate it against allowed values | ||
func (f *{{.PascalName}}) Set(v string) error { | ||
switch v { | ||
case {{range $i, $e := .Enum }}{{if $i}}, {{end}}`{{.Content}}`{{end}}: | ||
*f = {{.PascalName}}(v) | ||
return nil | ||
default: | ||
return fmt.Errorf(`value "%s" is not one of {{range $i, $e := .Enum }}{{if $i}}, {{end}}"{{.Content}}"{{end}}`, v) | ||
} | ||
} | ||
|
||
// Type always returns {{.PascalName}} to satisfy [pflag.Value] interface | ||
func (f *{{.PascalName}}) Type() string { | ||
return "{{.PascalName}}" | ||
} | ||
{{end}} | ||
{{end}} | ||
|
||
{{- define "field-tag" -}} | ||
{{if .IsJson}}tfsdk:"{{.Name}}"{{else}}tfsdk:"-"{{end -}} | ||
{{if .IsPath}} url:"-"{{end -}} | ||
{{if .IsHeader}} url:"-" header:"{{.Name}}{{if not .Required}},omitempty{{end}}"{{end -}} | ||
{{if .IsQuery}} url:"{{.Name}}{{if not .Required}},omitempty{{end}}"{{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 }}{{.PascalName}} | ||
{{- else}}any /* MISSING TYPE */ | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
service/billing_tf/model.go linguist-generated=true | ||
service/catalog_tf/model.go linguist-generated=true | ||
service/compute_tf/model.go linguist-generated=true | ||
service/dashboards_tf/model.go linguist-generated=true | ||
service/files_tf/model.go linguist-generated=true | ||
service/iam_tf/model.go linguist-generated=true | ||
service/jobs_tf/model.go linguist-generated=true | ||
service/marketplace_tf/model.go linguist-generated=true | ||
service/ml_tf/model.go linguist-generated=true | ||
service/oauth2_tf/model.go linguist-generated=true | ||
service/pipelines_tf/model.go linguist-generated=true | ||
service/provisioning_tf/model.go linguist-generated=true | ||
service/serving_tf/model.go linguist-generated=true | ||
service/settings_tf/model.go linguist-generated=true | ||
service/sharing_tf/model.go linguist-generated=true | ||
service/sql_tf/model.go linguist-generated=true | ||
service/vectorsearch_tf/model.go linguist-generated=true | ||
service/workspace_tf/model.go linguist-generated=true |
Oops, something went wrong.