profile

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Version = 1

Variables

View Source
var RequiredLifecycleBuckets = []string{"open", "closed_won", "closed_lost", "post_sales", "unknown"}

Functions

func CanonicalHash

func CanonicalHash(p *Profile) (string, error)

func CanonicalJSON

func CanonicalJSON(p *Profile) ([]byte, error)

func EvaluateRule

func EvaluateRule(values []string, rule Rule) (bool, error)

func IsValid

func IsValid(findings []Finding) bool

func MarshalYAML

func MarshalYAML(p *Profile) ([]byte, error)

func SourceHash

func SourceHash(body []byte) string

func ValidateBytes

func ValidateBytes(body []byte, inventory *Inventory) (*Profile, ValidationResult, error)

Types

type Evidence

type Evidence struct {
	Source             string   `json:"source,omitempty" yaml:"source,omitempty"`
	MatchedHeuristic   string   `json:"matched_heuristic,omitempty" yaml:"matched_heuristic,omitempty"`
	SampleSize         int      `json:"sample_size,omitempty" yaml:"sample_size,omitempty"`
	DistinctValueCount int      `json:"distinct_value_count,omitempty" yaml:"distinct_value_count,omitempty"`
	Values             []string `json:"values,omitempty" yaml:"values,omitempty"`
}

type FieldInventory

type FieldInventory struct {
	ObjectType     string   `json:"object_type"`
	FieldName      string   `json:"field_name"`
	FieldLabel     string   `json:"field_label,omitempty"`
	FieldType      string   `json:"field_type,omitempty"`
	ObjectCount    int      `json:"object_count"`
	PopulatedCount int      `json:"populated_count"`
	DistinctValues []string `json:"distinct_values,omitempty"`
}

type FieldMapping

type FieldMapping struct {
	Object     string    `json:"object,omitempty" yaml:"object,omitempty"`
	Names      []string  `json:"names,omitempty" yaml:"names,omitempty"`
	Confidence float64   `json:"confidence,omitempty" yaml:"confidence,omitempty"`
	Evidence   *Evidence `json:"evidence,omitempty" yaml:"evidence,omitempty"`
}

type FieldRef

type FieldRef struct {
	Object string `json:"object,omitempty" yaml:"object,omitempty"`
	Name   string `json:"name,omitempty" yaml:"name,omitempty"`
}

type Finding

type Finding struct {
	Severity string `json:"severity" yaml:"severity"`
	Code     string `json:"code" yaml:"code"`
	Message  string `json:"message" yaml:"message"`
	Path     string `json:"path,omitempty" yaml:"path,omitempty"`
}

func Validate

func Validate(p *Profile, inventory *Inventory) []Finding

type Inventory

type Inventory struct {
	Objects []ObjectInventory `json:"objects,omitempty"`
	Fields  []FieldInventory  `json:"fields,omitempty"`
}

type LifecycleBucket

type LifecycleBucket struct {
	Label       string    `json:"label,omitempty" yaml:"label,omitempty"`
	Description string    `json:"description,omitempty" yaml:"description,omitempty"`
	Order       int       `json:"order,omitempty" yaml:"order,omitempty"`
	Rules       []Rule    `json:"rules,omitempty" yaml:"rules,omitempty"`
	Confidence  float64   `json:"confidence,omitempty" yaml:"confidence,omitempty"`
	Evidence    *Evidence `json:"evidence,omitempty" yaml:"evidence,omitempty"`
}

type MethodologyConcept

type MethodologyConcept struct {
	Description          string     `json:"description,omitempty" yaml:"description,omitempty"`
	Aliases              []string   `json:"aliases,omitempty" yaml:"aliases,omitempty"`
	Fields               []FieldRef `json:"fields,omitempty" yaml:"fields,omitempty"`
	TrackerIDs           []string   `json:"tracker_ids,omitempty" yaml:"tracker_ids,omitempty"`
	ScorecardQuestionIDs []string   `json:"scorecard_question_ids,omitempty" yaml:"scorecard_question_ids,omitempty"`
}

type ObjectInventory

type ObjectInventory struct {
	ObjectType  string `json:"object_type"`
	ObjectCount int    `json:"object_count"`
	CallCount   int    `json:"call_count"`
}

type ObjectMapping

type ObjectMapping struct {
	ObjectTypes []string  `json:"object_types,omitempty" yaml:"object_types,omitempty"`
	Confidence  float64   `json:"confidence,omitempty" yaml:"confidence,omitempty"`
	Evidence    *Evidence `json:"evidence,omitempty" yaml:"evidence,omitempty"`
}

type Profile

type Profile struct {
	Version     int                           `json:"version" yaml:"version"`
	Name        string                        `json:"name,omitempty" yaml:"name,omitempty"`
	Objects     map[string]ObjectMapping      `json:"objects,omitempty" yaml:"objects,omitempty"`
	Fields      map[string]FieldMapping       `json:"fields,omitempty" yaml:"fields,omitempty"`
	Lifecycle   map[string]LifecycleBucket    `json:"lifecycle,omitempty" yaml:"lifecycle,omitempty"`
	Methodology map[string]MethodologyConcept `json:"methodology,omitempty" yaml:"methodology,omitempty"`
}

func Discover

func Discover(inventory *Inventory) *Profile

func ParseYAML

func ParseYAML(body []byte) (*Profile, error)

type Rule

type Rule struct {
	Field     string   `json:"field,omitempty" yaml:"field,omitempty"`
	Object    string   `json:"object,omitempty" yaml:"object,omitempty"`
	FieldName string   `json:"field_name,omitempty" yaml:"field_name,omitempty"`
	Op        string   `json:"op" yaml:"op"`
	Value     string   `json:"value,omitempty" yaml:"value,omitempty"`
	Values    []string `json:"values,omitempty" yaml:"values,omitempty"`
}

type ValidationResult

type ValidationResult struct {
	Valid           bool      `json:"valid"`
	SourceSHA256    string    `json:"source_sha256,omitempty"`
	CanonicalSHA256 string    `json:"canonical_sha256,omitempty"`
	Findings        []Finding `json:"findings"`
}

Jump to

Keyboard shortcuts

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