1
0
mirror of https://github.com/rancher/types.git synced 2025-06-25 05:01:33 +00:00
types/mapper/node_address.go

30 lines
643 B
Go
Raw Normal View History

2017-11-15 04:45:08 +00:00
package mapper
import (
"github.com/rancher/norman/types"
2017-11-29 21:38:39 +00:00
"github.com/rancher/norman/types/values"
2017-11-15 04:45:08 +00:00
)
type NodeAddressMapper struct {
}
func (n NodeAddressMapper) FromInternal(data map[string]interface{}) {
2017-11-29 21:38:39 +00:00
addresses, _ := values.GetSlice(data, "addresses")
2017-11-15 04:45:08 +00:00
for _, address := range addresses {
t := address["type"]
a := address["address"]
if t == "InternalIP" {
2017-12-29 22:20:33 +00:00
data["ipAddress"] = a
2017-11-15 04:45:08 +00:00
} 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
}