-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding processing for bool with associated external type (#31)
- Loading branch information
1 parent
cd665dd
commit 2894156
Showing
7 changed files
with
176 additions
and
30 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
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
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,23 @@ | ||
func To{{.Name}}(ctx context.Context, tfBool types.Bool) ({{.Type}}, diag.Diagnostics) { | ||
var diags diag.Diagnostics | ||
|
||
if tfBool.IsNull() || tfBool.IsUnknown() { | ||
return nil, diags | ||
} | ||
|
||
apiObject := &{{.TypeReference}}{ | ||
{{.Name}}: tfBool.ValueBoolPointer(), | ||
} | ||
|
||
return apiObject, diags | ||
} | ||
|
||
func From{{.Name}}(ctx context.Context, apiObject {{.Type}}) (types.Bool, diag.Diagnostics) { | ||
var diags diag.Diagnostics | ||
|
||
if apiObject == nil { | ||
return types.BoolNull(), diags | ||
} | ||
|
||
return types.BoolPointerValue(apiObject.{{.Name}}), diags | ||
} |
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