Documentation ¶
Overview ¶
common/configurationprofiles/plist/diffsuppression.go contains the functions to process configuration profiles.
common/configurationprofiles/plist/shared.go contains the shared functions to process configuration profiles.
common/configurationprofiles/plist/state.go contains the functions to process configuration profiles.
Index ¶
- func DecodePlist(plistData []byte) (map[string]interface{}, error)
- func EncodePlist(cleanedData map[string]interface{}) (string, error)
- func MarshalPayload(profile *ConfigurationProfile) (string, error)
- func MergeConfigurationProfileFieldsIntoMap(profile *ConfigurationProfile) map[string]interface{}
- func MergeCongfigurationPayloadFieldsIntoMap(payload *ConfigurationPayload) map[string]interface{}
- func NormalizePayloadState(payload any) string
- func ProcessConfigurationProfileForDiffSuppression(plistData string, fieldsToRemove []string) (string, error)
- func ProcessConfigurationProfileForState(plistData string) (string, error)
- func RemoveFields(data map[string]interface{}, fieldsToRemove []string, path string)
- func SortPlistKeys(data map[string]interface{}) map[string]interface{}
- func ValidatePayload(payload interface{}, key string) (warns []string, errs []error)
- func ValidatePayloadFields(profile *ConfigurationProfile) []error
- type ConfigurationPayload
- type ConfigurationProfile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePlist ¶
Function to decode a plist into a map without removing any fields
func EncodePlist ¶
EncodePlist encodes a cleaned map back to plist XML format
func MarshalPayload ¶
func MarshalPayload(profile *ConfigurationProfile) (string, error)
MarshalPayload marshals a ConfigurationProfile struct into a plist payload using mapstructure.
func MergeConfigurationProfileFieldsIntoMap ¶
func MergeConfigurationProfileFieldsIntoMap(profile *ConfigurationProfile) map[string]interface{}
MergeConfigurationProfileFieldsIntoMap merges the fields of a ConfigurationProfile struct into a map.
func MergeCongfigurationPayloadFieldsIntoMap ¶
func MergeCongfigurationPayloadFieldsIntoMap(payload *ConfigurationPayload) map[string]interface{}
MergeCongfigurationPayloadFieldsIntoMap merges the fields of a ConfigurationPayload struct into a map.
func NormalizePayloadState ¶
NormalizePayloadState normalizes a payload state by unmarshalling and remarshal it.
func ProcessConfigurationProfileForDiffSuppression ¶
func ProcessConfigurationProfileForDiffSuppression(plistData string, fieldsToRemove []string) (string, error)
ProcessConfigurationProfileForDiffSuppression processes the plist data, removes specified fields, and returns the cleaned plist XML as a string.
func ProcessConfigurationProfileForState ¶
ProcessConfigurationProfileForState processes the plist data, removes specified fields, and returns the cleaned plist XML as a string.
func RemoveFields ¶
RemoveFields removes specified fields from a nested map
func SortPlistKeys ¶
SortPlistKeys recursively sorts the keys of a nested map in alphabetical order, and sorts elements within arrays if they are strings or dictionaries.
func ValidatePayload ¶
ValidatePayload validates a payload by unmarshalling it and checking for required fields.
func ValidatePayloadFields ¶
func ValidatePayloadFields(profile *ConfigurationProfile) []error
ValidatePayloadFields validates the fields of a ConfigurationProfile struct.
Types ¶
type ConfigurationPayload ¶
type ConfigurationPayload struct { ConfigurationProfile PayloadOrganization string `mapstructure:"PayloadOrganization" validate:"required"` PayloadType string `mapstructure:"PayloadType" validate:"required"` AdditionalFields map[string]interface{} `mapstructure:",remain"` // contains filtered or unexported fields }
ConfigurationPayload represents a nested MacOS configuration profile.
type ConfigurationProfile ¶
type ConfigurationProfile struct { PayloadDescription string `mapstructure:"PayloadDescription"` PayloadDisplayName string `mapstructure:"PayloadDisplayName" validate:"required"` PayloadIdentifier string `mapstructure:"PayloadIdentifier" validate:"required"` PayloadOrganization string `mapstructure:"PayloadOrganization" validate:"required"` PayloadRemovalDisallowed bool `mapstructe:"PayloadRemovalDisallowed" validate:"required"` PayloadScope string `mapstructure:"PayloadScope" validate:"required,oneof=System User Computer"` PayloadType string `mapstructure:"PayloadType" validate:"required,eq=Configuration"` PayloadUUID string `mapstructure:"PayloadUUID" validate:"required"` PayloadVersion int `mapstructure:"PayloadVersion" validate:"required,eq=1"` PayloadContent []ConfigurationPayload `mapstructure:"PayloadContent"` AdditionalFields map[string]interface{} `mapstructure:",remain"` }
ConfigurationProfile represents a root level MacOS configuration profile.
func UnmarshalPayload ¶
func UnmarshalPayload(payload string) (*ConfigurationProfile, error)
UnmarshalPayload unmarshals a plist payload into a ConfigurationProfile struct using mapstructure.