targetgraph

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIVersion = "torque.dev/v1alpha1"
	Kind       = "TargetGraph"
)

Variables

This section is empty.

Functions

func LabelsMatch

func LabelsMatch(labels map[string]string, selector map[string]string) bool

Types

type FactPolicy

type FactPolicy struct {
	TTL       string `json:"ttl,omitempty" yaml:"ttl,omitempty"`
	Discovery string `json:"discovery,omitempty" yaml:"discovery,omitempty"`
}

type Group

type Group struct {
	ID        string            `json:"id" yaml:"id"`
	Selector  map[string]string `json:"selector,omitempty" yaml:"selector,omitempty"`
	Targets   []string          `json:"targets,omitempty" yaml:"targets,omitempty"`
	Variables []VariableLayer   `json:"variables,omitempty" yaml:"variables,omitempty"`
}

type Metadata

type Metadata struct {
	Name   string            `json:"name" yaml:"name"`
	Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}

type PrivilegeProfile

type PrivilegeProfile struct {
	ID       string         `json:"id" yaml:"id"`
	Kind     string         `json:"kind" yaml:"kind"`
	Commands []string       `json:"commands,omitempty" yaml:"commands,omitempty"`
	Config   map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

type ResolvedVariable

type ResolvedVariable struct {
	Key             string           `json:"key"`
	Value           any              `json:"value"`
	Source          VariableSource   `json:"source"`
	Redacted        bool             `json:"redacted"`
	SecretRef       bool             `json:"secretRef"`
	SecretRefDigest string           `json:"secretRefDigest,omitempty"`
	ValueDigest     string           `json:"valueDigest"`
	History         []VariableSource `json:"history,omitempty"`
	ActualValue     any              `json:"-"`
}

type SecretReferenceID

type SecretReferenceID struct {
	Digest string `json:"digest"`
	Kind   string `json:"kind"`
}

type SelectionConflict

type SelectionConflict struct {
	Kind     string `json:"kind"`
	GroupID  string `json:"groupId,omitempty"`
	TargetID string `json:"targetId,omitempty"`
	Reason   string `json:"reason"`
}

type SelectionRequest

type SelectionRequest struct {
	Selector map[string]string `json:"selector,omitempty"`
	Groups   []string          `json:"groups,omitempty"`
	Limit    int               `json:"limit,omitempty"`
}

type SelectionResult

type SelectionResult struct {
	Selector           map[string]string   `json:"selector,omitempty"`
	Groups             []string            `json:"groups,omitempty"`
	MatchedTargetIDs   []string            `json:"matchedTargetIds"`
	OmittedTargetIDs   []string            `json:"omittedTargetIds,omitempty"`
	GroupExpanded      map[string][]string `json:"groupExpanded,omitempty"`
	SelectorMatchedIDs []string            `json:"selectorMatchedIds,omitempty"`
	Conflicts          []SelectionConflict `json:"conflicts,omitempty"`
	Limit              int                 `json:"limit,omitempty"`
	Limited            bool                `json:"limited"`
	BeforeLimitCount   int                 `json:"beforeLimitCount"`
	AfterLimitCount    int                 `json:"afterLimitCount"`
	ConflictCount      int                 `json:"conflictCount"`
}

type Summary

type Summary struct {
	APIVersion            string         `json:"apiVersion"`
	Kind                  string         `json:"kind"`
	Name                  string         `json:"name"`
	TargetCount           int            `json:"targetCount"`
	GroupCount            int            `json:"groupCount"`
	TransportCount        int            `json:"transportCount"`
	PrivilegeProfileCount int            `json:"privilegeProfileCount"`
	VariableLayerCount    int            `json:"variableLayerCount"`
	TargetTypes           map[string]int `json:"targetTypes"`
	TransportKinds        map[string]int `json:"transportKinds"`
	GroupIDs              []string       `json:"groupIds"`
	TargetIDs             []string       `json:"targetIds"`
	SecretReferenceCount  int            `json:"secretReferenceCount"`
	HostReachabilityRefs  []string       `json:"hostReachabilityRefs"`
}

Summary is a compact, evidence-friendly view of a loaded TargetGraph.

func (Summary) JSON

func (s Summary) JSON() ([]byte, error)

type Target

type Target struct {
	ID                  string            `json:"id" yaml:"id"`
	Type                string            `json:"type" yaml:"type"`
	TransportRef        string            `json:"transportRef,omitempty" yaml:"transportRef,omitempty"`
	Labels              map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Groups              []string          `json:"groups,omitempty" yaml:"groups,omitempty"`
	Variables           []VariableLayer   `json:"variables,omitempty" yaml:"variables,omitempty"`
	PrivilegeProfile    string            `json:"privilegeProfile,omitempty" yaml:"privilegeProfile,omitempty"`
	Facts               FactPolicy        `json:"facts,omitempty" yaml:"facts,omitempty"`
	LockScope           string            `json:"lockScope,omitempty" yaml:"lockScope,omitempty"`
	AllowedCapabilities []string          `json:"allowedCapabilities,omitempty" yaml:"allowedCapabilities,omitempty"`
}

type TargetGraph

type TargetGraph struct {
	APIVersion        string             `json:"apiVersion" yaml:"apiVersion"`
	Kind              string             `json:"kind" yaml:"kind"`
	Metadata          Metadata           `json:"metadata" yaml:"metadata"`
	Targets           []Target           `json:"targets" yaml:"targets"`
	Groups            []Group            `json:"groups,omitempty" yaml:"groups,omitempty"`
	Transports        []Transport        `json:"transports,omitempty" yaml:"transports,omitempty"`
	PrivilegeProfiles []PrivilegeProfile `json:"privilegeProfiles,omitempty" yaml:"privilegeProfiles,omitempty"`
	Variables         []VariableLayer    `json:"variables,omitempty" yaml:"variables,omitempty"`
}

TargetGraph is the typed inventory model for Torque ops automation.

func Load

func Load(r io.Reader) (*TargetGraph, error)

func LoadFile

func LoadFile(path string) (*TargetGraph, error)

func (TargetGraph) ExpandGroup

func (g TargetGraph) ExpandGroup(groupID string) ([]string, error)

func (TargetGraph) ResolveSelection

func (g TargetGraph) ResolveSelection(req SelectionRequest) (SelectionResult, error)

func (TargetGraph) ResolveVariables

func (TargetGraph) SelectTargets

func (g TargetGraph) SelectTargets(selector map[string]string) []string

func (TargetGraph) Summary

func (g TargetGraph) Summary() Summary

func (TargetGraph) Validate

func (g TargetGraph) Validate() error

type Transport

type Transport struct {
	ID            string         `json:"id" yaml:"id"`
	Kind          string         `json:"kind" yaml:"kind"`
	Host          string         `json:"host,omitempty" yaml:"host,omitempty"`
	User          string         `json:"user,omitempty" yaml:"user,omitempty"`
	KeyRef        string         `json:"keyRef,omitempty" yaml:"keyRef,omitempty"`
	KubeconfigRef string         `json:"kubeconfigRef,omitempty" yaml:"kubeconfigRef,omitempty"`
	DSNRef        string         `json:"dsnRef,omitempty" yaml:"dsnRef,omitempty"`
	URL           string         `json:"url,omitempty" yaml:"url,omitempty"`
	Config        map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

type ValidationError

type ValidationError struct {
	Errors []string
}

func (ValidationError) Error

func (e ValidationError) Error() string

type VariableAssignment

type VariableAssignment struct {
	Key             string         `json:"key"`
	Value           any            `json:"value"`
	Source          VariableSource `json:"source"`
	Precedence      int            `json:"precedence"`
	Overridden      bool           `json:"overridden"`
	Redacted        bool           `json:"redacted"`
	SecretRef       bool           `json:"secretRef"`
	SecretRefDigest string         `json:"secretRefDigest,omitempty"`
	ValueDigest     string         `json:"valueDigest"`
	ActualValue     any            `json:"-"`
}

type VariableLayer

type VariableLayer struct {
	ID     string         `json:"id" yaml:"id"`
	Values map[string]any `json:"values,omitempty" yaml:"values,omitempty"`
}

type VariableLayerSource

type VariableLayerSource struct {
	Source     VariableSource `json:"source"`
	Precedence int            `json:"precedence"`
	KeyCount   int            `json:"keyCount"`
}

type VariableRedactionSummary

type VariableRedactionSummary struct {
	RedactedAssignments int `json:"redactedAssignments"`
	SecretRefCount      int `json:"secretRefCount"`
	SensitiveKeyCount   int `json:"sensitiveKeyCount"`
}

type VariableResolution

type VariableResolution struct {
	TargetID       string                       `json:"targetId"`
	Values         map[string]ResolvedVariable  `json:"values"`
	Provenance     []VariableAssignment         `json:"provenance"`
	LayerOrder     []VariableLayerSource        `json:"layerOrder"`
	Redaction      VariableRedactionSummary     `json:"redaction"`
	Precedence     []string                     `json:"precedence"`
	OverriddenKeys map[string][]VariableSource  `json:"overriddenKeys,omitempty"`
	FinalSources   map[string]VariableSource    `json:"finalSources"`
	SourceCounts   map[string]int               `json:"sourceCounts"`
	SecretRefs     map[string]SecretReferenceID `json:"secretRefs,omitempty"`
}

type VariableResolutionRequest

type VariableResolutionRequest struct {
	TargetID    string         `json:"targetId"`
	Environment map[string]any `json:"environment,omitempty"`
	CLI         map[string]any `json:"cli,omitempty"`
}

type VariableSource

type VariableSource struct {
	Type     string `json:"type"`
	ID       string `json:"id"`
	LayerID  string `json:"layerId,omitempty"`
	TargetID string `json:"targetId,omitempty"`
	GroupID  string `json:"groupId,omitempty"`
}

Jump to

Keyboard shortcuts

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