Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultImage ¶
func DefaultImage(provider ProviderName) string
DefaultImage returns the default Ubuntu 24.04 image slug for each provider.
Types ¶
type CreateServerOptions ¶
type CreateServerOptions struct {
Name string
Region string
Size string
Image string
SSHKeyIDs []string
Tags map[string]string
}
CreateServerOptions contains the parameters for creating a new server.
type DNSProvider ¶
type DNSProvider interface {
CreateZone(ctx context.Context, domain string) error
GetZone(ctx context.Context, domain string) (*Zone, bool, error)
CreateRecord(ctx context.Context, domain string, record DNSRecord) (*DNSRecord, error)
DeleteRecord(ctx context.Context, domain string, recordID string) error
ListRecords(ctx context.Context, domain string) ([]DNSRecord, error)
}
DNSProvider is optionally implemented by providers supporting DNS management.
type Provider ¶
type Provider interface {
Name() string
DisplayName() string
CreateServer(ctx context.Context, opts CreateServerOptions) (*Server, error)
GetServer(ctx context.Context, id string) (*Server, error)
GetServers(ctx context.Context) ([]Server, error)
WaitForServer(ctx context.Context, id string, timeout time.Duration) (*Server, error)
GetRegions(ctx context.Context) ([]Region, error)
GetSizes(ctx context.Context, region string) ([]Size, error)
GetSSHKey(ctx context.Context, fingerprint string) (*SSHKey, error)
CreateSSHKey(ctx context.Context, name string, publicKey string) (*SSHKey, error)
}
Provider defines the interface for cloud server providers.
type ProviderName ¶
type ProviderName string
ProviderName identifies a cloud provider.
const ( ProviderDigitalOcean ProviderName = "digitalocean" ProviderHetzner ProviderName = "hetzner" )
func SupportedProviders ¶
func SupportedProviders() []ProviderName
type ProviderWithDNS ¶
type ProviderWithDNS interface {
Provider
DNSProvider
}
ProviderWithDNS combines both interfaces.
type Server ¶
type Server struct {
ID string
Name string
Status ServerStatus
PublicIPv4 string
PublicIPv6 string
Region string
Size string
Image string
CreatedAt time.Time
DashboardURL string
}
Server represents a cloud server instance.
type ServerStatus ¶
type ServerStatus string
ServerStatus represents the state of a server.
const ( ServerStatusPending ServerStatus = "pending" ServerStatusStarting ServerStatus = "starting" ServerStatusRunning ServerStatus = "running" ServerStatusStopped ServerStatus = "stopped" ServerStatusError ServerStatus = "error" ServerStatusUnknown ServerStatus = "unknown" )
Click to show internal directories.
Click to hide internal directories.