Browse Source

Merge pull request #1855 from gravitl/story/GRA-823e

add isdefault to models
dcarns 2 years ago
parent
commit
0afcae610d
2 changed files with 4 additions and 0 deletions
  1. 3 0
      models/api_host.go
  2. 1 0
      models/host.go

+ 3 - 0
models/api_host.go

@@ -25,6 +25,7 @@ type ApiHost struct {
 	InternetGateway string   `json:"internetgateway"`
 	InternetGateway string   `json:"internetgateway"`
 	Nodes           []string `json:"nodes"`
 	Nodes           []string `json:"nodes"`
 	ProxyEnabled    bool     `json:"proxy_enabled" yaml:"proxy_enabled"`
 	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
 // 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.PublicKey = h.PublicKey.String()
 	a.Verbosity = h.Verbosity
 	a.Verbosity = h.Verbosity
 	a.Version = h.Version
 	a.Version = h.Version
+	a.IsDefault = h.IsDefault
 
 
 	return &a
 	return &a
 }
 }
@@ -109,6 +111,7 @@ func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host {
 		h.LocalRange = currentHost.LocalRange
 		h.LocalRange = currentHost.LocalRange
 	}
 	}
 	h.ProxyEnabled = a.ProxyEnabled
 	h.ProxyEnabled = a.ProxyEnabled
+	h.IsDefault = a.IsDefault
 
 
 	return &h
 	return &h
 }
 }

+ 1 - 0
models/host.go

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