작업중 커밋

This commit is contained in:
Kyeongdae Moon 2022-02-19 17:51:41 +09:00 committed by ned3y2k
parent 4be3a65691
commit 6e87a96d34
10 changed files with 383 additions and 18 deletions

24
model/wake_on_lan_host.go Normal file
View file

@ -0,0 +1,24 @@
package model
import (
"errors"
"strings"
"time"
)
type WakeOnLanHost struct {
MacAddress string `json:"MacAddress"`
Name string `json:"Name"`
LatestUsed *time.Time `json:"LatestUsed"`
}
func (host WakeOnLanHost) ResolveResourceName() (string, error) {
resourceName := strings.Trim(host.MacAddress, " \t\r\n\000")
if len(resourceName) == 0 {
return "", errors.New("mac Address is Empty")
}
resourceName = strings.ToUpper(resourceName)
return strings.ReplaceAll(resourceName, ":", "-"), nil
}
const WakeOnLanHostCollectionName = "wake_on_lan_hosts"