Documentation
¶
Index ¶
- Variables
- func InstallVolatileFields(fields map[string]map[string]struct{})
- func InstallWriteOnlyFields(fields map[string]map[string]struct{})
- func NormalizeForApply(resources []Resource, relationships []RelationshipOperation) ([]Resource, []RelationshipOperation)
- func NormalizeRoundTrip(resources []Resource, relationships []RelationshipOperation) ([]Resource, []RelationshipOperation)
- func ValidateResources(resources []Resource) error
- type ComparisonReport
- type LoadResult
- type RelationshipManifest
- type RelationshipOperation
- type Resource
- type ResourceMismatch
- type SkippedFile
Constants ¶
This section is empty.
Variables ¶
var IsBuiltInResource = func(Resource) bool { return false }
IsBuiltInResource allows the catalog package to inject knowledge of built-in resources that should be excluded from round-trip comparison.
var RelationshipParamTypes = defaultRelationshipParamTypes
RelationshipParamTypes resolves the resource types for path parameters of a relationship kind. The default implementation is used when the catalog package has not yet installed a registry. Assigning a replacement function allows catalog-driven overrides without creating an import cycle.
Functions ¶
func InstallVolatileFields ¶
InstallVolatileFields replaces the global set of volatile round-trip field names. It is used by the catalog package after loading field overrides.
func InstallWriteOnlyFields ¶
InstallWriteOnlyFields replaces the per-resource-type write-only field sets. It is used by the catalog package after loading field overrides.
func NormalizeForApply ¶
func NormalizeForApply(resources []Resource, relationships []RelationshipOperation) ([]Resource, []RelationshipOperation)
NormalizeForApply returns a canonical manifest suitable for re-applying to a different Keycloak server. Like NormalizeRoundTrip it strips volatile fields, but it preserves the id of any resource that is referenced by another resource in the manifest so that inline UUID references can be remapped.
func NormalizeRoundTrip ¶
func NormalizeRoundTrip(resources []Resource, relationships []RelationshipOperation) ([]Resource, []RelationshipOperation)
NormalizeRoundTrip returns canonical resource and relationship slices for round-trip comparisons. It removes volatile server-managed resource fields, canonicalizes relationship payload JSON, and sorts both collections.
func ValidateResources ¶
ValidateResources ensures each resource has the minimum manifest fields required.
Types ¶
type ComparisonReport ¶
type ComparisonReport struct {
Match bool `json:"match"`
MissingResources []Resource `json:"missingResources,omitempty"`
MismatchedResources []ResourceMismatch `json:"mismatchedResources,omitempty"`
UnexpectedResources []Resource `json:"unexpectedResources,omitempty"`
MissingRelationships []RelationshipOperation `json:"missingRelationships,omitempty"`
UnexpectedRelationships []RelationshipOperation `json:"unexpectedRelationships,omitempty"`
}
func CompareRoundTrip ¶
func CompareRoundTrip(expectedResources []Resource, expectedRelationships []RelationshipOperation, actualResources []Resource, actualRelationships []RelationshipOperation) ComparisonReport
CompareRoundTrip compares expected manifests with actual fetched state using round-trip normalization. Resource comparison is subset-based per matching resource key, while relationship comparison is exact on normalized entries.
type LoadResult ¶
type LoadResult struct {
Resources []Resource
Relationships []RelationshipOperation
Skipped []SkippedFile
}
func LoadPaths ¶
func LoadPaths(paths []string) (LoadResult, error)
type RelationshipManifest ¶
type RelationshipManifest struct {
Relationships []RelationshipOperation `json:"relationships"`
}
func ParseRelationshipManifest ¶
func ParseRelationshipManifest(data []byte) (*RelationshipManifest, bool, error)
type RelationshipOperation ¶
type RelationshipOperation struct {
Kind string `json:"kind,omitempty"`
Path string `json:"path"`
Delete bool `json:"delete,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
Method string `json:"-"`
Template string `json:"-"`
PathParams map[string]string `json:"-"`
}
func NewRelationshipOperation ¶
func NewRelationshipOperation(template, method string, params map[string]string, payload interface{}) (RelationshipOperation, error)
func (*RelationshipOperation) RebuildPath ¶
func (r *RelationshipOperation) RebuildPath()
type Resource ¶
type Resource struct {
Type string `json:"type"`
Realm string `json:"realm"`
Delete bool `json:"delete,omitempty"`
Data map[string]interface{} `json:"data"`
ParentType string `json:"parentType,omitempty"` // disambiguates multi-location types (e.g. protocolmapper under clientscope vs client)
}
Resource is the shared manifest model for Keycloak resources.
func ParseResources ¶
ParseResources decodes a resource manifest from JSON or YAML.
func SortResources ¶
SortResources applies the current resource dependency ordering used by uploads. If priorityMap is nil, falls back to hardcoded priorities.
func StripVolatileFields ¶
StripVolatileFields returns a copy of the resource with server-managed and write-only fields removed, suitable for validation before apply.