Documentation
¶
Index ¶
- func DebugLogGraphObject(ctx context.Context, message string, object serialization.Parsable) error
- func SetBitmaskEnumProperty[T any](value basetypes.StringValue, parser func(string) (any, error), setter func(*T)) 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 SetObjectsFromStringSet[T any](ctx context.Context, set types.Set, ...) error
- func SetStringList(ctx context.Context, list types.List, setter func([]string)) error
- func SetStringProperty(value basetypes.StringValue, setter func(*string))
- func SetStringSet(ctx context.Context, set types.Set, setter func([]string)) error
- func SetUUIDProperty(value basetypes.StringValue, setter func(*uuid.UUID)) error
- func StringToDateOnly(value basetypes.StringValue, setter func(*serialization.DateOnly)) error
- func StringToTime(value basetypes.StringValue, setter func(*time.Time)) error
- func StringToTimeOnly(value types.String, setter func(*serialization.TimeOnly)) error
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 SetBitmaskEnumProperty ¶
func SetBitmaskEnumProperty[T any](value basetypes.StringValue, parser func(string) (any, error), setter func(*T)) error
SetBitmaskEnumProperty parses a bitmask-style enum and sets it using the provided setter. It expects the parser to return a pointer to the enum (e.g., *MyEnumType).
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 SetObjectsFromStringSet ¶
func SetObjectsFromStringSet[T any]( ctx context.Context, set types.Set, converter func(context.Context, []string) []T, setter func([]T)) error
SetObjectsFromStringSet is a generic function that constructs objects from a Terraform SetAttribute. It extracts string values from the set, passes them to a converter function to transform them into the desired object type, and then sets them using the provided 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.
func SetStringSet ¶
SetStringSet constructs and sets a slice of strings from a Terraform SetAttribute. It handles null or unknown values and converts each element to a string and passes it to the msgraph-sdk-go setter function.
func SetUUIDProperty ¶
func SetUUIDProperty(value basetypes.StringValue, setter func(*uuid.UUID)) error
SetUUIDProperty parses a string as a UUID and sets it using the provided setter. Returns an error if parsing fails. No-op if the value is null, unknown, or empty.
func StringToDateOnly ¶
func StringToDateOnly(value basetypes.StringValue, setter func(*serialization.DateOnly)) error
StringToDateOnly parses a string value into a DateOnly if the value is not null or unknown, and sets it using the provided setter function.
func StringToTime ¶
func StringToTime(value basetypes.StringValue, setter func(*time.Time)) error
StringToTime parses a string value into a time.Time if the value is not null or unknown, and sets it using the provided setter function.
func StringToTimeOnly ¶
func StringToTimeOnly(value types.String, setter func(*serialization.TimeOnly)) error
StringToTimeOnly converts a string in HH:MM format to a TimeOnly type for the Microsoft Graph SDK. It handles null or unknown values by returning nil, which is appropriate for optional time fields. The function accepts a basetypes.StringValue (Terraform SDK type) and returns a *serialization.TimeOnly.
Types ¶
This section is empty.