values

package
v0.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package values contains domain value objects that encapsulate primitive types with validation and such.

Index

Constants

This section is empty.

Variables

View Source
var (
	SevUnknown  = Severity{SeverityUnknown}
	SevLow      = Severity{SeverityLow}
	SevMedium   = Severity{SeverityMedium}
	SevHigh     = Severity{SeverityHigh}
	SevCritical = Severity{SeverityCritical}
)

Predefined severity values

Functions

This section is empty.

Types

type ControlID

type ControlID struct {
	// contains filtered or unexported fields
}

ControlID uniquely identifies a control within a profile. Enforces non-empty, trimmed identifiers.

func MustNewControlID

func MustNewControlID(id string) ControlID

MustNewControlID creates a ControlID or panics (for tests/constants)

func NewControlID

func NewControlID(id string) (ControlID, error)

NewControlID creates a new ControlID with validation

func (ControlID) Equals

func (c ControlID) Equals(other ControlID) bool

Equals checks if two ControlIDs are equal

func (ControlID) IsEmpty

func (c ControlID) IsEmpty() bool

IsEmpty returns true if this is the zero value

func (ControlID) MarshalJSON

func (c ControlID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (ControlID) String

func (c ControlID) String() string

String returns the string representation

func (*ControlID) UnmarshalJSON

func (c *ControlID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type Digest

type Digest struct {
	// contains filtered or unexported fields
}

Digest represents a content hash with algorithm.

func ComputeDigestSHA256

func ComputeDigestSHA256(r io.Reader) (Digest, error)

ComputeDigestSHA256 computes SHA-256 digest of reader contents.

func NewDigest

func NewDigest(algorithm, hexValue string) (Digest, error)

NewDigest creates a digest from algorithm and hex value.

func ParseDigest

func ParseDigest(s string) (Digest, error)

ParseDigest parses a digest string (e.g., "sha256:abc123...").

func (Digest) Algorithm

func (d Digest) Algorithm() string

Algorithm returns the hash algorithm.

func (Digest) Equals

func (d Digest) Equals(other Digest) bool

Equals checks equality with another digest.

func (Digest) String

func (d Digest) String() string

String returns the canonical digest string.

func (Digest) Value

func (d Digest) Value() string

Value returns the hex-encoded hash value.

func (Digest) Verify

func (d Digest) Verify(data []byte) error

Verify validates data matches this digest.

type ExecutionID

type ExecutionID struct {
	// contains filtered or unexported fields
}

ExecutionID uniquely identifies a profile execution. This is critical for persistence, distributed execution, and result tracking.

func FromUUID

func FromUUID(id uuid.UUID) ExecutionID

FromUUID creates an ExecutionID from a uuid.UUID

func MustParseExecutionID

func MustParseExecutionID(s string) ExecutionID

MustParseExecutionID parses a string or panics (for tests only)

func NewExecutionID

func NewExecutionID() ExecutionID

NewExecutionID creates a new random execution ID

func ParseExecutionID

func ParseExecutionID(s string) (ExecutionID, error)

ParseExecutionID parses a string into an ExecutionID

func (ExecutionID) Equals

func (e ExecutionID) Equals(other ExecutionID) bool

Equals checks if two ExecutionIDs are equal

func (ExecutionID) IsZero

func (e ExecutionID) IsZero() bool

IsZero returns true if this is the zero value

func (ExecutionID) MarshalJSON

func (e ExecutionID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (ExecutionID) String

func (e ExecutionID) String() string

String returns the string representation

func (ExecutionID) UUID

func (e ExecutionID) UUID() uuid.UUID

UUID returns the underlying uuid.UUID

func (*ExecutionID) UnmarshalJSON

func (e *ExecutionID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type PluginMetadata

type PluginMetadata struct {
	// contains filtered or unexported fields
}

PluginMetadata contains descriptive information about a plugin.

func NewPluginMetadata

func NewPluginMetadata(name, version, description string, capabilities []string) PluginMetadata

NewPluginMetadata creates plugin metadata.

func (PluginMetadata) Capabilities

func (m PluginMetadata) Capabilities() []string

Capabilities returns required capabilities.

func (PluginMetadata) Description

func (m PluginMetadata) Description() string

Description returns human-readable description.

func (PluginMetadata) Name

func (m PluginMetadata) Name() string

Name returns the plugin name.

func (PluginMetadata) Version

func (m PluginMetadata) Version() string

Version returns the semantic version.

type PluginName

type PluginName struct {
	// contains filtered or unexported fields
}

PluginName represents a validated plugin identifier. Enforces non-empty, trimmed plugin names.

func MustNewPluginName

func MustNewPluginName(name string) PluginName

MustNewPluginName creates a PluginName or panics

func NewPluginName

func NewPluginName(name string) (PluginName, error)

NewPluginName creates a PluginName with strict validation. A valid plugin name must: - Be non-empty - contain only alphanumeric characters, underscores, and hyphens - NOT contain paths, dots, or special characters - Be at most 64 characters long

func (PluginName) Equals

func (p PluginName) Equals(other PluginName) bool

Equals checks if two plugin names are equal

func (PluginName) IsEmpty

func (p PluginName) IsEmpty() bool

IsEmpty returns true if this is the zero value

func (PluginName) MarshalJSON

func (p PluginName) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Uses json.Marshal for proper character escaping.

func (PluginName) String

func (p PluginName) String() string

String returns the string representation

func (*PluginName) UnmarshalJSON

func (p *PluginName) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type PluginReference

type PluginReference struct {
	// contains filtered or unexported fields
}

PluginReference uniquely identifies a plugin version. Format: registry.io/org/repo/name:version or name (for embedded)

func NewPluginReference

func NewPluginReference(registry, org, repo, name, version string) PluginReference

NewPluginReference creates a reference from components.

func ParsePluginReference

func ParsePluginReference(ref string) (PluginReference, error)

ParsePluginReference parses OCI reference string. Examples:

  • file (embedded)
  • ghcr.io/whiskeyjimbo/reglet-plugins/file:1.0.2

func (PluginReference) Equals

func (r PluginReference) Equals(other PluginReference) bool

Equals checks equality with another reference.

func (PluginReference) IsEmbedded

func (r PluginReference) IsEmbedded() bool

IsEmbedded returns true if this is a built-in plugin.

func (PluginReference) Name

func (r PluginReference) Name() string

Name returns the plugin name.

func (PluginReference) Registry

func (r PluginReference) Registry() string

Registry returns the registry hostname.

func (PluginReference) String

func (r PluginReference) String() string

String returns the canonical OCI reference string.

func (PluginReference) Version

func (r PluginReference) Version() string

Version returns the version tag.

type Severity

type Severity struct {
	// contains filtered or unexported fields
}

Severity represents the severity level of a control. Enforces valid severity values and provides ordering.

func MustNewSeverity

func MustNewSeverity(s string) Severity

MustNewSeverity creates a Severity or panics

func NewSeverity

func NewSeverity(s string) (Severity, error)

NewSeverity creates a Severity from string

func (Severity) Equals

func (s Severity) Equals(other Severity) bool

Equals checks if two severities are equal

func (Severity) IsHigherOrEqual

func (s Severity) IsHigherOrEqual(other Severity) bool

IsHigherOrEqual returns true if this severity is higher or equal to the other

func (Severity) IsHigherThan

func (s Severity) IsHigherThan(other Severity) bool

IsHigherThan returns true if this severity is higher than the other

func (Severity) Level

func (s Severity) Level() int

Level returns the numeric severity level (for ordering)

func (Severity) MarshalJSON

func (s Severity) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Severity) String

func (s Severity) String() string

String returns the string representation

func (*Severity) UnmarshalJSON

func (s *Severity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type SeverityLevel

type SeverityLevel int

SeverityLevel is the internal representation

const (
	// SeverityUnknown = Unknown
	SeverityUnknown SeverityLevel = 0
	// SeverityLow = Low
	SeverityLow SeverityLevel = 1
	// SeverityMedium = Medium
	SeverityMedium SeverityLevel = 2
	// SeverityHigh = High
	SeverityHigh SeverityLevel = 3
	// SeverityCritical = Critical
	SeverityCritical SeverityLevel = 4
)

type Status

type Status string

Status represents the status of a control or observation.

const (
	// StatusPass indicates the check passed
	StatusPass Status = "pass"
	// StatusFail indicates the check failed (but ran successfully)
	StatusFail Status = "fail"
	// StatusError indicates the check encountered an error
	StatusError Status = "error"
	// StatusSkipped indicates the check was skipped (dependency failure or filtered)
	StatusSkipped Status = "skipped"
)

func (Status) IsFailure

func (s Status) IsFailure() bool

IsFailure returns true if this status represents a failure or error

func (Status) IsSkipped

func (s Status) IsSkipped() bool

IsSkipped returns true if this status represents a skip

func (Status) IsSuccess

func (s Status) IsSuccess() bool

IsSuccess returns true if this status represents success

func (Status) Precedence

func (s Status) Precedence() int

Precedence returns the numeric precedence of this status. Higher values indicate higher priority in aggregation. Used by status aggregator to determine control status.

Precedence: Fail (3) > Error (2) > Skipped (1) > Pass (0)

func (Status) Validate

func (s Status) Validate() error

Validate returns an error if the status value is invalid

Jump to

Keyboard shortcuts

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