Documentation
¶
Overview ¶
Package virtualnetwork provides the VirtualNetworkService for managing Cloudflare VirtualNetwork configuration.
Package virtualnetwork provides types and service for VirtualNetwork configuration management.
Index ¶
- Constants
- type RegisterOptions
- type Service
- func (s *Service) GetSyncStatus(ctx context.Context, source service.Source, knownVNetID string) (*SyncStatus, error)
- func (s *Service) Register(ctx context.Context, opts RegisterOptions) error
- func (s *Service) Unregister(ctx context.Context, vnetID string, source service.Source) error
- func (s *Service) UpdateVirtualNetworkID(ctx context.Context, source service.Source, newVNetID string) error
- type SyncResult
- type SyncStatus
- type VirtualNetworkConfig
Constants ¶
const ( // ResourceType is the SyncState resource type for VirtualNetwork ResourceType = v1alpha2.SyncResourceVirtualNetwork // PriorityVirtualNetwork is the default priority for VirtualNetwork configuration PriorityVirtualNetwork = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RegisterOptions ¶
type RegisterOptions struct {
// AccountID is the Cloudflare Account ID
AccountID string
// VirtualNetworkID is the Cloudflare VirtualNetwork ID (if already created)
// Used as the CloudflareID in SyncState for existing networks
// For new networks, a placeholder is used until the network is created
VirtualNetworkID string
// Source identifies the K8s resource contributing this configuration
Source service.Source
// Config contains the VirtualNetwork configuration
Config VirtualNetworkConfig
// CredentialsRef references the CloudflareCredentials to use
CredentialsRef v1alpha2.CredentialsReference
}
RegisterOptions contains options for registering a VirtualNetwork configuration.
type Service ¶
type Service struct {
*service.BaseService
}
Service handles VirtualNetwork configuration registration. It implements the ConfigService interface for VirtualNetwork resources.
func NewService ¶
NewService creates a new VirtualNetworkService
func (*Service) GetSyncStatus ¶
func (s *Service) GetSyncStatus(ctx context.Context, source service.Source, knownVNetID string) (*SyncStatus, error)
GetSyncStatus returns the sync status for a VirtualNetwork.
func (*Service) Register ¶
func (s *Service) Register(ctx context.Context, opts RegisterOptions) error
Register registers a VirtualNetwork configuration to SyncState. Each VirtualNetwork K8s resource has its own SyncState, keyed by a generated ID (namespace/name) until the Cloudflare VirtualNetwork ID is known.
func (*Service) Unregister ¶
Unregister removes a VirtualNetwork's configuration from the SyncState. This is called when the VirtualNetwork K8s resource is deleted.
func (*Service) UpdateVirtualNetworkID ¶
func (s *Service) UpdateVirtualNetworkID(ctx context.Context, source service.Source, newVNetID string) error
UpdateVirtualNetworkID updates the SyncState to use the actual Cloudflare VirtualNetwork ID after the network is created. This migrates from the pending placeholder.
type SyncResult ¶
type SyncResult struct {
// VirtualNetworkID is the Cloudflare VirtualNetwork ID after sync
VirtualNetworkID string
// Name is the virtual network name
Name string
// IsDefault indicates if this is the default virtual network
IsDefault bool
}
SyncResult contains the result of a successful VirtualNetwork sync operation.
type SyncStatus ¶
type SyncStatus struct {
// IsSynced indicates whether the VirtualNetwork has been synced to Cloudflare
IsSynced bool
// VirtualNetworkID is the Cloudflare VirtualNetwork ID
VirtualNetworkID 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 VirtualNetwork.
type VirtualNetworkConfig ¶
type VirtualNetworkConfig struct {
// Name is the virtual network name
Name string `json:"name"`
// Comment is a user-provided comment for the virtual network
Comment string `json:"comment,omitempty"`
// IsDefaultNetwork indicates if this is the default virtual network
IsDefaultNetwork bool `json:"isDefaultNetwork,omitempty"`
}
VirtualNetworkConfig represents a VirtualNetwork configuration. Each VirtualNetwork K8s resource contributes one VirtualNetworkConfig to its SyncState.