Client uses the user credentials to create a Cloudflare API client
(apiURL string, userAgent string, log *zerolog.Logger)
| 45 | |
| 46 | // Client uses the user credentials to create a Cloudflare API client |
| 47 | func (c *User) Client(apiURL string, userAgent string, log *zerolog.Logger) (cfapi.Client, error) { |
| 48 | if apiURL == "" { |
| 49 | return nil, errors.New("An api-url was not provided for the Cloudflare API client") |
| 50 | } |
| 51 | client, err := cfapi.NewRESTClient( |
| 52 | apiURL, |
| 53 | c.cert.AccountID, |
| 54 | c.cert.ZoneID, |
| 55 | c.cert.APIToken, |
| 56 | userAgent, |
| 57 | log, |
| 58 | ) |
| 59 | if err != nil { |
| 60 | return nil, err |
| 61 | } |
| 62 | return client, nil |
| 63 | } |
| 64 | |
| 65 | // Read will load and read the origin cert.pem to load the user credentials |
| 66 | func Read(originCertPath string, log *zerolog.Logger) (*User, error) { |