Documentation
¶
Overview ¶
Package cfapi is the real client of Cloudflare's API for the minter: an account reached with a token, over plain net/http against https://api.cloudflare.com/client/v4. Everything else speaks minter.API.
It is not cloudflare-go. The minter makes five calls on one resource (an account's tokens), and the SDK's root client wires every Cloudflare service at init: importing it put about 64 MB into the Lambda bootstrap, past the 100 MiB unzipped limit deploy/pulumi enforces. The five calls are small enough to speak directly.
A token's policies and condition are carried as the JSON Cloudflare sent, so a clone copies them exactly and depends on no SDK's types.
Index ¶
- Constants
- func Dial(opts ...Option) minter.Dialer
- type Client
- func (c *Client) CreateToken(ctx context.Context, in cloudflare.NewToken) (cloudflare.Created, error)
- func (c *Client) DeleteToken(ctx context.Context, id string) error
- func (c *Client) GetToken(ctx context.Context, id string) (cloudflare.Token, error)
- func (c *Client) ListTokens(ctx context.Context) ([]cloudflare.Token, error)
- func (c *Client) PermissionGroups(ctx context.Context) (map[string]string, error)
- type Option
Constants ¶
const BaseURL = "https://api.cloudflare.com/client/v4/"
BaseURL is Cloudflare's API.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one account.
func (*Client) CreateToken ¶
func (c *Client) CreateToken(ctx context.Context, in cloudflare.NewToken) (cloudflare.Created, error)
CreateToken implements minter.API.
func (*Client) DeleteToken ¶
DeleteToken implements minter.API.
func (*Client) GetToken ¶
GetToken implements minter.API.
func (*Client) ListTokens ¶
ListTokens implements minter.API: every page, the recently expired included.
func (*Client) PermissionGroups ¶
PermissionGroups implements minter.API.
type Option ¶
type Option func(*Client)
Option changes how Dial reaches Cloudflare; for tests.
func WithBaseURL ¶
WithBaseURL points the client at another server (a test's).
func WithHTTPClient ¶
WithHTTPClient replaces the HTTP client.