zones: introduce Machine.FullName()

Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
2023-08-21 22:02:16 +00:00
parent ee63e80f77
commit 5f924dcb00
+15
View File
@@ -2,6 +2,7 @@ package zones
import (
"strconv"
"strings"
"sync"
)
@@ -38,3 +39,17 @@ func (m *Machine) ID() int {
return m.id
}
// FullName returns the Name of the machine including domain name
func (m *Machine) FullName() string {
if domain := m.zone.zones.domain; domain != "" {
var s = []string{
m.Name,
domain,
}
return strings.Join(s, ".")
}
return m.Name
}