Documentation
¶
Index ¶
- Constants
- type Bundle
- type Chart
- type Configuration
- type Contract
- type Dependency
- type Health
- type Image
- type Interface
- type Lifecycle
- type Metrics
- type OCIReference
- type ParseError
- type Persistence
- type Policy
- type Range
- type Runtime
- type Scaling
- type ServiceIdentity
- type State
- type ValidationError
- type ValidationWarning
Constants ¶
const ( InterfaceTypeHTTP = "http" InterfaceTypeGRPC = "grpc" InterfaceTypeEvent = "event" )
InterfaceType constants.
const ( VisibilityPublic = "public" VisibilityInternal = "internal" )
Visibility constants.
const ( WorkloadTypeService = "service" WorkloadTypeJob = "job" WorkloadTypeScheduled = "scheduled" )
WorkloadType constants.
const ( StateStateless = "stateless" StateStateful = "stateful" StateHybrid = "hybrid" )
StateType constants.
const ( DataCriticalityLow = "low" DataCriticalityMedium = "medium" DataCriticalityHigh = "high" )
DataCriticality constants.
const ( ScopeLocal = "local" )
Scope constants.
const ( DurabilityEphemeral = "ephemeral" DurabilityPersistent = "persistent" )
Durability constants.
const ( UpgradeStrategyRolling = "rolling" UpgradeStrategyRecreate = "recreate" UpgradeStrategyOrdered = "ordered" )
UpgradeStrategy constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct {
Contract *Contract
RawYAML []byte // Original YAML bytes; populated for local reads.
FS fs.FS
}
Bundle represents a contract bundled with its referenced files.
type Chart ¶ added in v0.18.0
type Chart struct {
Ref string `yaml:"ref" json:"ref"`
Version string `yaml:"version" json:"version"`
}
Chart describes the Helm chart for the service.
type Configuration ¶
type Configuration struct {
Schema string `yaml:"schema,omitempty" json:"schema,omitempty"`
Ref string `yaml:"ref,omitempty" json:"ref,omitempty"`
Values map[string]interface{} `yaml:"values,omitempty" json:"values,omitempty"`
}
Configuration describes the service's configuration model. Required configuration keys are derived exclusively from JSON Schema.
type Contract ¶
type Contract struct {
PactoVersion string `yaml:"pactoVersion" json:"pactoVersion"`
Service ServiceIdentity `yaml:"service" json:"service"`
Interfaces []Interface `yaml:"interfaces" json:"interfaces"`
Configuration *Configuration `yaml:"configuration,omitempty" json:"configuration,omitempty"`
Policy *Policy `yaml:"policy,omitempty" json:"policy,omitempty"`
Dependencies []Dependency `yaml:"dependencies,omitempty" json:"dependencies,omitempty"`
Runtime *Runtime `yaml:"runtime,omitempty" json:"runtime,omitempty"`
Scaling *Scaling `yaml:"scaling,omitempty" json:"scaling,omitempty"`
Metadata map[string]interface{} `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}
Contract is the root aggregate — the parsed in-memory representation of a pacto.yaml.
type Dependency ¶
type Dependency struct {
Ref string `yaml:"ref" json:"ref"`
Required bool `yaml:"required,omitempty" json:"required,omitempty"`
Compatibility string `yaml:"compatibility" json:"compatibility"`
}
Dependency represents a dependency on another service.
type Health ¶
type Health struct {
Interface string `yaml:"interface" json:"interface"`
Path string `yaml:"path,omitempty" json:"path,omitempty"`
InitialDelaySeconds *int `yaml:"initialDelaySeconds,omitempty" json:"initialDelaySeconds,omitempty"`
}
Health describes the health check configuration.
type Image ¶
type Image struct {
Ref string `yaml:"ref" json:"ref"`
Private bool `yaml:"private,omitempty" json:"private,omitempty"`
}
Image describes the container image for the service.
type Interface ¶
type Interface struct {
Name string `yaml:"name" json:"name"`
Type string `yaml:"type" json:"type"`
Port *int `yaml:"port,omitempty" json:"port,omitempty"`
Visibility string `yaml:"visibility,omitempty" json:"visibility,omitempty"`
Contract string `yaml:"contract,omitempty" json:"contract,omitempty"`
}
Interface describes a service interface declaration.
type Lifecycle ¶
type Lifecycle struct {
UpgradeStrategy string `yaml:"upgradeStrategy,omitempty" json:"upgradeStrategy,omitempty"`
GracefulShutdownSeconds *int `yaml:"gracefulShutdownSeconds,omitempty" json:"gracefulShutdownSeconds,omitempty"`
}
Lifecycle describes lifecycle behavior.
type Metrics ¶ added in v0.19.0
type Metrics struct {
Interface string `yaml:"interface" json:"interface"`
Path string `yaml:"path,omitempty" json:"path,omitempty"`
}
Metrics describes the metrics endpoint configuration.
type OCIReference ¶
OCIReference represents a parsed OCI artifact reference.
func ParseOCIReference ¶
func ParseOCIReference(s string) (OCIReference, error)
ParseOCIReference parses an OCI reference string into its components. Accepted formats:
registry/repo registry/repo:tag registry/repo@sha256:hex registry/repo:tag@sha256:hex
func (OCIReference) String ¶
func (r OCIReference) String() string
String returns the full OCI reference string.
type ParseError ¶
ParseError represents an error encountered during YAML parsing.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶ added in v0.2.1
func (e *ParseError) Unwrap() error
type Persistence ¶
type Persistence struct {
Scope string `yaml:"scope" json:"scope"`
Durability string `yaml:"durability" json:"durability"`
}
Persistence represents the persistence requirements.
type Policy ¶ added in v0.20.0
type Policy struct {
Schema string `yaml:"schema,omitempty" json:"schema,omitempty"`
Ref string `yaml:"ref,omitempty" json:"ref,omitempty"`
}
Policy defines or references policy constraints for the contract. A policy is a JSON Schema that validates the contract itself.
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range represents a parsed semver constraint range.
func ParseRange ¶
ParseRange parses a semver range string (npm-style: ^, ~, exact, range).
type Runtime ¶
type Runtime struct {
Workload string `yaml:"workload" json:"workload"`
State State `yaml:"state" json:"state"`
Lifecycle *Lifecycle `yaml:"lifecycle,omitempty" json:"lifecycle,omitempty"`
Health *Health `yaml:"health,omitempty" json:"health,omitempty"`
Metrics *Metrics `yaml:"metrics,omitempty" json:"metrics,omitempty"`
}
Runtime describes how the service behaves at runtime.
type Scaling ¶
type Scaling struct {
Replicas *int `yaml:"replicas,omitempty" json:"replicas,omitempty"`
Min int `yaml:"min,omitempty" json:"min,omitempty"`
Max int `yaml:"max,omitempty" json:"max,omitempty"`
}
Scaling describes scaling parameters. Either Replicas (exact count) or Min/Max (range) is set.
type ServiceIdentity ¶
type ServiceIdentity struct {
Name string `yaml:"name" json:"name"`
Version string `yaml:"version" json:"version"`
Owner string `yaml:"owner,omitempty" json:"owner,omitempty"`
Image *Image `yaml:"image,omitempty" json:"image,omitempty"`
Chart *Chart `yaml:"chart,omitempty" json:"chart,omitempty"`
}
ServiceIdentity holds service identification fields.
type State ¶
type State struct {
Type string `yaml:"type" json:"type"`
Persistence Persistence `yaml:"persistence" json:"persistence"`
DataCriticality string `yaml:"dataCriticality" json:"dataCriticality"`
}
State describes the state semantics of the service.
type ValidationError ¶
ValidationError represents a validation failure that makes a contract invalid.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type ValidationWarning ¶
ValidationWarning represents a validation concern that does not invalidate the contract.
func (*ValidationWarning) String ¶
func (w *ValidationWarning) String() string