Documentation
¶
Index ¶
- Constants
- type ConnectorAction
- type ConnectorLifecycleConfig
- type ConnectorLifecycleResult
- type ConnectorService
- func (s *ConnectorService) GetSyncState(ctx context.Context, connectorName string) (*v1alpha2.CloudflareSyncState, error)
- func (s *ConnectorService) RequestCreate(ctx context.Context, opts CreateConnectorOptions) error
- func (s *ConnectorService) RequestDelete(ctx context.Context, opts DeleteConnectorOptions) error
- func (s *ConnectorService) RequestUpdate(ctx context.Context, opts UpdateConnectorOptions) error
- func (s *ConnectorService) Unregister(ctx context.Context, connectorName string, source service.Source) error
- type CreateConnectorOptions
- type DeleteConnectorOptions
- type RouteConfig
- type UpdateConnectorOptions
Constants ¶
const ( ResultKeyConnectorID = "connectorId" ResultKeyTunnelID = "tunnelId" ResultKeyTunnelToken = "tunnelToken" ResultKeyRoutesConfigured = "routesConfigured" )
Result data keys for WARPConnector SyncState
const ConnectorResourceType = v1alpha2.SyncResourceWARPConnector
ConnectorResourceType is the SyncState resource type for WARP connector lifecycle
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectorAction ¶
type ConnectorAction string
ConnectorAction defines the action to perform on a WARP connector
const ( // ConnectorActionCreate creates a new WARP connector ConnectorActionCreate ConnectorAction = "create" // ConnectorActionDelete deletes an existing WARP connector ConnectorActionDelete ConnectorAction = "delete" // ConnectorActionUpdate updates routes for an existing WARP connector ConnectorActionUpdate ConnectorAction = "update" )
type ConnectorLifecycleConfig ¶
type ConnectorLifecycleConfig struct {
// Action is the lifecycle operation to perform
Action ConnectorAction `json:"action"`
// ConnectorName is the name of the WARP connector
ConnectorName string `json:"connectorName"`
// ConnectorID is the existing WARP connector ID (for update/delete)
ConnectorID string `json:"connectorId,omitempty"`
// TunnelID is the tunnel ID associated with the WARP connector (for update/delete)
TunnelID string `json:"tunnelId,omitempty"`
// VirtualNetworkID is the Cloudflare VirtualNetwork ID for routes
VirtualNetworkID string `json:"virtualNetworkId,omitempty"`
// Routes are the routes to configure for the connector
Routes []RouteConfig `json:"routes,omitempty"`
}
ConnectorLifecycleConfig represents the configuration for a WARP connector lifecycle operation
func ParseLifecycleConfig ¶
func ParseLifecycleConfig(raw []byte) (*ConnectorLifecycleConfig, error)
ParseLifecycleConfig parses the lifecycle configuration from raw JSON
type ConnectorLifecycleResult ¶
type ConnectorLifecycleResult struct {
// ConnectorID is the Cloudflare WARP connector ID
ConnectorID string `json:"connectorId"`
// TunnelID is the tunnel ID associated with the connector
TunnelID string `json:"tunnelId"`
// TunnelToken is the token used by cloudflared to authenticate
TunnelToken string `json:"tunnelToken,omitempty"`
// RoutesConfigured is the number of routes successfully configured
RoutesConfigured int `json:"routesConfigured,omitempty"`
}
ConnectorLifecycleResult contains the result of a WARP connector lifecycle operation
type ConnectorService ¶
type ConnectorService struct {
*service.BaseService
}
ConnectorService provides operations for WARP connector lifecycle management. It manages SyncState resources for creating, updating, and deleting WARP connectors.
func NewConnectorService ¶
func NewConnectorService(c client.Client) *ConnectorService
NewConnectorService creates a new ConnectorService
func (*ConnectorService) GetSyncState ¶
func (s *ConnectorService) GetSyncState(ctx context.Context, connectorName string) (*v1alpha2.CloudflareSyncState, error)
GetSyncState returns the current SyncState for a WARP connector
func (*ConnectorService) RequestCreate ¶
func (s *ConnectorService) RequestCreate(ctx context.Context, opts CreateConnectorOptions) error
RequestCreate requests creation of a new WARP connector via SyncState
func (*ConnectorService) RequestDelete ¶
func (s *ConnectorService) RequestDelete(ctx context.Context, opts DeleteConnectorOptions) error
RequestDelete requests deletion of an existing WARP connector via SyncState
func (*ConnectorService) RequestUpdate ¶
func (s *ConnectorService) RequestUpdate(ctx context.Context, opts UpdateConnectorOptions) error
RequestUpdate requests updating routes for an existing WARP connector via SyncState
func (*ConnectorService) Unregister ¶
func (s *ConnectorService) Unregister(ctx context.Context, connectorName string, source service.Source) error
Unregister removes the source from the SyncState
type CreateConnectorOptions ¶
type CreateConnectorOptions struct {
// ConnectorName is the name of the connector to create
ConnectorName string
// AccountID is the Cloudflare account ID
AccountID string
// VirtualNetworkID is the Cloudflare VirtualNetwork ID for routes
VirtualNetworkID string
// Routes are the routes to configure
Routes []RouteConfig
// Source identifies the K8s resource
Source service.Source
// CredentialsRef references the CloudflareCredentials to use
CredentialsRef v1alpha2.CredentialsReference
}
CreateConnectorOptions contains options for creating a WARP connector
type DeleteConnectorOptions ¶
type DeleteConnectorOptions struct {
// ConnectorID is the ID of the connector to delete
ConnectorID string
// ConnectorName is the name of the connector (for SyncState naming)
ConnectorName string
// TunnelID is the tunnel ID for route deletion
TunnelID string
// VirtualNetworkID is the VirtualNetwork ID for route deletion
VirtualNetworkID string
// AccountID is the Cloudflare account ID
AccountID string
// Routes are the routes to delete
Routes []RouteConfig
// Source identifies the K8s resource
Source service.Source
// CredentialsRef references the CloudflareCredentials to use
CredentialsRef v1alpha2.CredentialsReference
}
DeleteConnectorOptions contains options for deleting a WARP connector
type RouteConfig ¶
type RouteConfig struct {
// Network is the CIDR for the route
Network string `json:"network"`
// Comment is an optional comment for the route
Comment string `json:"comment,omitempty"`
}
RouteConfig represents a route configuration for WARP connector
type UpdateConnectorOptions ¶
type UpdateConnectorOptions struct {
// ConnectorID is the ID of the connector
ConnectorID string
// ConnectorName is the name of the connector
ConnectorName string
// TunnelID is the tunnel ID for routes
TunnelID string
// VirtualNetworkID is the VirtualNetwork ID for routes
VirtualNetworkID string
// AccountID is the Cloudflare account ID
AccountID string
// Routes are the routes to configure
Routes []RouteConfig
// Source identifies the K8s resource
Source service.Source
// CredentialsRef references the CloudflareCredentials to use
CredentialsRef v1alpha2.CredentialsReference
}
UpdateConnectorOptions contains options for updating WARP connector routes