package pkg import ( "errors" "strconv" "strings" ) type IPOtherProfile struct { ProfileCommon IdleTimeout int `json:"idle_timeout"` } func ParseIPOther(raw string) (*IPOtherProfile, error) { p := new(IPOtherProfile) split := strings.Split(raw, "\n") if !strings.Contains(split[0], "ltm profile ipother") { return nil, errors.New("not an ipother profile") } p.ProfileCommon = parseCommon(raw) for _, line := range split { f := strings.Fields(line) switch strings.ToLower(f[0]) { case "idle-timeout": i, err := strconv.Atoi(f[1]) if err != nil { log.WithField("data", f[1]).Error(err.Error()) return nil, err } p.IdleTimeout = i } } return p, nil }