cfapi

package
v5.8.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cfapi contains the small set of Cloudflare wire formats used by the DNSControl provider. Requests are executed by cloudflare-go/v7.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountIdentifier

func AccountIdentifier(id string) string

func ZoneIdentifier

func ZoneIdentifier(id string) string

Types

type API

type API struct {
	APIEmail string
	// contains filtered or unexported fields
}

func New

func New(key, email string, opts ...Option) (*API, error)

func NewWithAPIToken

func NewWithAPIToken(token string, opts ...Option) (*API, error)

func (*API) CreateDNSRecord

func (a *API) CreateDNSRecord(ctx context.Context, zone string, params CreateDNSRecordParams) (DNSRecord, error)

func (*API) CreateWorkerRoute

func (a *API) CreateWorkerRoute(ctx context.Context, zone string, params CreateWorkerRouteParams) (WorkerRoute, error)

func (*API) CreateZone

func (a *API) CreateZone(ctx context.Context, name string, jumpStart bool, account Account, zoneType string) (Zone, error)

func (*API) DeleteDNSRecord

func (a *API) DeleteDNSRecord(ctx context.Context, zone, id string) error

func (*API) DeleteRulesetRule

func (a *API) DeleteRulesetRule(ctx context.Context, zone string, params DeleteRulesetRuleParams) error

func (*API) DeleteWorkerRoute

func (a *API) DeleteWorkerRoute(ctx context.Context, zone, id string) (WorkerRoute, error)

func (*API) EditUniversalSSLSetting

func (a *API) EditUniversalSSLSetting(ctx context.Context, zone string, setting UniversalSSLSetting) (UniversalSSLSetting, error)

func (*API) GetEntrypointRuleset

func (a *API) GetEntrypointRuleset(ctx context.Context, zone, phase string) (Ruleset, error)

func (*API) ListDNSRecords

func (a *API) ListDNSRecords(ctx context.Context, zone string, _ ListDNSRecordsParams) ([]DNSRecord, any, error)

func (*API) ListWorkerRoutes

func (a *API) ListWorkerRoutes(ctx context.Context, zone string, _ ListWorkerRoutesParams) (WorkerRoutesResponse, error)

func (*API) ListZones

func (a *API) ListZones(ctx context.Context) ([]Zone, error)

func (*API) Raw

func (a *API) Raw(ctx context.Context, method, path string, body any, _ any) (RawResult, error)

func (*API) SetDebug

func (a *API) SetDebug(enabled bool)

func (*API) UniversalSSLSettingDetails

func (a *API) UniversalSSLSettingDetails(ctx context.Context, zone string) (UniversalSSLSetting, error)

func (*API) UpdateDNSRecord

func (a *API) UpdateDNSRecord(ctx context.Context, zone string, params UpdateDNSRecordParams) (DNSRecord, error)

func (*API) UpdateEntrypointRuleset

func (a *API) UpdateEntrypointRuleset(ctx context.Context, zone string, params UpdateEntrypointRulesetParams) (Ruleset, error)

func (*API) UploadWorker

func (a *API) UploadWorker(ctx context.Context, account string, params CreateWorkerParams) (any, error)

type Account

type Account struct {
	ID string `json:"id"`
}

type CreateDNSRecordParams

type CreateDNSRecordParams DNSRecord

type CreateWorkerParams

type CreateWorkerParams struct {
	ScriptName string
	Script     string
}

type CreateWorkerRouteParams

type CreateWorkerRouteParams struct {
	Pattern string `json:"pattern"`
	Script  string `json:"script,omitempty"`
}

type DNSRecord

type DNSRecord struct {
	ID        string            `json:"id,omitempty"`
	Type      string            `json:"type,omitempty"`
	Name      string            `json:"name,omitempty"`
	Content   string            `json:"content,omitempty"`
	Meta      any               `json:"meta,omitempty"`
	Data      any               `json:"data,omitempty"`
	Priority  *uint16           `json:"priority,omitempty"`
	TTL       int               `json:"ttl,omitempty"`
	Proxied   *bool             `json:"proxied,omitempty"`
	Proxiable bool              `json:"proxiable,omitempty"`
	Comment   string            `json:"comment,omitempty"`
	Tags      []string          `json:"tags,omitempty"`
	Settings  DNSRecordSettings `json:"settings"`
}

type DNSRecordSettings

type DNSRecordSettings struct {
	FlattenCNAME *bool `json:"flatten_cname,omitempty"`
}

type DeleteRulesetRuleParams

type DeleteRulesetRuleParams struct {
	RulesetID     string
	RulesetRuleID string
}

type ListDNSRecordsParams

type ListDNSRecordsParams struct{}

type ListWorkerRoutesParams

type ListWorkerRoutesParams struct{}

type NotFoundError

type NotFoundError struct{ Err error }

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

type Option

type Option func(*API) error

func BaseURL

func BaseURL(s string) Option

func HTTPClient

func HTTPClient(c *http.Client) Option

func UsingRetryPolicy

func UsingRetryPolicy(m int, _, _ int) Option

type PageRule

type PageRule struct {
	ID string `json:"id"`
}

type RawResult

type RawResult struct {
	Success bool            `json:"success"`
	Errors  json.RawMessage `json:"errors"`
}

type Ruleset

type Ruleset struct {
	ID    string        `json:"id,omitempty"`
	Rules []RulesetRule `json:"rules"`
}

type RulesetRule

type RulesetRule struct {
	ID               string                       `json:"id,omitempty"`
	Action           string                       `json:"action"`
	Description      string                       `json:"description,omitempty"`
	Expression       string                       `json:"expression"`
	ActionParameters *RulesetRuleActionParameters `json:"action_parameters,omitempty"`
	Enabled          *bool                        `json:"enabled,omitempty"`
	Ref              string                       `json:"ref,omitempty"`
}

type RulesetRuleActionParameters

type RulesetRuleActionParameters struct {
	FromValue *RulesetRuleActionParametersFromValue `json:"from_value,omitempty"`
}

type RulesetRuleActionParametersFromValue

type RulesetRuleActionParametersFromValue struct {
	StatusCode          uint16                               `json:"status_code,omitempty"`
	TargetURL           RulesetRuleActionParametersTargetURL `json:"target_url"`
	PreserveQueryString *bool                                `json:"preserve_query_string,omitempty"`
}

type RulesetRuleActionParametersTargetURL

type RulesetRuleActionParametersTargetURL struct {
	Expression string `json:"expression,omitempty"`
}

type UniversalSSLSetting

type UniversalSSLSetting struct {
	Enabled bool `json:"enabled"`
}

type UpdateDNSRecordParams

type UpdateDNSRecordParams struct {
	ID       string            `json:"-"`
	Type     string            `json:"type,omitempty"`
	Name     string            `json:"name,omitempty"`
	Content  string            `json:"content,omitempty"`
	Data     any               `json:"data,omitempty"`
	Priority *uint16           `json:"priority,omitempty"`
	TTL      int               `json:"ttl,omitempty"`
	Proxied  *bool             `json:"proxied,omitempty"`
	Comment  *string           `json:"comment,omitempty"`
	Tags     []string          `json:"tags"`
	Settings DNSRecordSettings `json:"settings"`
}

type UpdateEntrypointRulesetParams

type UpdateEntrypointRulesetParams struct {
	Phase string        `json:"-"`
	Rules []RulesetRule `json:"rules"`
}

type WorkerRoute

type WorkerRoute struct {
	ID         string `json:"id,omitempty"`
	Pattern    string `json:"pattern"`
	ScriptName string `json:"script,omitempty"`
}

type WorkerRoutesResponse

type WorkerRoutesResponse struct{ Routes []WorkerRoute }

type Zone

type Zone struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	NameServers []string `json:"name_servers"`
}

Jump to

Keyboard shortcuts

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