Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultLegacyFieldAliases = map[string][]string{
"targetInfra": {"targetVmInfra", "vmInfra"},
"nodeGroups": {"subGroups", "vm", "vms", "vmGroups"},
"nodeGroupSize": {"subGroupSize", "vmGroupSize"},
"nodeUserName": {"vmUserName"},
"nodeUserPassword": {"vmUserPassword"},
"targetSpecList": {"targetVmSpecList"},
"targetOsImageList": {"targetVmOsImageList"},
"targetSpec": {"targetVmSpec"},
"targetOsImage": {"targetVmOsImage"},
"nodes": {"servers", "vms", "machines"},
"sourceRDBMSInstances": {"rdbmsList", "sourceRdbmsList"},
"targetRDBMSInstances": {"targetRdbmsList"},
"sourceObjectStorages": {"buckets", "objectStorages"},
"targetObjectStorages": {"targetBuckets"},
}
DefaultLegacyFieldAliases maps current canonical JSON field names to known legacy field names.
var DefaultLegacyLabelKeyAliases = map[string]string{
"sourceMachineId": "cm-source-machine-ids",
"sourceMachineIds": "cm-source-machine-ids",
"sourceGroupId": "cm-source-group-id",
"sourceModelId": "cm-source-model-id",
"planningModelId": "cm-planning-model-id",
"targetModelId": "cm-target-model-id",
}
DefaultLegacyLabelKeyAliases maps legacy label keys to canonical Cloud-Barista lineage label keys.
var DefaultLegacyWrapperKeys = []string{
"onpremiseInfraModel",
"cloudInfraModel",
"recommendedInfraModel",
"recommendedVmInfraModel",
"sourceObjectStorageModel",
"recommendedObjectStorageModel",
"sourceRDBMSModel",
"recommendedRDBMSModel",
"sourceNlbModel",
"dataMigrationModel",
}
DefaultLegacyWrapperKeys lists known single-field wrapper keys used in older envelopes.
Functions ¶
func ConvertAny ¶
ConvertAny converts any type T to any type U using JSON marshaling/unmarshaling
func ConvertWithValidation ¶
ConvertWithValidation combines type validation and conversion
func ValidateTypeCompatibility ¶
ValidateTypeCompatibility checks if two types are compatible for conversion
Types ¶
type ConversionReport ¶ added in v0.6.3
type ConversionReport struct {
TargetSchemaType string `json:"targetSchemaType" example:"RecommendedInfra"`
Upcasted bool `json:"upcasted" example:"true"`
MigratedFields []FieldMigration `json:"migratedFields,omitempty"`
DroppedFields []string `json:"droppedFields,omitempty"`
}
ConversionReport summarizes all schema normalizations performed during reflect upcasting.
func ConvertWithUpcast ¶ added in v0.6.3
func ConvertWithUpcast[T any, U any](source T) (U, *ConversionReport, error)
ConvertWithUpcast converts source value T into target struct U with reflect-based legacy field migration.
func UpcastJSON ¶ added in v0.6.3
UpcastJSON normalizes raw JSON bytes against targetType using reflect and returns canonical JSON bytes.
type FieldMigration ¶ added in v0.6.3
type FieldMigration struct {
Path string `json:"path" example:"targetVmInfra"`
From string `json:"from" example:"targetVmInfra"`
To string `json:"to" example:"targetInfra"`
}
FieldMigration records a legacy field or key that was mapped to a canonical target field.