package wafModels import ( "regexp" "github.rackspace.com/gorax/tools/util" ) var ( plAssetTagRe = regexp.MustCompile(`(?i)asset-tag\s+(\S*)`) plHardAssetTagRe = regexp.MustCompile(`(?i)hard_asset_tag\s+(\S*)`) plVendorRe = regexp.MustCompile(`(?i)vendor\s+(\S*)`) plModelRe = regexp.MustCompile(`(?i)model\s+(\S*)`) plVersionRe = regexp.MustCompile(`(?i)version\s+(\S*)`) ) type Platform struct { AssetTag string `json:"asset_tag"` HardAssetTag string `json:"hard_asset_tag"` Vendor string `json:"vendor"` Model string `json:"model"` Version string `json:"version"` } func ParsePlatform(s string) Platform { return Platform{ AssetTag: util.RegexpString(plAssetTagRe, s), HardAssetTag: util.RegexpString(plHardAssetTagRe, s), Vendor: util.RegexpString(plVendorRe, s), Model: util.RegexpString(plModelRe, s), Version: util.RegexpString(plVersionRe, s), } }