type AttributePattern … // NewAttributePattern produces a new mutable AttributePattern based on a variable name. func NewAttributePattern(variable string) *AttributePattern { … } // QualString adds a string qualifier pattern to the AttributePattern. The string may be a valid // identifier, or string map key including empty string. func (apat *AttributePattern) QualString(pattern string) *AttributePattern { … } // QualInt adds an int qualifier pattern to the AttributePattern. The index may be either a map or // list index. func (apat *AttributePattern) QualInt(pattern int64) *AttributePattern { … } // QualUint adds an uint qualifier pattern for a map index operation to the AttributePattern. func (apat *AttributePattern) QualUint(pattern uint64) *AttributePattern { … } // QualBool adds a bool qualifier pattern for a map index operation to the AttributePattern. func (apat *AttributePattern) QualBool(pattern bool) *AttributePattern { … } // Wildcard adds a special sentinel qualifier pattern that will match any single qualifier. func (apat *AttributePattern) Wildcard() *AttributePattern { … } // VariableMatches returns true if the fully qualified variable matches the AttributePattern // fully qualified variable name. func (apat *AttributePattern) VariableMatches(variable string) bool { … } // QualifierPatterns returns the set of AttributeQualifierPattern values on the AttributePattern. func (apat *AttributePattern) QualifierPatterns() []*AttributeQualifierPattern { … } type AttributeQualifierPattern … // Matches returns true if the qualifier pattern is a wildcard, or the Qualifier implements the // qualifierValueEquator interface and its IsValueEqualTo returns true for the qualifier pattern. func (qpat *AttributeQualifierPattern) Matches(q Qualifier) bool { … } type qualifierValueEquator … // QualifierValueEquals implementation for boolean qualifiers. func (q *boolQualifier) QualifierValueEquals(value any) bool { … } // QualifierValueEquals implementation for field qualifiers. func (q *fieldQualifier) QualifierValueEquals(value any) bool { … } // QualifierValueEquals implementation for string qualifiers. func (q *stringQualifier) QualifierValueEquals(value any) bool { … } // QualifierValueEquals implementation for int qualifiers. func (q *intQualifier) QualifierValueEquals(value any) bool { … } // QualifierValueEquals implementation for uint qualifiers. func (q *uintQualifier) QualifierValueEquals(value any) bool { … } // QualifierValueEquals implementation for double qualifiers. func (q *doubleQualifier) QualifierValueEquals(value any) bool { … } // numericValueEquals uses CEL equality to determine whether two number values are func numericValueEquals(value any, celValue ref.Val) bool { … } // NewPartialAttributeFactory returns an AttributeFactory implementation capable of performing // AttributePattern matches with PartialActivation inputs. func NewPartialAttributeFactory(container *containers.Container, adapter types.Adapter, provider types.Provider, opts ...AttrFactoryOption) AttributeFactory { … } type partialAttributeFactory … // AbsoluteAttribute implementation of the AttributeFactory interface which wraps the // NamespacedAttribute resolution in an internal attributeMatcher object to dynamically match // unknown patterns from PartialActivation inputs if given. func (fac *partialAttributeFactory) AbsoluteAttribute(id int64, names ...string) NamespacedAttribute { … } // MaybeAttribute implementation of the AttributeFactory interface which ensure that the set of // 'maybe' NamespacedAttribute values are produced using the partialAttributeFactory rather than // the base AttributeFactory implementation. func (fac *partialAttributeFactory) MaybeAttribute(id int64, name string) Attribute { … } // matchesUnknownPatterns returns true if the variable names and qualifiers for a given // Attribute value match any of the ActivationPattern objects in the set of unknown activation // patterns on the given PartialActivation. // // For example, in the expression `a.b`, the Attribute is composed of variable `a`, with string // qualifier `b`. When a PartialActivation is supplied, it indicates that some or all of the data // provided in the input is unknown by specifying unknown AttributePatterns. An AttributePattern // that refers to variable `a` with a string qualifier of `c` will not match `a.b`; however, any // of the following patterns will match Attribute `a.b`: // // - `AttributePattern("a")` // - `AttributePattern("a").Wildcard()` // - `AttributePattern("a").QualString("b")` // - `AttributePattern("a").QualString("b").QualInt(0)` // // Any AttributePattern which overlaps an Attribute or vice-versa will produce an Unknown result // for the last pattern matched variable or qualifier in the Attribute. In the first matching // example, the expression id representing variable `a` would be listed in the Unknown result, // whereas in the other pattern examples, the qualifier `b` would be returned as the Unknown. func (fac *partialAttributeFactory) matchesUnknownPatterns( vars PartialActivation, attrID int64, variableNames []string, qualifiers []Qualifier) (*types.Unknown, error) { … } type attributeMatcher … // AddQualifier implements the Attribute interface method. func (m *attributeMatcher) AddQualifier(qual Qualifier) (Attribute, error) { … } // Resolve is an implementation of the NamespacedAttribute interface method which tests // for matching unknown attribute patterns and returns types.Unknown if present. Otherwise, // the standard Resolve logic applies. func (m *attributeMatcher) Resolve(vars Activation) (any, error) { … } // Qualify is an implementation of the Qualifier interface method. func (m *attributeMatcher) Qualify(vars Activation, obj any) (any, error) { … } // QualifyIfPresent is an implementation of the Qualifier interface method. func (m *attributeMatcher) QualifyIfPresent(vars Activation, obj any, presenceOnly bool) (any, bool, error) { … } func toPartialActivation(vars Activation) (PartialActivation, bool) { … }