cloudflare

package
v1.94.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheService

type CacheService interface {
	Purge(ctx context.Context, params cache.CachePurgeParams, opts ...option.RequestOption) (*cache.CachePurgeResponse, error)
}

CacheService defines the interface for Cloudflare cache service operations

type Client

type Client struct {
	CacheService CacheService
	ZoneID       string
}

Client is a werapper around the Cloudflare Go SDK client

func (*Client) PurgeByPrefixes

func (c *Client) PurgeByPrefixes(ctx context.Context, prefixes []string) error

PurgeByPrefixes purges the Cloudflare cache for the given URL prefixes Prefixes are sent in batches of maxPrefixesPerPurge to comply with Cloudflare API limits

type Clienter

type Clienter interface {
	PurgeByPrefixes(ctx context.Context, prefixes []string) error
}

Clienter defines the interface for Cloudflare client operations

func New

func New(cfg *Config) (Clienter, error)

New creates a new Cloudflare client with the provided configuration

type Config

type Config struct {
	APIToken string `envconfig:"CLOUDFLARE_API_TOKEN"`
	ZoneID   string `envconfig:"CLOUDFLARE_ZONE_ID"`
	BaseURL  string `envconfig:"CLOUDFLARE_BASE_URL"`
}

Config holds configuration details for Cloudflare API access

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a Config struct with default test values. This is compatible with dis-cloudflare-stub: https://github.com/ONSdigital/dp-compose/tree/main/v2/stubs/dis-cloudflare-stub

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL