Documentation
¶
Overview ¶
Package impact answers "who is affected" by a policy change (ADR-0030): for every member of a population (the enrolled fleet, or a policy-only estimate), it resolves ring, experiment variants and effective settings under the base policy and under the new one, and counts who changes, per member kind and per org unit. Rings and variants resolve through policy.ResolveRing and Experiment.ResolveVariant, so internal/assign stays the only hashing.
Index ¶
Constants ¶
const ( KindUser = "user" KindDevice = "device" KindAgent = "agent" // a workload rule's subject (ADR-0023) KindGroup = "group" // policy estimate: one member of a group policy names KindSample = "sample" // policy estimate: an anonymous user in no listed group )
Member kinds.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Counts ¶
type Counts struct {
Total int `json:"total"`
Ring int `json:"ring"`
Variant int `json:"variant"`
Settings int `json:"settings"`
Any int `json:"any"`
}
Counts is how many members of a set change, by what.
type Example ¶
type Example struct {
ID string `json:"id"`
Kind string `json:"kind"`
Unit string `json:"unit,omitempty"`
RingBefore string `json:"ringBefore"`
RingAfter string `json:"ringAfter"`
Before []string `json:"variantsBefore,omitempty"` // experiment=variant
After []string `json:"variantsAfter,omitempty"`
Settings bool `json:"settingsChanged"`
}
Example is one affected member.
type FleetDevice ¶
type FleetDevice struct {
ID string `json:"id"`
UserID string `json:"userID"`
Groups []string `json:"groups,omitempty"`
// Revoked devices get nothing either way.
Revoked bool `json:"revoked"`
}
FleetDevice is the part of a halo-server device record impact reads.
type FleetHost ¶
type FleetHost struct {
Hostname string `json:"hostname"`
User string `json:"user"`
Device string `json:"device,omitempty"`
}
FleetHost is the part of a halo-server fleet host impact reads.
type Member ¶
type Member struct {
ID string `json:"id"`
Groups []string `json:"groups,omitempty"`
Kind string `json:"kind"`
Device string `json:"device,omitempty"`
}
Member is one subject a change may reach.
func FleetMembers ¶
func FleetMembers(hosts []FleetHost, devices []FleetDevice, orgs ...*policy.Org) []Member
FleetMembers is the enrolled population: each reporting host as a device (groups from its enrollment), each distinct user once (their devices' groups), plus the orgs' workload subjects as agents.
func PolicyMembers ¶
PolicyMembers is the population a policy-only estimate uses: every user id the orgs name (ring and unit members), one member of each group they name, each workload rule's subject, and samples anonymous users (hashing places them like any user in no listed group).
type Report ¶
type Report struct {
// Source is "fleet" (halo-server's enrolled devices) or "policy" (an
// estimate from the users and groups policy names plus a hashed sample).
Source string `json:"source"`
ByKind map[string]Counts `json:"byKind"`
ByUnit []UnitImpact `json:"byUnit"`
Examples []Example `json:"examples"`
}
Report is the impact of a change on a population.
type UnitImpact ¶
UnitImpact is the counts of one org unit ("" = in no unit).