Skip to content

Commit

Permalink
[ignore] quick renaming for template function GetDefaultValues.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmicol committed May 3, 2024
1 parent 3f2b6fc commit b07d16a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var templateFuncs = template.FuncMap{
"createNonExistingValue": func(val string) string { return fmt.Sprintf("non_existing_%s", val) },
"getParentTestDependencies": GetParentTestDependencies,
"getTargetTestDependencies": GetTargetTestDependencies,
"GetDefaultValues": GetDefaultValues,
"getDefaultValues": GetDefaultValues,
"fromInterfacesToString": FromInterfacesToString,
"containsNoneAttributeValue": ContainsNoneAttributeValue,
"definedInMap": DefinedInMap,
Expand Down
8 changes: 4 additions & 4 deletions gen/templates/datasource.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
{{- if or .HasBitmask }}
"github.com/hashicorp/terraform-plugin-framework/types"
{{- end}}
{{- if GetDefaultValues .PkgName "parent_dn" $.Definitions}}
{{- if getDefaultValues .PkgName "parent_dn" $.Definitions}}
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
{{- end}}
"github.com/hashicorp/terraform-plugin-log/tflog"
Expand Down Expand Up @@ -52,7 +52,7 @@ func (d *{{.ResourceClassName}}DataSource) Schema(ctx context.Context, req datas
},
{{- if .HasParent}}
"parent_dn": schema.StringAttribute{
{{- if GetDefaultValues .PkgName "parent_dn" $.Definitions}}
{{- if getDefaultValues .PkgName "parent_dn" $.Definitions}}
Optional: true,
{{- else}}
Required: true,
Expand Down Expand Up @@ -145,9 +145,9 @@ func (d *{{.ResourceClassName}}DataSource) Read(ctx context.Context, req datasou

getAndSet{{.ResourceClassName}}Attributes(ctx, &resp.Diagnostics, d.client, data)

{{ if GetDefaultValues .PkgName "parent_dn" $.Definitions}}
{{ if getDefaultValues .PkgName "parent_dn" $.Definitions}}
if data.ParentDn.IsNull() || data.ParentDn.IsUnknown(){
data.ParentDn = basetypes.NewStringValue("{{GetDefaultValues .PkgName "parent_dn" $.Definitions}}")
data.ParentDn = basetypes.NewStringValue("{{getDefaultValues .PkgName "parent_dn" $.Definitions}}")
}
{{- end}}

Expand Down
4 changes: 2 additions & 2 deletions gen/templates/datasource.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Data source for {{.ResourceNameAsDescription}}
{{- range .DocumentationParentDns}}
- {{ . }}
{{- end}}
{{- if GetDefaultValues .PkgName "parent_dn" $.Definitions}}
- Default: `{{ GetDefaultValues .PkgName "parent_dn" $.Definitions}}`
{{- if getDefaultValues .PkgName "parent_dn" $.Definitions}}
- Default: `{{ getDefaultValues .PkgName "parent_dn" $.Definitions}}`
{{ end}}
{{- end}}
{{- range .Properties}}
Expand Down
4 changes: 2 additions & 2 deletions gen/templates/resource.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ func (r *{{.ResourceClassName}}Resource) Schema(ctx context.Context, req resourc
},
{{- if .HasParent}}
"parent_dn": schema.StringAttribute{
{{- if GetDefaultValues .PkgName "parent_dn" $.Definitions}}
{{- if getDefaultValues .PkgName "parent_dn" $.Definitions}}
Optional: true,
Computed: true,
Default: stringdefault.StaticString("{{GetDefaultValues .PkgName "parent_dn" $.Definitions}}"),
Default: stringdefault.StaticString("{{getDefaultValues .PkgName "parent_dn" $.Definitions}}"),
{{- else}}
Required: true,
{{- end}}
Expand Down
6 changes: 3 additions & 3 deletions gen/templates/resource.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ All examples for the {{.ResourceNameAsDescription}} resource can be found in the
## Schema ##

### Required ###
{{ if and .HasParent (not (GetDefaultValues .PkgName "parent_dn" $.Definitions))}}
{{ if and .HasParent (not (getDefaultValues .PkgName "parent_dn" $.Definitions))}}
* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources:
{{- range .DocumentationParentDns}}
- {{ . }}
Expand All @@ -89,12 +89,12 @@ All examples for the {{.ResourceNameAsDescription}} resource can be found in the
{{- if .HasOptionalProperties}}

### Optional ###
{{- if and .HasParent (GetDefaultValues .PkgName "parent_dn" $.Definitions)}}
{{- if and .HasParent (getDefaultValues .PkgName "parent_dn" $.Definitions)}}
* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources:
{{- range .DocumentationParentDns}}
- {{ . }}
{{- end}}
- Default: `{{ GetDefaultValues .PkgName "parent_dn" $.Definitions}}`
- Default: `{{ getDefaultValues .PkgName "parent_dn" $.Definitions}}`
{{- end}}
{{ range .Properties}}
{{- if and (not .IsNaming) (not .IsRequired)}}
Expand Down

0 comments on commit b07d16a

Please sign in to comment.