Documentation
¶
Overview ¶
Package r2 provides services for managing Cloudflare R2 resource configurations.
Index ¶
- Constants
- type BucketService
- func (s *BucketService) Register(ctx context.Context, opts R2BucketRegisterOptions) error
- func (s *BucketService) Unregister(ctx context.Context, bucketName string, source service.Source) error
- func (s *BucketService) UpdateBucketName(ctx context.Context, source service.Source, bucketName string) error
- func (s *BucketService) UpdateStatus(ctx context.Context, bucket *v1alpha2.R2Bucket, result *R2BucketSyncResult) error
- type DomainService
- func (s *DomainService) Register(ctx context.Context, opts R2BucketDomainRegisterOptions) error
- func (s *DomainService) Unregister(ctx context.Context, domainID string, source service.Source) error
- func (s *DomainService) UpdateDomainID(ctx context.Context, source service.Source, domainID, zoneID string) error
- func (s *DomainService) UpdateStatus(ctx context.Context, domain *v1alpha2.R2BucketDomain, ...) error
- type NotificationService
- func (s *NotificationService) Register(ctx context.Context, opts R2BucketNotificationRegisterOptions) error
- func (s *NotificationService) Unregister(ctx context.Context, queueID string, source service.Source) error
- func (s *NotificationService) UpdateQueueID(ctx context.Context, source service.Source, queueID string) error
- func (s *NotificationService) UpdateStatus(ctx context.Context, notification *v1alpha2.R2BucketNotification, ...) error
- type R2BucketConfig
- type R2BucketDomainConfig
- type R2BucketDomainRegisterOptions
- type R2BucketDomainSyncResult
- type R2BucketNotificationConfig
- type R2BucketNotificationRegisterOptions
- type R2BucketNotificationSyncResult
- type R2BucketRegisterOptions
- type R2BucketSyncResult
- type R2LifecycleConfig
- type SyncResult
Constants ¶
const ( // ResourceTypeR2Bucket is the SyncState resource type for R2Bucket ResourceTypeR2Bucket = v1alpha2.SyncResourceR2Bucket // ResourceTypeR2BucketDomain is the SyncState resource type for R2BucketDomain ResourceTypeR2BucketDomain = v1alpha2.SyncResourceR2BucketDomain // ResourceTypeR2BucketNotification is the SyncState resource type for R2BucketNotification ResourceTypeR2BucketNotification = v1alpha2.SyncResourceR2BucketNotification // Priority constants PriorityR2Bucket = 100 PriorityR2BucketDomain = 100 PriorityR2BucketNotification = 100 )
Resource Types for SyncState - use constants from v1alpha2
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketService ¶
type BucketService struct {
*service.BaseService
}
BucketService manages R2Bucket configurations via CloudflareSyncState.
func NewBucketService ¶
func NewBucketService(c client.Client) *BucketService
NewBucketService creates a new R2Bucket service.
func (*BucketService) Register ¶
func (s *BucketService) Register(ctx context.Context, opts R2BucketRegisterOptions) error
Register registers an R2Bucket configuration with the SyncState.
func (*BucketService) Unregister ¶
func (s *BucketService) Unregister(ctx context.Context, bucketName string, source service.Source) error
Unregister removes a configuration from the SyncState.
func (*BucketService) UpdateBucketName ¶
func (s *BucketService) UpdateBucketName(ctx context.Context, source service.Source, bucketName string) error
UpdateBucketName updates the SyncState to use the actual bucket name after the bucket is created.
func (*BucketService) UpdateStatus ¶
func (s *BucketService) UpdateStatus( ctx context.Context, bucket *v1alpha2.R2Bucket, result *R2BucketSyncResult, ) error
UpdateStatus updates the K8s R2Bucket resource status based on sync result.
type DomainService ¶
type DomainService struct {
*service.BaseService
}
DomainService manages R2BucketDomain configurations via CloudflareSyncState.
func NewDomainService ¶
func NewDomainService(c client.Client) *DomainService
NewDomainService creates a new R2BucketDomain service.
func (*DomainService) Register ¶
func (s *DomainService) Register(ctx context.Context, opts R2BucketDomainRegisterOptions) error
Register registers an R2BucketDomain configuration with the SyncState.
func (*DomainService) Unregister ¶
func (s *DomainService) Unregister(ctx context.Context, domainID string, source service.Source) error
Unregister removes a configuration from the SyncState.
func (*DomainService) UpdateDomainID ¶
func (s *DomainService) UpdateDomainID(ctx context.Context, source service.Source, domainID, zoneID string) error
UpdateDomainID updates the SyncState to use the actual domain ID after the domain is configured.
func (*DomainService) UpdateStatus ¶
func (s *DomainService) UpdateStatus( ctx context.Context, domain *v1alpha2.R2BucketDomain, result *R2BucketDomainSyncResult, ) error
UpdateStatus updates the K8s R2BucketDomain resource status based on sync result.
type NotificationService ¶
type NotificationService struct {
*service.BaseService
}
NotificationService manages R2BucketNotification configurations via CloudflareSyncState.
func NewNotificationService ¶
func NewNotificationService(c client.Client) *NotificationService
NewNotificationService creates a new R2BucketNotification service.
func (*NotificationService) Register ¶
func (s *NotificationService) Register(ctx context.Context, opts R2BucketNotificationRegisterOptions) error
Register registers an R2BucketNotification configuration with the SyncState.
func (*NotificationService) Unregister ¶
func (s *NotificationService) Unregister(ctx context.Context, queueID string, source service.Source) error
Unregister removes a configuration from the SyncState.
func (*NotificationService) UpdateQueueID ¶
func (s *NotificationService) UpdateQueueID(ctx context.Context, source service.Source, queueID string) error
UpdateQueueID updates the SyncState to use the actual queue ID after the queue is resolved.
func (*NotificationService) UpdateStatus ¶
func (s *NotificationService) UpdateStatus( ctx context.Context, notification *v1alpha2.R2BucketNotification, result *R2BucketNotificationSyncResult, ) error
UpdateStatus updates the K8s R2BucketNotification resource status based on sync result.
type R2BucketConfig ¶
type R2BucketConfig struct {
// Name is the bucket name in Cloudflare
Name string `json:"name"`
// LocationHint is the preferred geographic location
LocationHint string `json:"locationHint,omitempty"`
// CORS contains CORS rules for the bucket
CORS []v1alpha2.R2CORSRule `json:"cors,omitempty"`
// Lifecycle contains object lifecycle rules
Lifecycle *R2LifecycleConfig `json:"lifecycle,omitempty"`
}
R2BucketConfig contains the configuration for an R2 Bucket.
type R2BucketDomainConfig ¶
type R2BucketDomainConfig struct {
// BucketName is the target R2 bucket
BucketName string `json:"bucketName"`
// Domain is the custom domain FQDN
Domain string `json:"domain"`
// ZoneID is the Cloudflare zone ID (can be empty for auto-lookup)
ZoneID string `json:"zoneId,omitempty"`
// MinTLS is the minimum TLS version
MinTLS string `json:"minTls,omitempty"`
// EnablePublicAccess enables public bucket access
EnablePublicAccess *bool `json:"enablePublicAccess,omitempty"`
}
R2BucketDomainConfig contains the configuration for an R2 custom domain.
type R2BucketDomainRegisterOptions ¶
type R2BucketDomainRegisterOptions struct {
// AccountID is the Cloudflare account ID
AccountID string
// DomainID is the existing domain configuration ID (empty for new)
DomainID string
// ZoneID is the Cloudflare zone ID
ZoneID string
// Source is the K8s resource source
Source service.Source
// Config is the domain configuration
Config R2BucketDomainConfig
// CredentialsRef references the CloudflareCredentials resource
CredentialsRef v1alpha2.CredentialsReference
}
R2BucketDomainRegisterOptions contains options for registering an R2BucketDomain.
type R2BucketDomainSyncResult ¶
type R2BucketDomainSyncResult struct {
SyncResult
// DomainID is the domain configuration ID
DomainID string
// ZoneID is the Cloudflare zone ID
ZoneID string
// Enabled indicates if the domain is enabled
Enabled bool
// MinTLS is the configured TLS version
MinTLS string
// PublicAccessEnabled indicates public access status
PublicAccessEnabled bool
// URL is the full HTTPS URL
URL string
// SSLStatus is the SSL certificate status
SSLStatus string
// OwnershipStatus is the domain ownership status
OwnershipStatus string
}
R2BucketDomainSyncResult contains R2BucketDomain-specific sync result.
type R2BucketNotificationConfig ¶
type R2BucketNotificationConfig struct {
// BucketName is the target R2 bucket
BucketName string `json:"bucketName"`
// QueueName is the Cloudflare Queue name
QueueName string `json:"queueName"`
// Rules defines notification rules
Rules []v1alpha2.R2NotificationRule `json:"rules"`
}
R2BucketNotificationConfig contains the configuration for R2 event notifications.
type R2BucketNotificationRegisterOptions ¶
type R2BucketNotificationRegisterOptions struct {
// AccountID is the Cloudflare account ID
AccountID string
// QueueID is the resolved Cloudflare Queue ID
QueueID string
// Source is the K8s resource source
Source service.Source
// Config is the notification configuration
Config R2BucketNotificationConfig
// CredentialsRef references the CloudflareCredentials resource
CredentialsRef v1alpha2.CredentialsReference
}
R2BucketNotificationRegisterOptions contains options for registering an R2BucketNotification.
type R2BucketNotificationSyncResult ¶
type R2BucketNotificationSyncResult struct {
SyncResult
// QueueID is the resolved Queue ID
QueueID string
// RuleCount is the number of notification rules
RuleCount int
}
R2BucketNotificationSyncResult contains R2BucketNotification-specific sync result.
type R2BucketRegisterOptions ¶
type R2BucketRegisterOptions struct {
// AccountID is the Cloudflare account ID
AccountID string
// BucketName is the existing bucket name (empty for new)
BucketName string
// Source is the K8s resource source
Source service.Source
// Config is the bucket configuration
Config R2BucketConfig
// CredentialsRef references the CloudflareCredentials resource
CredentialsRef v1alpha2.CredentialsReference
}
R2BucketRegisterOptions contains options for registering an R2Bucket.
type R2BucketSyncResult ¶
type R2BucketSyncResult struct {
SyncResult
// BucketName is the actual bucket name
BucketName string
// Location is the bucket location
Location string
// CreatedAt is the creation timestamp
CreatedAt string
// CORSRulesCount is the number of CORS rules
CORSRulesCount int
// LifecycleRulesCount is the number of lifecycle rules
LifecycleRulesCount int
}
R2BucketSyncResult contains R2Bucket-specific sync result.
type R2LifecycleConfig ¶
type R2LifecycleConfig struct {
// Rules contains the lifecycle rules
Rules []v1alpha2.R2LifecycleRule `json:"rules,omitempty"`
// DeletionPolicy determines behavior on K8s resource deletion
DeletionPolicy string `json:"deletionPolicy,omitempty"`
}
R2LifecycleConfig wraps the lifecycle rules configuration.
type SyncResult ¶
type SyncResult struct {
// ID is the Cloudflare resource ID
ID string
// AccountID is the Cloudflare account ID
AccountID string
}
SyncResult contains the result of a sync operation.