api

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPermanentError

func IsPermanentError(err error) bool

IsPermanentError checks if an error is a permanent error (410)

func IsTemporaryDisabled

func IsTemporaryDisabled(err error) bool

IsTemporaryDisabled checks if an error indicates temporary deployment disabled (403)

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

APIError represents an API error response

func (*APIError) Error

func (e *APIError) Error() string

type BootstrapClaims

type BootstrapClaims struct {
	ComponentType string `json:"component_type"`
	DeploymentID  string `json:"deployment_id"`
	jwt.RegisteredClaims
}

BootstrapClaims for parsing JWT to get issuer

type BootstrapClient

type BootstrapClient struct {
	// contains filtered or unexported fields
}

BootstrapClient handles bootstrap API calls

func NewBootstrapClient

func NewBootstrapClient() *BootstrapClient

NewBootstrapClient creates a new bootstrap client

func (*BootstrapClient) Bootstrap

func (c *BootstrapClient) Bootstrap(ctx context.Context, token string, machineID string) (*BootstrapResponse, error)

Bootstrap performs the bootstrap operation with issuer-based URL IMPORTANT: We use manual JWT parsing here due to Yaegi's incompatibility with jwt/v5 struct tags. See: https://github.com/traefik/yaegi/discussions/1548

type BootstrapRequest

type BootstrapRequest struct {
	BootstrapToken   string   `json:"bootstrap_token"`
	ComponentType    string   `json:"component_type"`
	ComponentVersion string   `json:"component_version"`
	MachineID        string   `json:"machine_id"`
	Scopes           []string `json:"scopes,omitempty"`
}

BootstrapRequest represents the bootstrap API request

type BootstrapResponse

type BootstrapResponse struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	ConfigURL   string `json:"config_url"`
	LogsURL     string `json:"logs_url,omitempty"`
}

BootstrapResponse represents the bootstrap API response

type ConfigClient

type ConfigClient struct {
	// contains filtered or unexported fields
}

ConfigClient handles configuration API calls

func NewConfigClient

func NewConfigClient(baseURL string, tokenGetter func() string) *ConfigClient

NewConfigClient creates a new config client

func (*ConfigClient) GetEDLConfig

func (c *ConfigClient) GetEDLConfig(ctx context.Context) (*EDLConfig, error)

GetEDLConfig fetches the EDL configuration

type EDLConfig

type EDLConfig struct {
	DeploymentID           string  `json:"deployment_id"`
	Purpose                string  `json:"purpose"` // "allowlist", "blocklist", "other"
	Direction              string  `json:"direction"`
	UpdateFrequencySeconds int     `json:"update_frequency_seconds"`
	FirewallFormat         string  `json:"firewall_format"`
	URLs                   EDLURLs `json:"urls"`
}

EDLConfig represents the EDL configuration

type EDLURLs

type EDLURLs struct {
	Combined []string `json:"combined,omitempty"`
}

EDLURLs contains the EDL URLs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL