package pkg import ( "errors" "strings" ) // ServerLDAPProfile : Virtual server Server LDAP traffic profile configuration type ServerLDAPProfile struct { ProfileCommon ActivationMode string `json:"activation_mode"` } func ParseServerLDAP(raw string) (*ServerLDAPProfile, error) { p := new(ServerLDAPProfile) split := strings.Split(raw, "\n") if !strings.Contains(split[0], "ltm profile server-ldap") { return nil, errors.New("not a server-ldap profile") } p.ProfileCommon = parseCommon(raw) for _, line := range split { f := strings.Fields(line) switch strings.ToLower(f[0]) { case "activation-mode": p.ActivationMode = strings.Join(f[1:], " ") } } return p, nil }