Documentation
¶
Index ¶
- type JsonTreeImporter
- type JsonTreeImporterElement
- func (j *JsonTreeImporterElement) GetDeletes() *sdcpb.PathSet
- func (j *JsonTreeImporterElement) GetElement(key string) importer.ImportConfigAdapterElement
- func (j *JsonTreeImporterElement) GetElements() []importer.ImportConfigAdapterElement
- func (j *JsonTreeImporterElement) GetKeyValue(ctx context.Context, slt *sdcpb.SchemaLeafType) (string, error)
- func (j *JsonTreeImporterElement) GetName() string
- func (j *JsonTreeImporterElement) GetTVValue(ctx context.Context, slt *sdcpb.SchemaLeafType) (*sdcpb.TypedValue, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsonTreeImporter ¶
type JsonTreeImporter struct {
*JsonTreeImporterElement
// contains filtered or unexported fields
}
func NewJsonTreeImporter ¶
func NewJsonTreeImporter(d any, intentName string, priority int32, nonRevertive bool) *JsonTreeImporter
func (*JsonTreeImporter) GetName ¶
func (j *JsonTreeImporter) GetName() string
func (*JsonTreeImporter) GetNonRevertive ¶ added in v0.0.67
func (j *JsonTreeImporter) GetNonRevertive() bool
func (*JsonTreeImporter) GetPriority ¶ added in v0.0.67
func (j *JsonTreeImporter) GetPriority() int32
type JsonTreeImporterElement ¶ added in v0.0.67
type JsonTreeImporterElement struct {
// contains filtered or unexported fields
}
func (*JsonTreeImporterElement) GetDeletes ¶ added in v0.0.67
func (j *JsonTreeImporterElement) GetDeletes() *sdcpb.PathSet
func (*JsonTreeImporterElement) GetElement ¶ added in v0.0.67
func (j *JsonTreeImporterElement) GetElement(key string) importer.ImportConfigAdapterElement
GetElement returns a child element by key, or nil if not found. Tries exact match first, then falls back to local-name match (after ":") to handle RFC 7951 JSON_IETF module-prefixed keys (e.g. "openconfig-if:name" matched by "name").
func (*JsonTreeImporterElement) GetElements ¶ added in v0.0.67
func (j *JsonTreeImporterElement) GetElements() []importer.ImportConfigAdapterElement
GetElements returns all child elements at this level. Module prefixes in keys are stripped to local names so the processor can look them up in the schema tree by bare name. Plain JSON keys (no ":") are passed through unchanged.
func (*JsonTreeImporterElement) GetKeyValue ¶ added in v0.0.67
func (j *JsonTreeImporterElement) GetKeyValue(ctx context.Context, slt *sdcpb.SchemaLeafType) (string, error)
GetKeyValue returns the string form of the underlying key value, normalised to the bare identity name (no module prefix) for identityref types. This mirrors the XML and proto importers, which already call GetTVValue + tv.ToString(). Without normalisation, a JSON_IETF-encoded identityref value (e.g. "openconfig-policy-types:BGP") and a plain JSON value for the same identity ("BGP") would be treated as different tree keys, splitting one logical list entry into two.
slt is optional: when nil, the raw value is stringified directly instead of calling GetTVValue, whose underlying ConvertJsonValueToTv switches on slt.Type and would panic on a nil slt.
func (*JsonTreeImporterElement) GetName ¶ added in v0.0.67
func (j *JsonTreeImporterElement) GetName() string
func (*JsonTreeImporterElement) GetTVValue ¶ added in v0.0.67
func (j *JsonTreeImporterElement) GetTVValue(ctx context.Context, slt *sdcpb.SchemaLeafType) (*sdcpb.TypedValue, error)