Documentation
¶
Overview ¶
Package cfapi is the shared transport for every Cloudflare v4 API call upkeep makes: R2 buckets, their settings, and Pages projects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Forbidden ¶
Forbidden reports a permission failure, which upkeep turns into a manual action rather than a crash: the operator can do in a dashboard what this token may not.
func NotConfigured ¶
NotConfigured reports the codes R2 returns for a setting that has never been set. They are not failures — an absent CORS policy is the normal state of a new bucket, and treating it as an error would make the first plan unusable.
Types ¶
type CLISession ¶
type CLISession struct {
Token string
Expires time.Time
// Expired is checked rather than assumed: an expired OAuth token fails as
// a 401 on the first call, which reads like a permission problem and sends
// people looking at their account instead of at `wrangler login`.
Expired bool
}
CLISession is a credential upkeep borrowed from wrangler rather than asking the operator for a second one.
func TokenFromWrangler ¶
func TokenFromWrangler() (CLISession, bool)
TokenFromWrangler reads the session `wrangler login` already stored, so an operator who can run wrangler needs no second long-lived key on disk.
It returns nothing rather than an error when wrangler has never been used: that is not a problem to report, it is simply one fewer place to look.
func (CLISession) ExpiredMessage ¶
func (s CLISession) ExpiredMessage() string
ExpiredMessage says what to do, rather than leaving a 401 to be diagnosed.