Documentation
¶
Index ¶
- func DebugLogGraphObject(ctx context.Context, message string, object serialization.Parsable) error
- func SetBoolProperty(value basetypes.BoolValue, setter func(*bool))
- func SetBytesProperty(value basetypes.StringValue, setter func([]byte))
- func SetEnumProperty[T any](value basetypes.StringValue, parser func(string) (any, error), setter func(T)) error
- func SetISODurationProperty(value basetypes.StringValue, setter func(*serialization.ISODuration)) error
- func SetInt32Property(value basetypes.Int32Value, setter func(*int32))
- func SetInt64Property(value basetypes.Int64Value, setter func(*int64))
- func SetStringList(ctx context.Context, list types.List, setter func([]string)) error
- func SetStringProperty(value basetypes.StringValue, setter func(*string))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugLogGraphObject ¶
DebugLogGraphObject is a helper function to serialize and debug log Microsoft Graph objects that implement serialization.Parsable. This function takes a Microsoft Graph object (like a policy, device configuration, etc.) and converts it into a human-readable JSON format before it gets sent to Microsoft's API. It's like taking a snapshot of what we're about to send.
Parameters:
- ctx: The context for logging
- message: A descriptive message that will prefix the JSON in the logs
- object: Any Microsoft Graph object that implements serialization.Parsable
Returns:
- error: Any error encountered during serialization or logging
Usage example:
if err := debugLogGraphObject(ctx, "Final JSON to be sent to Graph API", profile); err != nil { tflog.Error(ctx, "Failed to debug log object", map[string]interface{}{ "error": err.Error(), }) }
func SetBoolProperty ¶
SetBoolProperty sets the value of a bool property if the value is not null or unknown. It accepts a basetypes.BoolValue (Terraform SDK type) and translates it into a pointer to a bool for use in the setter function.
func SetBytesProperty ¶
func SetBytesProperty(value basetypes.StringValue, setter func([]byte))
SetBytesProperty sets the value of a byte slice property if the value is not null or unknown. It converts a basetypes.StringValue (Terraform SDK type) to a []byte and passes it to the setter function.
func SetEnumProperty ¶
func SetEnumProperty[T any](value basetypes.StringValue, parser func(string) (any, error), setter func(T)) error
SetEnumProperty parses an enum value and sets it if the value is not null or unknown. It accepts a basetypes.StringValue (Terraform SDK type) and uses a parser function to translate the string into an enum type. If the value is valid, it casts the parsed value to the expected type T and passes it to the msgraph-sdk-go setter function.
func SetISODurationProperty ¶
func SetISODurationProperty(value basetypes.StringValue, setter func(*serialization.ISODuration)) error
SetISODurationProperty parses an ISO 8601 duration string and sets the value if valid. It accepts a basetypes.StringValue (Terraform SDK type), parses it into ISODuration, and passes it to the setter function.
func SetInt32Property ¶
func SetInt32Property(value basetypes.Int32Value, setter func(*int32))
SetInt32Property sets the value of an int32 property if the value is not null or unknown. It accepts a basetypes.Int32Value (Terraform SDK type) and passes it to the msgraph-sdk-go setter function.
func SetInt64Property ¶
func SetInt64Property(value basetypes.Int64Value, setter func(*int64))
SetInt64Property sets the value of an int64 property if the value is not null or unknown. It accepts a basetypes.Int64Value (Terraform SDK type) and passes it to the msgraph-sdk-go setter function.
func SetStringList ¶
SetStringList constructs and sets a slice of strings from a Terraform ListAttribute. It handles null or unknown values and converts each element to a string and passes it to the msgraph-sdk-go setter function.
func SetStringProperty ¶
func SetStringProperty(value basetypes.StringValue, setter func(*string))
SetStringProperty sets the value of a string property if the value is not null or unknown. It accepts a basetypes.StringValue (Terraform SDK type) and translates it into a pointer to a string for use in the msgraph-sdk-go setter function.
Types ¶
This section is empty.