Documentation
¶
Index ¶
- Constants
- type APIError
- type ActionResponse
- type Client
- func (c *Client) CreateServer(name, serverType, image, location string, sshKeys []string, userData string) (*ServerResponse, *ActionResponse, error)
- func (c *Client) DeleteServer(serverID string) (*ActionResponse, error)
- func (c *Client) GetAction(actionID string) (*ActionResponse, error)
- func (c *Client) GetServer(serverID string) (*ServerResponse, error)
- func (c *Client) ListImages() ([]ImageResponse, error)
- func (c *Client) ListLocations() ([]LocationResponse, error)
- func (c *Client) ListServerTypes() ([]ServerTypeResponse, error)
- func (c *Client) ListServers() ([]ServerResponse, error)
- func (c *Client) ServerTypeLocationNames(serverTypeName string) ([]string, error)
- func (c *Client) Verify() error
- type Configuration
- type CreateServer
- func (c *CreateServer) Actions() []core.Action
- func (c *CreateServer) Cancel(ctx core.ExecutionContext) error
- func (c *CreateServer) Cleanup(ctx core.SetupContext) error
- func (c *CreateServer) Color() string
- func (c *CreateServer) Configuration() []configuration.Field
- func (c *CreateServer) Description() string
- func (c *CreateServer) Documentation() string
- func (c *CreateServer) ExampleOutput() map[string]any
- func (c *CreateServer) Execute(ctx core.ExecutionContext) error
- func (c *CreateServer) HandleAction(ctx core.ActionContext) error
- func (c *CreateServer) HandleWebhook(ctx core.WebhookRequestContext) (int, error)
- func (c *CreateServer) Icon() string
- func (c *CreateServer) Label() string
- func (c *CreateServer) Name() string
- func (c *CreateServer) OutputChannels(configuration any) []core.OutputChannel
- func (c *CreateServer) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
- func (c *CreateServer) Setup(ctx core.SetupContext) error
- type CreateServerExecutionMetadata
- type CreateServerSpec
- type DeleteServer
- func (c *DeleteServer) Actions() []core.Action
- func (c *DeleteServer) Cancel(ctx core.ExecutionContext) error
- func (c *DeleteServer) Cleanup(ctx core.SetupContext) error
- func (c *DeleteServer) Color() string
- func (c *DeleteServer) Configuration() []configuration.Field
- func (c *DeleteServer) Description() string
- func (c *DeleteServer) Documentation() string
- func (c *DeleteServer) ExampleOutput() map[string]any
- func (c *DeleteServer) Execute(ctx core.ExecutionContext) error
- func (c *DeleteServer) HandleAction(ctx core.ActionContext) error
- func (c *DeleteServer) HandleWebhook(ctx core.WebhookRequestContext) (int, error)
- func (c *DeleteServer) Icon() string
- func (c *DeleteServer) Label() string
- func (c *DeleteServer) Name() string
- func (c *DeleteServer) OutputChannels(configuration any) []core.OutputChannel
- func (c *DeleteServer) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)
- func (c *DeleteServer) Setup(ctx core.SetupContext) error
- type DeleteServerExecutionMetadata
- type DeleteServerSpec
- type Hetzner
- func (h *Hetzner) Actions() []core.Action
- func (h *Hetzner) Cleanup(ctx core.IntegrationCleanupContext) error
- func (h *Hetzner) Components() []core.Component
- func (h *Hetzner) Configuration() []configuration.Field
- func (h *Hetzner) Description() string
- func (h *Hetzner) HandleAction(ctx core.IntegrationActionContext) error
- func (h *Hetzner) HandleRequest(ctx core.HTTPRequestContext)
- func (h *Hetzner) Icon() string
- func (h *Hetzner) Instructions() string
- func (h *Hetzner) Label() string
- func (h *Hetzner) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)
- func (h *Hetzner) Name() string
- func (h *Hetzner) Sync(ctx core.SyncContext) error
- func (h *Hetzner) Triggers() []core.Trigger
- type ImageResponse
- type LocationResponse
- type ServerResponse
- type ServerTypePrice
- type ServerTypeResponse
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 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 ¶
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) 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 ¶
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.
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 DeleteServerSpec ¶
type DeleteServerSpec struct {
Server string `json:"server" mapstructure:"server"`
}
type Hetzner ¶
type Hetzner struct{}
func (*Hetzner) Components ¶
func (*Hetzner) Configuration ¶
func (h *Hetzner) Configuration() []configuration.Field
func (*Hetzner) Description ¶
func (*Hetzner) HandleAction ¶
func (h *Hetzner) HandleAction(ctx core.IntegrationActionContext) error
func (*Hetzner) HandleRequest ¶
func (h *Hetzner) HandleRequest(ctx core.HTTPRequestContext)
func (*Hetzner) Instructions ¶
func (*Hetzner) ListResources ¶
func (h *Hetzner) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)
type ImageResponse ¶
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 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").
Click to show internal directories.
Click to hide internal directories.