| 27 | } |
| 28 | |
| 29 | func (oc *OriginCert) UnmarshalJSON(data []byte) error { |
| 30 | var aux struct { |
| 31 | ZoneID string `json:"zoneID"` |
| 32 | AccountID string `json:"accountID"` |
| 33 | APIToken string `json:"apiToken"` |
| 34 | Endpoint string `json:"endpoint,omitempty"` |
| 35 | } |
| 36 | if err := json.Unmarshal(data, &aux); err != nil { |
| 37 | return fmt.Errorf("error parsing OriginCert: %v", err) |
| 38 | } |
| 39 | oc.ZoneID = aux.ZoneID |
| 40 | oc.AccountID = aux.AccountID |
| 41 | oc.APIToken = aux.APIToken |
| 42 | oc.Endpoint = strings.ToLower(aux.Endpoint) |
| 43 | return nil |
| 44 | } |
| 45 | |
| 46 | // FindDefaultOriginCertPath returns the first path that contains a cert.pem file. If none of the |
| 47 | // DefaultConfigSearchDirectories contains a cert.pem file, return empty string |