hetzner

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionStatusRunning = "running"
	ActionStatusSuccess = "success"
	ActionStatusError   = "error"
)
View Source
const (
	CreateServerPayloadType  = "hetzner.server.created"
	CreateServerPollInterval = 5 * time.Second
)
View Source
const (
	DeleteServerPayloadType  = "hetzner.server.deleted"
	DeleteServerPollInterval = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Body       string
	Message    string
}

func (*APIError) Error

func (e *APIError) Error() string

type ActionResponse

type ActionResponse struct {
	ID       string `json:"id"`
	Status   string `json:"status"`
	Command  string `json:"command"`
	Progress int    `json:"progress"`
	Started  string `json:"started"`
	Finished string `json:"finished"`
	Error    *struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

type Client

type Client struct {
	Token   string
	BaseURL string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpCtx core.HTTPContext, integration core.IntegrationContext) (*Client, error)

func (*Client) CreateServer

func (c *Client) CreateServer(name, serverType, image, location string, sshKeys []string, userData string) (*ServerResponse, *ActionResponse, error)

func (*Client) DeleteServer

func (c *Client) DeleteServer(serverID string) (*ActionResponse, error)

func (*Client) GetAction

func (c *Client) GetAction(actionID string) (*ActionResponse, error)

func (*Client) GetServer

func (c *Client) GetServer(serverID string) (*ServerResponse, error)

func (*Client) ListImages

func (c *Client) ListImages() ([]ImageResponse, error)

func (*Client) ListLocations

func (c *Client) ListLocations() ([]LocationResponse, error)

func (*Client) ListServerTypes

func (c *Client) ListServerTypes() ([]ServerTypeResponse, error)

func (*Client) ListServers

func (c *Client) ListServers() ([]ServerResponse, error)

func (*Client) ServerTypeLocationNames

func (c *Client) ServerTypeLocationNames(serverTypeName string) ([]string, error)

ServerTypeLocationNames returns the location names (e.g. fsn1, nbg1) where the given server type is available. Prices in the API list per-location pricing, so a price entry means the type is available there.

func (*Client) Verify

func (c *Client) Verify() error

type Configuration

type Configuration struct {
	APIToken string `json:"apiToken" mapstructure:"apiToken"`
}

type CreateServer

type CreateServer struct{}

func (*CreateServer) Actions

func (c *CreateServer) Actions() []core.Action

func (*CreateServer) Cancel

func (c *CreateServer) Cancel(ctx core.ExecutionContext) error

func (*CreateServer) Cleanup

func (c *CreateServer) Cleanup(ctx core.SetupContext) error

func (*CreateServer) Color

func (c *CreateServer) Color() string

func (*CreateServer) Configuration

func (c *CreateServer) Configuration() []configuration.Field

func (*CreateServer) Description

func (c *CreateServer) Description() string

func (*CreateServer) Documentation

func (c *CreateServer) Documentation() string

func (*CreateServer) ExampleOutput

func (c *CreateServer) ExampleOutput() map[string]any

func (*CreateServer) Execute

func (c *CreateServer) Execute(ctx core.ExecutionContext) error

func (*CreateServer) HandleAction

func (c *CreateServer) HandleAction(ctx core.ActionContext) error

func (*CreateServer) HandleWebhook

func (c *CreateServer) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*CreateServer) Icon

func (c *CreateServer) Icon() string

func (*CreateServer) Label

func (c *CreateServer) Label() string

func (*CreateServer) Name

func (c *CreateServer) Name() string

func (*CreateServer) OutputChannels

func (c *CreateServer) OutputChannels(configuration any) []core.OutputChannel

func (*CreateServer) ProcessQueueItem

func (c *CreateServer) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*CreateServer) Setup

func (c *CreateServer) Setup(ctx core.SetupContext) error

type CreateServerExecutionMetadata

type CreateServerExecutionMetadata struct {
	ActionID string          `json:"actionId" mapstructure:"actionId"`
	Server   *ServerResponse `json:"server,omitempty" mapstructure:"server"`
}

type CreateServerSpec

type CreateServerSpec struct {
	Name       string   `json:"name" mapstructure:"name"`
	ServerType string   `json:"serverType" mapstructure:"serverType"`
	Image      string   `json:"image" mapstructure:"image"`
	Location   string   `json:"location" mapstructure:"location"`
	SSHKeys    []string `json:"sshKeys" mapstructure:"sshKeys"`
	UserData   string   `json:"userData" mapstructure:"userData"`
}

type DeleteServer

type DeleteServer struct{}

func (*DeleteServer) Actions

func (c *DeleteServer) Actions() []core.Action

func (*DeleteServer) Cancel

func (c *DeleteServer) Cancel(ctx core.ExecutionContext) error

func (*DeleteServer) Cleanup

func (c *DeleteServer) Cleanup(ctx core.SetupContext) error

func (*DeleteServer) Color

func (c *DeleteServer) Color() string

func (*DeleteServer) Configuration

func (c *DeleteServer) Configuration() []configuration.Field

func (*DeleteServer) Description

func (c *DeleteServer) Description() string

func (*DeleteServer) Documentation

func (c *DeleteServer) Documentation() string

func (*DeleteServer) ExampleOutput

func (c *DeleteServer) ExampleOutput() map[string]any

func (*DeleteServer) Execute

func (c *DeleteServer) Execute(ctx core.ExecutionContext) error

func (*DeleteServer) HandleAction

func (c *DeleteServer) HandleAction(ctx core.ActionContext) error

func (*DeleteServer) HandleWebhook

func (c *DeleteServer) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*DeleteServer) Icon

func (c *DeleteServer) Icon() string

func (*DeleteServer) Label

func (c *DeleteServer) Label() string

func (*DeleteServer) Name

func (c *DeleteServer) Name() string

func (*DeleteServer) OutputChannels

func (c *DeleteServer) OutputChannels(configuration any) []core.OutputChannel

func (*DeleteServer) ProcessQueueItem

func (c *DeleteServer) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*DeleteServer) Setup

func (c *DeleteServer) Setup(ctx core.SetupContext) error

type DeleteServerExecutionMetadata

type DeleteServerExecutionMetadata struct {
	ActionID string `json:"actionId" mapstructure:"actionId"`
	ServerID string `json:"serverId" mapstructure:"serverId"`
}

type DeleteServerSpec

type DeleteServerSpec struct {
	Server string `json:"server" mapstructure:"server"`
}

type Hetzner

type Hetzner struct{}

func (*Hetzner) Actions

func (h *Hetzner) Actions() []core.Action

func (*Hetzner) Cleanup

func (h *Hetzner) Cleanup(ctx core.IntegrationCleanupContext) error

func (*Hetzner) Components

func (h *Hetzner) Components() []core.Component

func (*Hetzner) Configuration

func (h *Hetzner) Configuration() []configuration.Field

func (*Hetzner) Description

func (h *Hetzner) Description() string

func (*Hetzner) HandleAction

func (h *Hetzner) HandleAction(ctx core.IntegrationActionContext) error

func (*Hetzner) HandleRequest

func (h *Hetzner) HandleRequest(ctx core.HTTPRequestContext)

func (*Hetzner) Icon

func (h *Hetzner) Icon() string

func (*Hetzner) Instructions

func (h *Hetzner) Instructions() string

func (*Hetzner) Label

func (h *Hetzner) Label() string

func (*Hetzner) ListResources

func (h *Hetzner) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Hetzner) Name

func (h *Hetzner) Name() string

func (*Hetzner) Sync

func (h *Hetzner) Sync(ctx core.SyncContext) error

func (*Hetzner) Triggers

func (h *Hetzner) Triggers() []core.Trigger

type ImageResponse

type ImageResponse struct {
	Name string `json:"name"`
	ID   int    `json:"id"`
}

type LocationResponse

type LocationResponse struct {
	Name        string `json:"name"`
	ID          int    `json:"id"`
	Description string `json:"description"`
	City        string `json:"city"`
	Country     string `json:"country"`
}

func (*LocationResponse) LocationDisplayName

func (l *LocationResponse) LocationDisplayName() string

LocationDisplayName returns a label for the location (e.g. "Nuremberg, DE (nbg1)").

type ServerResponse

type ServerResponse struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Status    string `json:"status"`
	Created   string `json:"created"`
	PublicNet struct {
		IPv4 struct {
			IP string `json:"ip"`
		} `json:"ipv4"`
	} `json:"public_net"`
}

type ServerTypePrice

type ServerTypePrice struct {
	Location string `json:"location"`
}

type ServerTypeResponse

type ServerTypeResponse struct {
	Name        string            `json:"name"`
	ID          int               `json:"id"`
	Description string            `json:"description"`
	Cores       int               `json:"cores"`
	Memory      float64           `json:"memory"`
	Disk        int               `json:"disk"`
	Prices      []ServerTypePrice `json:"prices"`
}

func (*ServerTypeResponse) ServerTypeDisplayName

func (s *ServerTypeResponse) ServerTypeDisplayName() string

ServerTypeDisplayName returns a label for the server type including specs (e.g. "cpx11 — 2 vCPU, 2 GB RAM, 40 GB disk").

Jump to

Keyboard shortcuts

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