mirror of
https://github.com/rancher/types.git
synced 2025-06-26 05:31:32 +00:00
30 lines
643 B
Go
30 lines
643 B
Go
package mapper
|
|
|
|
import (
|
|
"github.com/rancher/norman/types"
|
|
"github.com/rancher/norman/types/values"
|
|
)
|
|
|
|
type NodeAddressMapper struct {
|
|
}
|
|
|
|
func (n NodeAddressMapper) FromInternal(data map[string]interface{}) {
|
|
addresses, _ := values.GetSlice(data, "addresses")
|
|
for _, address := range addresses {
|
|
t := address["type"]
|
|
a := address["address"]
|
|
if t == "InternalIP" {
|
|
data["ipAddress"] = a
|
|
} else if t == "Hostname" {
|
|
data["hostname"] = a
|
|
}
|
|
}
|
|
}
|
|
|
|
func (n NodeAddressMapper) ToInternal(data map[string]interface{}) {
|
|
}
|
|
|
|
func (n NodeAddressMapper) ModifySchema(schema *types.Schema, schemas *types.Schemas) error {
|
|
return nil
|
|
}
|