Documentation
¶
Overview ¶
internal/cloudflare/interfaces.go
Index ¶
- func NewCloudflareClient(apiToken string) *cfgo.Client
- type BotManagementConfig
- type ClientFactory
- type DNSClient
- type DNSRecord
- type DNSRecordParams
- type Ruleset
- type RulesetClient
- type RulesetParams
- type RulesetRule
- type Tunnel
- type TunnelClient
- type TunnelParams
- type Zone
- type ZoneClient
- type ZoneLifecycleClient
- type ZoneLifecycleEditParams
- type ZoneLifecycleParams
- type ZoneSetting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCloudflareClient ¶
NewCloudflareClient creates a new Cloudflare API client from an API token.
Types ¶
type BotManagementConfig ¶
BotManagementConfig represents bot management settings. Pointer fields allow distinguishing between "unset" and "set to false".
type ClientFactory ¶
type ClientFactory struct {
// contains filtered or unexported fields
}
ClientFactory creates Cloudflare API clients from Kubernetes Secrets.
func NewClientFactory ¶
func NewClientFactory(k8sClient client.Client) *ClientFactory
NewClientFactory creates a new ClientFactory.
func (*ClientFactory) GetAPIToken ¶
func (f *ClientFactory) GetAPIToken(ctx context.Context, secretName, namespace string) (string, error)
GetAPIToken reads a Cloudflare API token from a Kubernetes Secret.
type DNSClient ¶
type DNSClient interface {
GetRecord(ctx context.Context, zoneID, recordID string) (*DNSRecord, error)
ListRecordsByNameAndType(ctx context.Context, zoneID, name, recordType string) ([]DNSRecord, error)
CreateRecord(ctx context.Context, zoneID string, params DNSRecordParams) (*DNSRecord, error)
UpdateRecord(ctx context.Context, zoneID, recordID string, params DNSRecordParams) (*DNSRecord, error)
DeleteRecord(ctx context.Context, zoneID, recordID string) error
}
DNSClient manages Cloudflare DNS records.
func NewDNSClientFromCF ¶
NewDNSClientFromCF creates a DNSClient from a cloudflare-go Client.
type DNSRecord ¶
type DNSRecord struct {
ID string
Name string
Type string
Content string
Proxied bool
TTL int
Data map[string]any
}
DNSRecord represents a Cloudflare DNS record.
type DNSRecordParams ¶
type DNSRecordParams struct {
Name string
Type string
Content string
Proxied *bool
TTL int
Priority *int
Data map[string]any
}
DNSRecordParams are parameters for creating/updating a DNS record.
type Ruleset ¶
type Ruleset struct {
ID string
Name string
Phase string
Rules []RulesetRule
}
Ruleset represents a Cloudflare Ruleset.
type RulesetClient ¶
type RulesetClient interface {
GetRuleset(ctx context.Context, zoneID, rulesetID string) (*Ruleset, error)
ListRulesetsByPhase(ctx context.Context, zoneID, phase string) ([]Ruleset, error)
CreateRuleset(ctx context.Context, zoneID string, params RulesetParams) (*Ruleset, error)
UpdateRuleset(ctx context.Context, zoneID, rulesetID string, params RulesetParams) (*Ruleset, error)
DeleteRuleset(ctx context.Context, zoneID, rulesetID string) error
}
RulesetClient manages Cloudflare Rulesets.
func NewRulesetClientFromCF ¶
func NewRulesetClientFromCF(cf *cfgo.Client) RulesetClient
NewRulesetClientFromCF creates a RulesetClient from a cloudflare-go Client.
type RulesetParams ¶
type RulesetParams struct {
Name string
Description string
Phase string
Rules []RulesetRule
}
RulesetParams are parameters for creating/updating a ruleset.
type RulesetRule ¶
type RulesetRule struct {
ID string
Action string
Expression string
Description string
Enabled bool
ActionParameters map[string]any
}
RulesetRule is a single rule in a ruleset.
type TunnelClient ¶
type TunnelClient interface {
GetTunnel(ctx context.Context, accountID, tunnelID string) (*Tunnel, error)
ListTunnelsByName(ctx context.Context, accountID, name string) ([]Tunnel, error)
CreateTunnel(ctx context.Context, accountID string, params TunnelParams) (*Tunnel, error)
DeleteTunnel(ctx context.Context, accountID, tunnelID string) error
}
TunnelClient manages Cloudflare Tunnels.
func NewTunnelClientFromCF ¶
func NewTunnelClientFromCF(cf *cfgo.Client) TunnelClient
NewTunnelClientFromCF creates a TunnelClient from a cloudflare-go Client.
type TunnelParams ¶
TunnelParams are parameters for creating a tunnel.
type Zone ¶
type Zone struct {
ID string
Name string
Status string // initializing, pending, active, moved
Type string // full, partial, secondary
Paused bool
NameServers []string
OriginalNameServers []string
OriginalRegistrar string
VerificationKey string
ActivatedOn *time.Time
}
Zone represents a Cloudflare Zone (lifecycle information).
type ZoneClient ¶
type ZoneClient interface {
GetSettings(ctx context.Context, zoneID string) ([]ZoneSetting, error)
UpdateSetting(ctx context.Context, zoneID, settingID string, value any) error
GetBotManagement(ctx context.Context, zoneID string) (*BotManagementConfig, error)
UpdateBotManagement(ctx context.Context, zoneID string, config BotManagementConfig) error
}
ZoneClient manages Cloudflare Zone settings and bot management.
func NewZoneClientFromCF ¶
func NewZoneClientFromCF(cf *cfgo.Client) ZoneClient
NewZoneClientFromCF creates a ZoneClient from a cloudflare-go Client.
type ZoneLifecycleClient ¶
type ZoneLifecycleClient interface {
CreateZone(ctx context.Context, accountID string, params ZoneLifecycleParams) (*Zone, error)
GetZone(ctx context.Context, zoneID string) (*Zone, error)
ListZonesByName(ctx context.Context, accountID, name string) ([]Zone, error)
EditZone(ctx context.Context, zoneID string, params ZoneLifecycleEditParams) (*Zone, error)
DeleteZone(ctx context.Context, zoneID string) error
TriggerActivationCheck(ctx context.Context, zoneID string) error
}
ZoneLifecycleClient manages Cloudflare Zone lifecycle (create/get/list/edit/delete).
func NewZoneLifecycleClientFromCF ¶
func NewZoneLifecycleClientFromCF(cf *cfgo.Client) ZoneLifecycleClient
NewZoneLifecycleClientFromCF creates a ZoneLifecycleClient from a cloudflare-go Client.
type ZoneLifecycleEditParams ¶
type ZoneLifecycleEditParams struct {
Paused *bool
}
ZoneLifecycleEditParams are parameters for editing a zone.
type ZoneLifecycleParams ¶
ZoneLifecycleParams are parameters for creating a zone.
type ZoneSetting ¶
ZoneSetting is a key-value pair for a zone setting.