Documentation
¶
Overview ¶
Package domain provides services for managing Cloudflare Domain configurations.
Index ¶
- Constants
- type CacheConfig
- type CloudflareDomainConfig
- type CloudflareDomainRegisterOptions
- type CloudflareDomainService
- func (s *CloudflareDomainService) Register(ctx context.Context, opts CloudflareDomainRegisterOptions) error
- func (s *CloudflareDomainService) Unregister(ctx context.Context, zoneID string, source service.Source) error
- func (s *CloudflareDomainService) UpdateStatus(ctx context.Context, domain *v1alpha2.CloudflareDomain, ...) error
- func (s *CloudflareDomainService) UpdateZoneID(ctx context.Context, source service.Source, zoneID, accountID string) error
- type CloudflareDomainSyncResult
- type DNSVerificationRecord
- type MinifyConfig
- type OriginCACertificateConfig
- type OriginCACertificateRegisterOptions
- type OriginCACertificateService
- func (s *OriginCACertificateService) Register(ctx context.Context, opts OriginCACertificateRegisterOptions) error
- func (s *OriginCACertificateService) Unregister(ctx context.Context, certificateID string, source service.Source) error
- func (s *OriginCACertificateService) UpdateCertificateID(ctx context.Context, source service.Source, ...) error
- func (s *OriginCACertificateService) UpdateStatus(ctx context.Context, cert *v1alpha2.OriginCACertificate, ...) error
- type OriginCACertificateSyncResult
- type PerformanceConfig
- type SSLConfig
- type SecurityConfig
- type VerificationConfig
- type WAFConfig
- type WAFRuleGroup
Constants ¶
const ( // ResourceTypeCloudflareDomain is the SyncState resource type for CloudflareDomain ResourceTypeCloudflareDomain = v1alpha2.SyncResourceCloudflareDomain // ResourceTypeOriginCACertificate is the SyncState resource type for OriginCACertificate ResourceTypeOriginCACertificate = v1alpha2.SyncResourceOriginCACertificate // ResourceTypeDomainRegistration is the SyncState resource type for DomainRegistration ResourceTypeDomainRegistration = v1alpha2.SyncResourceDomainRegistration // Priority constants PriorityCloudflareDomain = 100 PriorityOriginCACertificate = 100 PriorityDomainRegistration = 100 )
Resource Types for SyncState
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶
type CacheConfig struct {
// Level is the cache level (aggressive, basic, simplified)
Level string `json:"level,omitempty"`
// BrowserTTL is the browser cache TTL in seconds
BrowserTTL int `json:"browserTtl,omitempty"`
// DevelopmentMode enables development mode
DevelopmentMode *bool `json:"developmentMode,omitempty"`
// AlwaysOnline enables always online
AlwaysOnline *bool `json:"alwaysOnline,omitempty"`
}
CacheConfig contains cache configuration.
type CloudflareDomainConfig ¶
type CloudflareDomainConfig struct {
// Domain is the domain name
Domain string `json:"domain"`
// SSL contains SSL/TLS configuration
SSL *SSLConfig `json:"ssl,omitempty"`
// Cache contains cache configuration
Cache *CacheConfig `json:"cache,omitempty"`
// Security contains security configuration
Security *SecurityConfig `json:"security,omitempty"`
// Performance contains performance configuration
Performance *PerformanceConfig `json:"performance,omitempty"`
// Verification contains domain verification settings
Verification *VerificationConfig `json:"verification,omitempty"`
}
CloudflareDomainConfig contains the configuration for a Cloudflare Domain.
type CloudflareDomainRegisterOptions ¶
type CloudflareDomainRegisterOptions struct {
// AccountID is the Cloudflare account ID
AccountID string
// ZoneID is the Cloudflare zone ID
ZoneID string
// Source is the K8s resource source
Source service.Source
// Config is the domain configuration
Config CloudflareDomainConfig
// CredentialsRef references the CloudflareCredentials resource
CredentialsRef v1alpha2.CredentialsReference
}
CloudflareDomainRegisterOptions contains options for registering a CloudflareDomain.
type CloudflareDomainService ¶
type CloudflareDomainService struct {
*service.BaseService
}
CloudflareDomainService manages CloudflareDomain configurations via CloudflareSyncState.
func NewCloudflareDomainService ¶
func NewCloudflareDomainService(c client.Client) *CloudflareDomainService
NewCloudflareDomainService creates a new CloudflareDomain service.
func (*CloudflareDomainService) Register ¶
func (s *CloudflareDomainService) Register(ctx context.Context, opts CloudflareDomainRegisterOptions) error
Register registers a CloudflareDomain configuration with the SyncState.
func (*CloudflareDomainService) Unregister ¶
func (s *CloudflareDomainService) Unregister(ctx context.Context, zoneID string, source service.Source) error
Unregister removes a CloudflareDomain configuration from the SyncState.
func (*CloudflareDomainService) UpdateStatus ¶
func (s *CloudflareDomainService) UpdateStatus( ctx context.Context, domain *v1alpha2.CloudflareDomain, result *CloudflareDomainSyncResult, ) error
UpdateStatus updates the K8s CloudflareDomain resource status based on sync result.
func (*CloudflareDomainService) UpdateZoneID ¶
func (s *CloudflareDomainService) UpdateZoneID(ctx context.Context, source service.Source, zoneID, accountID string) error
UpdateZoneID updates the SyncState to use the actual zone ID.
type CloudflareDomainSyncResult ¶
type CloudflareDomainSyncResult struct {
// ZoneID is the Cloudflare zone ID
ZoneID string
// ZoneName is the zone name
ZoneName string
// Status is the domain status (maps to CloudflareDomainState)
Status string
}
CloudflareDomainSyncResult contains CloudflareDomain-specific sync result.
type DNSVerificationRecord ¶
type DNSVerificationRecord struct {
// Type is the DNS record type (TXT, CNAME)
Type string `json:"type,omitempty"`
// Name is the record name
Name string `json:"name,omitempty"`
// Value is the record value
Value string `json:"value,omitempty"`
}
DNSVerificationRecord contains DNS verification record details.
type MinifyConfig ¶
type MinifyConfig struct {
// HTML enables HTML minification
HTML *bool `json:"html,omitempty"`
// CSS enables CSS minification
CSS *bool `json:"css,omitempty"`
// JS enables JavaScript minification
JS *bool `json:"js,omitempty"`
}
MinifyConfig contains minification settings.
type OriginCACertificateConfig ¶
type OriginCACertificateConfig struct {
// Hostnames is the list of hostnames to cover
Hostnames []string `json:"hostnames"`
// RequestType is the certificate request type (origin-rsa, origin-ecc)
RequestType string `json:"requestType,omitempty"`
// ValidityDays is the certificate validity in days
ValidityDays int `json:"validityDays,omitempty"`
// CSR is the Certificate Signing Request (if provided)
CSR string `json:"csr,omitempty"`
}
OriginCACertificateConfig contains the configuration for an Origin CA Certificate.
type OriginCACertificateRegisterOptions ¶
type OriginCACertificateRegisterOptions struct {
// AccountID is the Cloudflare account ID
AccountID string
// ZoneID is the Cloudflare zone ID
ZoneID string
// CertificateID is the existing certificate ID (empty for new)
CertificateID string
// Source is the K8s resource source
Source service.Source
// Config is the certificate configuration
Config OriginCACertificateConfig
// CredentialsRef references the CloudflareCredentials resource
CredentialsRef v1alpha2.CredentialsReference
}
OriginCACertificateRegisterOptions contains options for registering an OriginCACertificate.
type OriginCACertificateService ¶
type OriginCACertificateService struct {
*service.BaseService
}
OriginCACertificateService manages OriginCACertificate configurations via CloudflareSyncState.
func NewOriginCACertificateService ¶
func NewOriginCACertificateService(c client.Client) *OriginCACertificateService
NewOriginCACertificateService creates a new OriginCACertificate service.
func (*OriginCACertificateService) Register ¶
func (s *OriginCACertificateService) Register(ctx context.Context, opts OriginCACertificateRegisterOptions) error
Register registers an OriginCACertificate configuration with the SyncState.
func (*OriginCACertificateService) Unregister ¶
func (s *OriginCACertificateService) Unregister(ctx context.Context, certificateID string, source service.Source) error
Unregister removes a configuration from the SyncState.
func (*OriginCACertificateService) UpdateCertificateID ¶
func (s *OriginCACertificateService) UpdateCertificateID(ctx context.Context, source service.Source, certificateID, accountID, zoneID string) error
UpdateCertificateID updates the SyncState to use the actual certificate ID.
func (*OriginCACertificateService) UpdateStatus ¶
func (s *OriginCACertificateService) UpdateStatus( ctx context.Context, cert *v1alpha2.OriginCACertificate, result *OriginCACertificateSyncResult, ) error
UpdateStatus updates the K8s OriginCACertificate resource status based on sync result.
type OriginCACertificateSyncResult ¶
type OriginCACertificateSyncResult struct {
// CertificateID is the certificate ID
CertificateID string
// ExpiresAt is the expiration time
ExpiresAt *metav1.Time
// Certificate is the certificate PEM
Certificate string
// PrivateKey is the private key PEM (only on creation)
PrivateKey string
}
OriginCACertificateSyncResult contains OriginCACertificate-specific sync result.
type PerformanceConfig ¶
type PerformanceConfig struct {
// Minify contains minification settings
Minify *MinifyConfig `json:"minify,omitempty"`
// Polish is the image optimization setting (lossy, lossless, off)
Polish string `json:"polish,omitempty"`
// Mirage enables Mirage (image optimization for mobile)
Mirage *bool `json:"mirage,omitempty"`
// Brotli enables Brotli compression
Brotli *bool `json:"brotli,omitempty"`
// EarlyHints enables Early Hints
EarlyHints *bool `json:"earlyHints,omitempty"`
// HTTP2 enables HTTP/2
HTTP2 *bool `json:"http2,omitempty"`
// HTTP3 enables HTTP/3
HTTP3 *bool `json:"http3,omitempty"`
// ZeroRTT enables 0-RTT Connection Resumption
ZeroRTT *bool `json:"zeroRtt,omitempty"`
// RocketLoader enables Rocket Loader
RocketLoader *bool `json:"rocketLoader,omitempty"`
}
PerformanceConfig contains performance configuration.
type SSLConfig ¶
type SSLConfig struct {
// Mode is the SSL mode (off, flexible, full, full_strict)
Mode string `json:"mode,omitempty"`
// MinVersion is the minimum TLS version (1.0, 1.1, 1.2, 1.3)
MinVersion string `json:"minVersion,omitempty"`
// AlwaysUseHTTPS enables automatic HTTPS redirect
AlwaysUseHTTPS *bool `json:"alwaysUseHttps,omitempty"`
// AutomaticHTTPSRewrites enables automatic HTTPS rewrites
AutomaticHTTPSRewrites *bool `json:"automaticHttpsRewrites,omitempty"`
// OpportunisticEncryption enables opportunistic encryption
OpportunisticEncryption *bool `json:"opportunisticEncryption,omitempty"`
}
SSLConfig contains SSL/TLS configuration.
type SecurityConfig ¶
type SecurityConfig struct {
// Level is the security level (essentially_off, low, medium, high, under_attack)
Level string `json:"level,omitempty"`
// BrowserIntegrityCheck enables browser integrity check
BrowserIntegrityCheck *bool `json:"browserIntegrityCheck,omitempty"`
// EmailObfuscation enables email obfuscation
EmailObfuscation *bool `json:"emailObfuscation,omitempty"`
// HotlinkProtection enables hotlink protection
HotlinkProtection *bool `json:"hotlinkProtection,omitempty"`
// WAF contains WAF configuration
WAF *WAFConfig `json:"waf,omitempty"`
}
SecurityConfig contains security configuration.
type VerificationConfig ¶
type VerificationConfig struct {
// Method is the verification method (dns, http)
Method string `json:"method,omitempty"`
// DNSRecord contains DNS verification settings
DNSRecord *DNSVerificationRecord `json:"dnsRecord,omitempty"`
}
VerificationConfig contains domain verification settings.
type WAFConfig ¶
type WAFConfig struct {
// Enabled enables the WAF
Enabled *bool `json:"enabled,omitempty"`
// RuleGroups contains rule group settings
RuleGroups []WAFRuleGroup `json:"ruleGroups,omitempty"`
}
WAFConfig contains WAF configuration.
type WAFRuleGroup ¶
type WAFRuleGroup struct {
// ID is the rule group ID
ID string `json:"id,omitempty"`
// Mode is the rule group mode (on, off, anomaly, traditional)
Mode string `json:"mode,omitempty"`
}
WAFRuleGroup contains a WAF rule group configuration.