package asaModels import ( "regexp" "strings" "github.rackspace.com/gorax/tools/util" ) var ( SSLENCRE = regexp.MustCompile(`(?i)ssl\s+encryption\s+(.*?)\n`) SSLTPRE = regexp.MustCompile(`(?i)ssl\s+trust-point\s+(\S+)\s+(\S+)`) ) type ( SSLConfig struct { Encryption []string `json:"encryption"` Trustpoints []*SSLTrustPoint `json:"trust_point"` } SSLTrustPoint struct { Name *string `json:"name"` IfName *string `json:"interface"` PKCS12 *string `json:"pkcs12"` } ) func (ssl *SSLConfig) Parse(s string) { e := util.RegexpFindStringPtr(SSLENCRE, s) if e != nil { ssl.Encryption = strings.Split(*e, " ") } for _, m := range SSLTPRE.FindAllStringSubmatch(s, -1) { ssl.Trustpoints = append(ssl.Trustpoints, &SSLTrustPoint{ Name: &m[1], IfName: &m[2], }) } }