MCPcopy
hub / github.com/cloudflare/cloudflared / UnmarshalJSON

Method UnmarshalJSON

credentials/origin_cert.go:29–44  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

27}
28
29func (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

Callers

nothing calls this directly

Calls 2

ErrorfMethod · 0.80
UnmarshalMethod · 0.45

Tested by

no test coverage detected