Documentation
¶
Overview ¶
Package networkroute provides the NetworkRouteService for managing Cloudflare NetworkRoute configuration.
Package networkroute provides types and service for NetworkRoute configuration management.
Index ¶
- Constants
- type NetworkRouteConfig
- type RegisterOptions
- type Service
- func (s *Service) GetSyncStatus(ctx context.Context, source service.Source, ...) (*SyncStatus, error)
- func (s *Service) Register(ctx context.Context, opts RegisterOptions) error
- func (s *Service) Unregister(ctx context.Context, network, virtualNetworkID string, source service.Source) error
- func (s *Service) UpdateRouteID(ctx context.Context, source service.Source, network, virtualNetworkID string) error
- type SyncResult
- type SyncStatus
Constants ¶
const ( // ResourceType is the SyncState resource type for NetworkRoute ResourceType = v1alpha2.SyncResourceNetworkRoute // PriorityNetworkRoute is the default priority for NetworkRoute configuration PriorityNetworkRoute = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetworkRouteConfig ¶
type NetworkRouteConfig struct {
// Network is the CIDR notation for the route (e.g., "10.0.0.0/8")
Network string `json:"network"`
// TunnelID is the Cloudflare Tunnel ID to route traffic through
TunnelID string `json:"tunnelId"`
// TunnelName is the Cloudflare Tunnel name (for display purposes)
TunnelName string `json:"tunnelName,omitempty"`
// VirtualNetworkID is the Cloudflare Virtual Network ID
VirtualNetworkID string `json:"virtualNetworkId,omitempty"`
// Comment is a user-provided comment for the route
Comment string `json:"comment,omitempty"`
}
NetworkRouteConfig represents a NetworkRoute configuration. Each NetworkRoute K8s resource contributes one NetworkRouteConfig to its SyncState.
type RegisterOptions ¶
type RegisterOptions struct {
// AccountID is the Cloudflare Account ID
AccountID string
// RouteNetwork is the network CIDR that serves as the route identifier
// Used as the CloudflareID in SyncState
// For new routes, a placeholder is used until the route is created
RouteNetwork string
// VirtualNetworkID is the Virtual Network ID for this route
VirtualNetworkID string
// Source identifies the K8s resource contributing this configuration
Source service.Source
// Config contains the NetworkRoute configuration
Config NetworkRouteConfig
// CredentialsRef references the CloudflareCredentials to use
CredentialsRef v1alpha2.CredentialsReference
}
RegisterOptions contains options for registering a NetworkRoute configuration.
type Service ¶
type Service struct {
*service.BaseService
}
Service handles NetworkRoute configuration registration. It implements the ConfigService interface for NetworkRoute resources.
func NewService ¶
NewService creates a new NetworkRouteService
func (*Service) GetSyncStatus ¶
func (s *Service) GetSyncStatus(ctx context.Context, source service.Source, knownNetwork, virtualNetworkID string) (*SyncStatus, error)
GetSyncStatus returns the sync status for a NetworkRoute.
func (*Service) Register ¶
func (s *Service) Register(ctx context.Context, opts RegisterOptions) error
Register registers a NetworkRoute configuration to SyncState. Each NetworkRoute K8s resource has its own SyncState, keyed by a generated ID based on the network CIDR and virtual network ID.
type SyncResult ¶
type SyncResult struct {
// Network is the CIDR notation for the route
Network string
// TunnelID is the Cloudflare Tunnel ID
TunnelID string
// TunnelName is the Cloudflare Tunnel name
TunnelName string
// VirtualNetworkID is the Cloudflare Virtual Network ID
VirtualNetworkID string
}
SyncResult contains the result of a successful NetworkRoute sync operation.
type SyncStatus ¶
type SyncStatus struct {
// IsSynced indicates whether the NetworkRoute has been synced to Cloudflare
IsSynced bool
// Network is the CIDR notation for the route
Network string
// AccountID is the Cloudflare Account ID
AccountID string
// SyncStateID is the name of the SyncState resource
SyncStateID string
}
SyncStatus represents the sync status of a NetworkRoute.