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

Method Client

credentials/credentials.go:47–63  ·  view source on GitHub ↗

Client uses the user credentials to create a Cloudflare API client

(apiURL string, userAgent string, log *zerolog.Logger)

Source from the content-addressed store, hash-verified

45
46// Client uses the user credentials to create a Cloudflare API client
47func (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
66func Read(originCertPath string, log *zerolog.Logger) (*User, error) {

Callers 9

TestCredentialsClientFunction · 0.95
runClientServerHandshakeFunction · 0.45
SetOriginServerNameMethod · 0.45
GetManagementTokenFunction · 0.45
clientMethod · 0.45
DialEdgeFunction · 0.45
lookupSRVWithDOTFunction · 0.45
testRequestFunction · 0.45

Calls 1

NewRESTClientFunction · 0.92

Tested by 4

TestCredentialsClientFunction · 0.76
runClientServerHandshakeFunction · 0.36
testRequestFunction · 0.36