diff options
Diffstat (limited to 'utils/yaml_ipam')
-rw-r--r-- | utils/yaml_ipam/yaml_ipam.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/yaml_ipam/yaml_ipam.go b/utils/yaml_ipam/yaml_ipam.go new file mode 100644 index 0000000..ff65155 --- /dev/null +++ b/utils/yaml_ipam/yaml_ipam.go @@ -0,0 +1,26 @@ +package yaml_ipam + +import "gopkg.in/yaml.v3" + +type Ipam struct { + Ipam6 Ipam6 `yaml:"ipam6"` +} + +type Ipam6 struct { + Networks map[string]Network6Yaml `yaml:"networks"` +} + +type Network6Yaml struct { + Range string `yaml:"range"` + Hosts map[string]string `yaml:"hosts"` +} + +func Parse(bs []byte) (Ipam, error) { + var ipam Ipam + err := yaml.Unmarshal(bs, &ipam) + if err != nil { + return Ipam{}, err + } + + return ipam, nil +} |