add isdefault to models

This commit is contained in:
0xdcarns 2022-12-22 13:39:29 -05:00
parent c257827807
commit 6669f38961
2 changed files with 4 additions and 0 deletions

View file

@ -25,6 +25,7 @@ type ApiHost struct {
InternetGateway string `json:"internetgateway"`
Nodes []string `json:"nodes"`
ProxyEnabled bool `json:"proxy_enabled" yaml:"proxy_enabled"`
IsDefault bool `json:"isdefault" yaml:"isdefault"`
}
// Host.ConvertNMHostToAPI - converts a Netmaker host to an API editable host
@ -60,6 +61,7 @@ func (h *Host) ConvertNMHostToAPI() *ApiHost {
a.PublicKey = h.PublicKey.String()
a.Verbosity = h.Verbosity
a.Version = h.Version
a.IsDefault = h.IsDefault
return &a
}
@ -109,6 +111,7 @@ func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host {
h.LocalRange = currentHost.LocalRange
}
h.ProxyEnabled = a.ProxyEnabled
h.IsDefault = a.IsDefault
return &h
}

View file

@ -40,6 +40,7 @@ type Host struct {
IsDocker bool `json:"isdocker" yaml:"isdocker"`
IsK8S bool `json:"isk8s" yaml:"isk8s"`
IsStatic bool `json:"isstatic" yaml:"isstatic"`
IsDefault bool `json:"isdefault" yaml:"isdefault"`
}
// FormatBool converts a boolean to a [yes|no] string