add document state transformer interface
Some checks are pending
Lint / golangci-lint (push) Waiting to run
Declarative Tests / test (push) Waiting to run
Declarative Tests / build-fedora (push) Waiting to run
Declarative Tests / build-ubuntu-focal (push) Waiting to run

This commit is contained in:
Matthew Rich 2024-09-25 04:43:18 +00:00
parent 614b4426c2
commit 452695c8f5
2 changed files with 11 additions and 2 deletions

View File

@ -32,7 +32,12 @@ type DocumentGetter interface {
GetDocument() Document GetDocument() Document
} }
type DocumentStateTransformer interface {
Apply(overrideState string) error
}
type Document interface { type Document interface {
GetURI() string
Serializer Serializer
Loader Loader
Validator Validator
@ -52,6 +57,7 @@ type Document interface {
HasConfig(string) bool HasConfig(string) bool
GetConfig(string) Block GetConfig(string) Block
Apply(state string) error
Len() int Len() int
ResolveIds(ctx context.Context) ResolveIds(ctx context.Context)
Filter(filter DeclarationSelector) []Declaration Filter(filter DeclarationSelector) []Declaration
@ -60,8 +66,11 @@ type Document interface {
CheckConstraints() bool CheckConstraints() bool
Failures() int Failures() int
ImportedDocuments() []Document
ConfigFilter(filter BlockSelector) []Block ConfigFilter(filter BlockSelector) []Block
AppendConfigurations([]Document) AppendConfigurations([]Document)
Diff(with Document, output io.Writer) (returnOutput string, diffErr error) Diff(with Document, output io.Writer) (returnOutput string, diffErr error)
DiffState(output io.Writer) (returnOutput string, diffErr error)
Clone() Document Clone() Document
} }

View File

@ -42,7 +42,7 @@ type Declaration interface {
ResolveId(context.Context) string ResolveId(context.Context) string
Loader Loader
Validator Validator
StateTransformer DocumentStateTransformer
Resource() Resource Resource() Resource
Clone() Declaration Clone() Declaration
} }