Documentation
¶
Index ¶
- Constants
- type BundlePuller
- type DiffOptions
- type DiffResult
- type ExplainDependency
- type ExplainInterface
- type ExplainOptions
- type ExplainResult
- type ExplainRuntime
- type GenerateOptions
- type GenerateResult
- type GraphOptions
- type GraphResult
- type InitOptions
- type InitResult
- type PackOptions
- type PackResult
- type PluginRunner
- type PullOptions
- type PullResult
- type PushOptions
- type PushResult
- type Service
- func (s *Service) Diff(ctx context.Context, opts DiffOptions) (*DiffResult, error)
- func (s *Service) Explain(ctx context.Context, opts ExplainOptions) (*ExplainResult, error)
- func (s *Service) Generate(ctx context.Context, opts GenerateOptions) (*GenerateResult, error)
- func (s *Service) Graph(ctx context.Context, opts GraphOptions) (*GraphResult, error)
- func (s *Service) Init(_ context.Context, opts InitOptions) (*InitResult, error)
- func (s *Service) Pack(_ context.Context, opts PackOptions) (*PackResult, error)
- func (s *Service) Pull(ctx context.Context, opts PullOptions) (*PullResult, error)
- func (s *Service) Push(ctx context.Context, opts PushOptions) (*PushResult, error)
- func (s *Service) Validate(ctx context.Context, opts ValidateOptions) (*ValidateResult, error)
- type ValidateOptions
- type ValidateResult
Constants ¶
const DefaultContractPath = "pacto.yaml"
DefaultContractPath is the default filename looked up when no path is given.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BundlePuller ¶ added in v0.0.6
BundlePuller is the subset of oci.BundleStore needed by the fetcher. Defined here to avoid importing internal/oci from internal/graph.
type DiffOptions ¶
DiffOptions holds options for the diff command.
type DiffResult ¶
type DiffResult struct {
OldPath string `json:"oldPath"`
NewPath string `json:"newPath"`
Classification string `json:"classification"`
Changes []diff.Change `json:"changes"`
}
DiffResult holds the result of the diff command.
type ExplainDependency ¶
type ExplainDependency struct {
Ref string `json:"ref"`
Required bool `json:"required"`
Compatibility string `json:"compatibility"`
}
ExplainDependency is a simplified dependency summary.
type ExplainInterface ¶
type ExplainInterface struct {
Name string `json:"name"`
Type string `json:"type"`
Port *int `json:"port,omitempty"`
Visibility string `json:"visibility,omitempty"`
}
ExplainInterface is a simplified interface summary.
type ExplainOptions ¶
type ExplainOptions struct {
Path string
}
ExplainOptions holds options for the explain command.
type ExplainResult ¶
type ExplainResult struct {
Name string `json:"name"`
Version string `json:"version"`
Owner string `json:"owner,omitempty"`
PactoVersion string `json:"pactoVersion"`
Runtime ExplainRuntime `json:"runtime"`
Interfaces []ExplainInterface `json:"interfaces,omitempty"`
Dependencies []ExplainDependency `json:"dependencies,omitempty"`
Scaling *contract.Scaling `json:"scaling,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
ExplainResult holds the result of the explain command.
type ExplainRuntime ¶
type ExplainRuntime struct {
WorkloadType string `json:"workloadType"`
StateType string `json:"stateType"`
Scope string `json:"scope"`
Durability string `json:"durability"`
DataCriticality string `json:"dataCriticality"`
}
ExplainRuntime is a simplified runtime summary.
type GenerateOptions ¶
GenerateOptions holds options for the generate command.
type GenerateResult ¶
type GenerateResult struct {
Plugin string `json:"plugin"`
OutputDir string `json:"outputDir"`
FilesCount int `json:"filesCount"`
Message string `json:"message,omitempty"`
}
GenerateResult holds the result of the generate command.
type GraphOptions ¶
type GraphOptions struct {
Path string
}
GraphOptions holds options for the graph command.
type GraphResult ¶
type GraphResult struct {
Root *graph.Node `json:"root"`
Cycles [][]string `json:"cycles,omitempty"`
Conflicts []graph.Conflict `json:"conflicts,omitempty"`
}
GraphResult holds the result of the graph command.
type InitOptions ¶
type InitOptions struct {
Name string
}
InitOptions holds options for the init command.
type InitResult ¶
InitResult holds the result of the init command.
type PackOptions ¶
PackOptions holds options for the pack command.
type PackResult ¶
PackResult holds the result of the pack command.
type PluginRunner ¶
type PluginRunner interface {
Run(ctx context.Context, name string, req plugin.GenerateRequest) (*plugin.GenerateResponse, error)
}
PluginRunner abstracts plugin execution so the app layer does not depend on the concrete subprocess implementation.
type PullOptions ¶
PullOptions holds options for the pull command.
type PullResult ¶
PullResult holds the result of the pull command.
type PushOptions ¶
PushOptions holds options for the push command.
type PushResult ¶
PushResult holds the result of the push command.
type Service ¶
type Service struct {
BundleStore oci.BundleStore
PluginRunner PluginRunner
}
Service is the application service container. It holds injected dependencies and provides methods for each CLI command.
func NewService ¶
func NewService(store oci.BundleStore, pluginRunner PluginRunner) *Service
NewService creates a new application service with the given dependencies.
func (*Service) Diff ¶
func (s *Service) Diff(ctx context.Context, opts DiffOptions) (*DiffResult, error)
Diff compares two contracts and produces a classified change set.
func (*Service) Explain ¶
func (s *Service) Explain(ctx context.Context, opts ExplainOptions) (*ExplainResult, error)
Explain produces a human-readable summary of a contract.
func (*Service) Generate ¶
func (s *Service) Generate(ctx context.Context, opts GenerateOptions) (*GenerateResult, error)
Generate invokes a plugin to produce artifacts from a contract.
func (*Service) Graph ¶
func (s *Service) Graph(ctx context.Context, opts GraphOptions) (*GraphResult, error)
Graph resolves the dependency graph for a contract.
func (*Service) Init ¶
func (s *Service) Init(_ context.Context, opts InitOptions) (*InitResult, error)
Init scaffolds a new pacto project directory with the full bundle structure.
func (*Service) Pack ¶
func (s *Service) Pack(_ context.Context, opts PackOptions) (*PackResult, error)
Pack validates a contract bundle and produces a tar.gz archive.
func (*Service) Pull ¶
func (s *Service) Pull(ctx context.Context, opts PullOptions) (*PullResult, error)
Pull fetches a contract bundle from an OCI registry and extracts it to disk.
func (*Service) Push ¶
func (s *Service) Push(ctx context.Context, opts PushOptions) (*PushResult, error)
Push validates a contract bundle, builds an OCI image, and pushes it to a registry.
func (*Service) Validate ¶
func (s *Service) Validate(ctx context.Context, opts ValidateOptions) (*ValidateResult, error)
Validate loads a contract, runs validation, and returns the result.
type ValidateOptions ¶
type ValidateOptions struct {
Path string
}
ValidateOptions holds options for the validate command.
type ValidateResult ¶
type ValidateResult struct {
Path string
Valid bool
Errors []contract.ValidationError
Warnings []contract.ValidationWarning
}
ValidateResult holds the result of the validate command.