constructors

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetListFromSet

func GetListFromSet(data map[string]interface{}, key string) []interface{}

GetListFromSet is a helper function to safely extract a list of interfaces from a *schema.Set stored within a map[string]interface{}. It returns an empty slice if the key is not found or the value is not a *schema.Set.

func MapSetToStructs

func MapSetToStructs[NestedObjectType any, ListItemPrimitiveType comparable](path string, fieldName string, d *schema.ResourceData, outputSlice *[]NestedObjectType) error

MapSetToStructs transforms a schema.Set of primitive values (typically IDs) into a slice of structs by mapping each value to a specified field in a new struct instance.

Type parameters: - NestedObjectType: The target struct type (e.g., PolicySubsetNetworkSegment) - ListItemPrimitiveType: The primitive value type in the set (e.g., int, string)

The function relies on Terraform's schema validation to ensure values are of the correct type. This is typically used to transform schema.Set elements like IDs to API struct objects.

func ParseResourceID

func ParseResourceID(val interface{}, fieldName string, index int) (int, bool)

ParseResourceID ensures a value can be safely used as an ID in Jamf Pro resources. Handles int, float64, and string inputs with appropriate logging for conversion issues. Returns the validated integer ID and a success boolean.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL