Documentation ¶
Index ¶
- func DefaultCompositionValidators(s *Snapshot) (validator.Validator, error)
- func DefaultXRDValidators() (validator.Validator, error)
- func ValidatorsForObj(ctx context.Context, o runtime.Object, s *Snapshot) (map[schema.GroupVersionKind]*validator.ObjectValidator, error)
- type CompositionValidator
- type DepManager
- type Factory
- type FactoryOption
- type MetaValidator
- type Option
- type PatchesValidator
- type Snapshot
- func (s *Snapshot) Package(name string) *mxpkg.ParsedPackage
- func (s *Snapshot) ReParseFile(ctx context.Context, path string) error
- func (s *Snapshot) UpdateContent(ctx context.Context, uri span.URI, ...) error
- func (s *Snapshot) Validate(ctx context.Context, uri span.URI) ([]protocol.Diagnostic, error)
- func (s *Snapshot) ValidateAllFiles(ctx context.Context) (map[span.URI][]protocol.Diagnostic, error)
- func (s *Snapshot) ValidateMeta(ctx context.Context) (span.URI, []protocol.Diagnostic, error)
- func (s *Snapshot) Validator(gvk schema.GroupVersionKind) validator.Validator
- type TypeValidator
- type VersionValidator
- type XRDSchemaValidator
- type XRDValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCompositionValidators ¶
DefaultCompositionValidators returns a new Composition validator.
func DefaultXRDValidators ¶
DefaultXRDValidators returns a new Meta validator.
func ValidatorsForObj ¶
func ValidatorsForObj(ctx context.Context, o runtime.Object, s *Snapshot) (map[schema.GroupVersionKind]*validator.ObjectValidator, error)
ValidatorsForObj returns a mapping of GVK -> validator for the given runtime.Object.
Types ¶
type CompositionValidator ¶
type CompositionValidator struct {
// contains filtered or unexported fields
}
CompositionValidator defines a validator for compositions.
type DepManager ¶
type DepManager interface { View(context.Context, []v1beta1.Dependency) (*manager.View, error) Versions(context.Context, v1beta1.Dependency) ([]string, error) Watch() <-chan cache.Event }
DepManager defines the API necessary for working with the dependency manager.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory is used to "stamp out" Snapshots while allowing a shared set of references.
func NewFactory ¶
func NewFactory(workdir string, opts ...FactoryOption) (*Factory, error)
NewFactory returns a new Snapshot Factory instance.
type FactoryOption ¶
type FactoryOption func(*Factory)
FactoryOption modifies a Factory.
func WithDepManager ¶
func WithDepManager(m DepManager) FactoryOption
WithDepManager overrides the default dependency manager with the provided manager.
func WithLogger ¶
func WithLogger(l logging.Logger) FactoryOption
WithLogger overrides the default logger with the provided Logger.
type MetaValidator ¶
type MetaValidator struct {
// contains filtered or unexported fields
}
MetaValidator defines a validator for meta files.
func DefaultMetaValidators ¶
func DefaultMetaValidators(s *Snapshot) (*MetaValidator, error)
DefaultMetaValidators returns a new Meta validator.
type Option ¶
type Option func(*Snapshot)
Option modifies a Snapshot.
func WithWorkspace ¶
WithWorkspace overrides the default workspace with the provided workspace.
type PatchesValidator ¶
type PatchesValidator struct {
// contains filtered or unexported fields
}
PatchesValidator validates the patches fields of a Composition.
func NewPatchesValidator ¶
func NewPatchesValidator(s *Snapshot) *PatchesValidator
NewPatchesValidator returns a new PatchesValidator.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot provides a unified point in time snapshot of the details needed to perform operations on an xpkg project. These details include: - currently parsed workspace files - external dependencies per the crossplane.yaml in the xpkg project
func (*Snapshot) Package ¶
func (s *Snapshot) Package(name string) *mxpkg.ParsedPackage
Package returns the ParsedPackage corresponding to the supplied package name as defined in the crossplane.yaml, if one exists. Nil otherwise.
func (*Snapshot) ReParseFile ¶
ReParseFile re-parses the file at the given path. This is only useful in cases where our snapshot representation has changed prior to the given file being saved.
func (*Snapshot) UpdateContent ¶
func (s *Snapshot) UpdateContent(ctx context.Context, uri span.URI, changes []protocol.TextDocumentContentChangeEvent) error
UpdateContent updates the current in-memory content representation for the provided file uri.
func (*Snapshot) Validate ¶
Validate performs validation on all filtered nodes and returns diagnostics for any validation errors encountered. TODO(hasheddan): consider decoupling forming diagnostics from getting validation errors.
func (*Snapshot) ValidateAllFiles ¶
func (s *Snapshot) ValidateAllFiles(ctx context.Context) (map[span.URI][]protocol.Diagnostic, error)
ValidateAllFiles performs validations on all files in Snapshot.
func (*Snapshot) ValidateMeta ¶
ValidateMeta performs validations specifically on the meta file. This is specifically helpful when performing background validations and not responding to validation requests synchronously.
type TypeValidator ¶
type TypeValidator struct {
// contains filtered or unexported fields
}
TypeValidator validates the dependency type matches the supplied dependency in a meta file.
func NewTypeValidator ¶
func NewTypeValidator(s *Snapshot) *TypeValidator
NewTypeValidator returns a new TypeValidator.
type VersionValidator ¶
type VersionValidator struct {
// contains filtered or unexported fields
}
VersionValidator is used to validate the dependency versions in a meta file.
func NewVersionValidator ¶
func NewVersionValidator(manager DepManager) *VersionValidator
NewVersionValidator returns a new VersionValidator. NOTE(@tnthornton) NewVersionValidator needs snapshot's manager due to the use case where someone adds a dependency to the crossplane.yaml and we need to validate its existence.
type XRDSchemaValidator ¶
type XRDSchemaValidator struct{}
XRDSchemaValidator validates XRD schema definitions.
func NewXRDSchemaValidator ¶
func NewXRDSchemaValidator() *XRDSchemaValidator
NewXRDSchemaValidator returns a new XRDSchemaValidator.
type XRDValidator ¶
type XRDValidator struct {
// contains filtered or unexported fields
}
XRDValidator defines a validator for xrd files.
func (*XRDValidator) Marshal ¶
func (x *XRDValidator) Marshal(data any) (*xpextv1.CompositeResourceDefinition, error)
Marshal marshals the given data object into a Pkg, errors otherwise.