Documentation
¶
Overview ¶
Package parser reads fleet-gitops YAML files, resolves path: references, and produces normalized ParsedRepo structures for diffing. The schema and validation rules are derived from Fleet's Go source code, not documentation.
Index ¶
- Variables
- func ValidateLogging(logging string) bool
- func ValidatePlatform(platform string) []string
- type ParseError
- type ParsedAppStoreApp
- type ParsedFleetApp
- type ParsedGlobal
- type ParsedLabel
- type ParsedPolicy
- type ParsedProfile
- type ParsedQuery
- type ParsedRepo
- type ParsedSoftware
- type ParsedSoftwarePackage
- type ParsedTeam
Constants ¶
This section is empty.
Variables ¶
var ValidLabelMembershipTypes = map[string]bool{ "dynamic": true, "manual": true, "host_vitals": true, }
Valid label membership types (from server/fleet/labels.go).
var ValidLogging = map[string]bool{ "snapshot": true, "differential": true, "differential_ignore_removals": true, }
Valid logging types (from server/fleet/queries.go).
var ValidPlatforms = map[string]bool{ "darwin": true, "windows": true, "linux": true, "chrome": true, }
Valid platform identifiers (from server/fleet/policies.go and queries.go).
var ValidTopLevelKeys = map[string]bool{ "name": true, "team_settings": true, "org_settings": true, "agent_options": true, "controls": true, "policies": true, "queries": true, "software": true, "labels": true, }
Valid top-level YAML keys (from pkg/spec/gitops.go).
Functions ¶
func ValidateLogging ¶
ValidateLogging checks if a logging value is valid.
func ValidatePlatform ¶
ValidatePlatform checks if a platform string contains only valid identifiers.
Types ¶
type ParseError ¶
ParseError represents a parse/validation error with file context.
func (ParseError) Error ¶
func (e ParseError) Error() string
type ParsedAppStoreApp ¶
type ParsedAppStoreApp struct {
AppStoreID string `yaml:"app_store_id"`
SelfService bool `yaml:"self_service"`
}
ParsedAppStoreApp represents an App Store app.
type ParsedFleetApp ¶
ParsedFleetApp represents a Fleet-maintained app.
type ParsedGlobal ¶
type ParsedGlobal struct {
OrgSettings map[string]any // raw org_settings as nested map
AgentOptions map[string]any // raw agent_options as nested map
Controls map[string]any // raw controls as nested map
Policies []ParsedPolicy
Queries []ParsedQuery
SourceFile string
}
ParsedGlobal holds global configuration parsed from default.yml.
type ParsedLabel ¶
type ParsedLabel struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Query string `yaml:"query"`
Platform string `yaml:"platform"`
LabelMembershipType string `yaml:"label_membership_type"`
SourceFile string `yaml:"-"`
}
ParsedLabel represents a label from YAML.
type ParsedPolicy ¶
type ParsedPolicy struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Resolution string `yaml:"resolution"`
Query string `yaml:"query"`
Platform string `yaml:"platform"`
Critical bool `yaml:"critical"`
LabelsIncludeAny []string `yaml:"labels_include_any"`
LabelsExcludeAny []string `yaml:"labels_exclude_any"`
SourceFile string `yaml:"-"`
}
ParsedPolicy represents a policy from YAML.
type ParsedProfile ¶
type ParsedProfile struct {
Path string `yaml:"path"`
Name string `yaml:"-"` // extracted from file content (PayloadDisplayName, etc.)
Platform string `yaml:"-"` // inferred from file extension
SourceFile string `yaml:"-"`
}
ParsedProfile represents an MDM profile reference.
type ParsedQuery ¶
type ParsedQuery struct {
Name string `yaml:"name"`
Query string `yaml:"query"`
Interval uint `yaml:"interval"`
Platform string `yaml:"platform"`
Logging string `yaml:"logging"`
SourceFile string `yaml:"-"`
}
ParsedQuery represents a query from YAML.
type ParsedRepo ¶
type ParsedRepo struct {
Teams []ParsedTeam
Labels []ParsedLabel
Global *ParsedGlobal // from default.yml (org_settings, agent_options, controls, policies, queries)
Errors []ParseError
}
ParsedRepo represents the fully parsed fleet-gitops repository.
func ParseRepo ¶
func ParseRepo(root string, teamFilter string, defaultFile string) (*ParsedRepo, error)
ParseRepo parses the fleet-gitops repository at the given root directory. If teamFilter is non-empty, only that team is parsed. If defaultFile is non-empty, it is used as the path to default.yml (the pre-merged global config). Otherwise, the parser looks for default.yml in the repo root directory.
type ParsedSoftware ¶
type ParsedSoftware struct {
Packages []ParsedSoftwarePackage `yaml:"packages"`
FleetMaintained []ParsedFleetApp `yaml:"fleet_maintained_apps"`
AppStoreApps []ParsedAppStoreApp `yaml:"app_store_apps"`
}
ParsedSoftware holds all software types for a team.
type ParsedSoftwarePackage ¶
type ParsedSoftwarePackage struct {
URL string `yaml:"url"`
HashSHA256 string `yaml:"hash_sha256"`
SelfService bool `yaml:"self_service"`
SourceFile string `yaml:"-"`
RefPath string `yaml:"-"`
}
ParsedSoftwarePackage represents a custom software package.
type ParsedTeam ¶
type ParsedTeam struct {
Name string
Policies []ParsedPolicy
Queries []ParsedQuery
Software ParsedSoftware
Profiles []ParsedProfile
SourceFile string
}
ParsedTeam represents a single team's configuration.