providers

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CredentialsPath

func CredentialsPath() string

func SaveCredentials

func SaveCredentials(c *Credentials) error

Types

type BareMetal

type BareMetal struct {
	ID       string
	Name     string
	Label    string
	IP       string
	Status   string
	Plan     string
	Location string
	Template string
}

type BareMetalCreateConfig

type BareMetalCreateConfig struct {
	Label      string
	Plan       string
	Location   string
	Template   string
	Hostname   string
	SSHKeyIDs  []int
	Password   string
	UserData   string
	EnableIPv4 bool
	EnableIPv6 bool
	Backups    bool
}

type Credentials

type Credentials struct {
	CubePathAPIKey    string `yaml:"cubepath_api_key"`
	HetznerAPIToken   string `yaml:"hetzner_api_token"`
	DigitalOceanToken string `yaml:"digitalocean_token"`
	VultrAPIKey       string `yaml:"vultr_api_key"`
	AWSRegion         string `yaml:"aws_region"`
	AWSProfile        string `yaml:"aws_profile"`
}

func LoadCredentials

func LoadCredentials() (*Credentials, error)

type DNSRecord

type DNSRecord struct {
	ID       string
	Type     string // A, AAAA, CNAME, MX, TXT, NS, etc.
	Name     string
	Value    string
	TTL      int
	Priority int // for MX
}

type DNSZone

type DNSZone struct {
	ID     string
	Name   string
	DNSSec bool
}

type K8sAddon added in v0.4.0

type K8sAddon struct {
	ID        string
	Name      string
	Slug      string
	Version   string
	Status    string
	Installed bool
}

type K8sCluster

type K8sCluster struct {
	ID         string
	Name       string
	Label      string
	Status     string
	Location   string
	Version    string
	NodeCount  int
	Endpoint   string
	Kubeconfig string
}

type K8sCreateConfig

type K8sCreateConfig struct {
	Name      string
	Label     string
	Location  string
	Version   string
	NodePlan  string
	NodeCount int
	AutoScale bool
	MinNodes  int
	MaxNodes  int
}

type K8sNodePool added in v0.4.0

type K8sNodePool struct {
	ID     string
	Name   string
	Plan   string
	Nodes  int
	Status string
}

type K8sNodePoolConfig added in v0.4.0

type K8sNodePoolConfig struct {
	Name      string
	Plan      string
	NodeCount int
}

type LBCreateConfig

type LBCreateConfig struct {
	Name      string
	Label     string
	Location  string
	Plan      string
	VPCID     string
	Algorithm string // round_robin, least_connections, etc.
}

type LBHealthCheckConfig added in v0.4.0

type LBHealthCheckConfig struct {
	Protocol string
	Port     int
	Path     string
	Interval int
	Timeout  int
	Retries  int
}

type LBListener added in v0.4.0

type LBListener struct {
	ID          string
	Port        int
	TargetPort  int
	Protocol    string
	HealthCheck *LBHealthCheckConfig
}

type LBListenerConfig added in v0.4.0

type LBListenerConfig struct {
	Port       int
	TargetPort int
	Protocol   string
}

type LBTarget added in v0.4.0

type LBTarget struct {
	ID       string
	Type     string
	TargetID string
	Port     int
	Weight   int
	Status   string
}

type LBTargetConfig added in v0.4.0

type LBTargetConfig struct {
	Type     string // vps, ip, baremetal
	TargetID string
	Port     int
	Weight   int
}

type LoadBalancer

type LoadBalancer struct {
	ID       string
	Name     string
	Label    string
	Status   string
	IP       string
	Location string
	Plan     string
}

type Provider

type Provider interface {
	// VPS
	CreateVPS(ctx context.Context, cfg VPSCreateConfig) (*VPS, error)
	DeleteVPS(ctx context.Context, id string) error
	ListVPS(ctx context.Context) ([]VPS, error)
	GetVPS(ctx context.Context, id string) (*VPS, error)

	// Kubernetes
	CreateK8s(ctx context.Context, cfg K8sCreateConfig) (*K8sCluster, error)
	DeleteK8s(ctx context.Context, id string) error
	ListK8s(ctx context.Context) ([]K8sCluster, error)
	GetK8s(ctx context.Context, id string) (*K8sCluster, error)
	GetKubeconfig(ctx context.Context, id string) (string, error)
	UpdateK8s(ctx context.Context, id, version string) (*K8sCluster, error)
	ToggleK8sProtection(ctx context.Context, id string) (*K8sCluster, error)
	ListK8sAddons(ctx context.Context, id string) ([]K8sAddon, error)
	ListAvailableAddons(ctx context.Context) ([]K8sAddon, error)
	InstallK8sAddon(ctx context.Context, id, slug string) error
	UninstallK8sAddon(ctx context.Context, id, addonID string) error
	ListK8sNodePools(ctx context.Context, id string) ([]K8sNodePool, error)
	CreateK8sNodePool(ctx context.Context, id string, cfg K8sNodePoolConfig) (*K8sNodePool, error)
	ScaleK8sNodePool(ctx context.Context, id, poolID string, nodes int) error
	DeleteK8sNodePool(ctx context.Context, id, poolID string) error
	ListK8sLBs(ctx context.Context, id string) ([]LoadBalancer, error)

	// Bare Metal
	CreateBareMetal(ctx context.Context, cfg BareMetalCreateConfig) (*BareMetal, error)
	DeleteBareMetal(ctx context.Context, id string) error
	ListBareMetal(ctx context.Context) ([]BareMetal, error)

	// Load Balancer
	CreateLB(ctx context.Context, cfg LBCreateConfig) (*LoadBalancer, error)
	DeleteLB(ctx context.Context, id string) error
	ListLB(ctx context.Context) ([]LoadBalancer, error)
	CreateLBListener(ctx context.Context, lbID string, cfg LBListenerConfig) (*LBListener, error)
	UpdateLBListener(ctx context.Context, lbID, listenerID string, cfg LBListenerConfig) (*LBListener, error)
	DeleteLBListener(ctx context.Context, lbID, listenerID string) error
	SetLBHealthCheck(ctx context.Context, lbID, listenerID string, cfg LBHealthCheckConfig) error
	AddLBTarget(ctx context.Context, lbID, listenerID string, cfg LBTargetConfig) (*LBTarget, error)
	ListLBTargets(ctx context.Context, lbID, listenerID string) ([]LBTarget, error)
	DrainLBTarget(ctx context.Context, lbID, listenerID, targetID string) error
	ResizeLB(ctx context.Context, lbID, plan string) (*LoadBalancer, error)
	GetLBMetrics(ctx context.Context, lbID string) (string, error)
	ToggleLBProtection(ctx context.Context, lbID string) (*LoadBalancer, error)

	// DNS
	ListDNSZones(ctx context.Context) ([]DNSZone, error)
	CreateDNSRecord(ctx context.Context, zoneID string, r DNSRecord) error
	DeleteDNSRecord(ctx context.Context, zoneID, recordID string) error

	// SSH Keys
	CreateSSHKey(ctx context.Context, cfg SSHKeyCreateConfig) (*SSHKey, error)
	ListSSHKeys(ctx context.Context) ([]SSHKey, error)
	DeleteSSHKey(ctx context.Context, id string) error
}

Provider defines all operations a cloud provider can support. Each method returns "not implemented" if the provider doesn't offer that service.

type SSHKey

type SSHKey struct {
	ID          string
	Name        string
	Fingerprint string
	PublicKey   string
	Created     string
}

type SSHKeyCreateConfig

type SSHKeyCreateConfig struct {
	Name      string
	PublicKey string
}

type VPS

type VPS struct {
	ID       string
	Name     string
	Label    string
	IP       string
	IPv6     string
	Status   string
	Plan     string
	Location string
	Template string
}

type VPSCreateConfig

type VPSCreateConfig struct {
	Label      string
	Plan       string
	Location   string
	Template   string
	Hostname   string
	SSHKeyIDs  []int
	EnableIPv4 bool
	EnableIPv6 bool
	Backups    bool
	User       string
	Password   string
	UserData   string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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