hcloudclient

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package hcloudclient defines and implements the interface for talking to Hetzner HCloud API.

Index

Constants

This section is empty.

Variables

View Source
var DebugAPICalls bool

DebugAPICalls loggs all hcloud API calls if true.

View Source
var ErrUnauthorized = fmt.Errorf("unauthorized")

ErrUnauthorized means that the API call is unauthorized.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Reset resets the local cache. Only implemented in the fake client.
	Reset()

	CreateLoadBalancer(context.Context, hcloud.LoadBalancerCreateOpts) (*hcloud.LoadBalancer, error)
	DeleteLoadBalancer(context.Context, int64) error
	ListLoadBalancers(context.Context, hcloud.LoadBalancerListOpts) ([]*hcloud.LoadBalancer, error)
	AttachLoadBalancerToNetwork(context.Context, *hcloud.LoadBalancer, hcloud.LoadBalancerAttachToNetworkOpts) error
	ChangeLoadBalancerType(context.Context, *hcloud.LoadBalancer, hcloud.LoadBalancerChangeTypeOpts) error
	ChangeLoadBalancerAlgorithm(context.Context, *hcloud.LoadBalancer, hcloud.LoadBalancerChangeAlgorithmOpts) error
	UpdateLoadBalancer(context.Context, *hcloud.LoadBalancer, hcloud.LoadBalancerUpdateOpts) (*hcloud.LoadBalancer, error)
	AddTargetServerToLoadBalancer(context.Context, hcloud.LoadBalancerAddServerTargetOpts, *hcloud.LoadBalancer) error
	DeleteTargetServerOfLoadBalancer(context.Context, *hcloud.LoadBalancer, *hcloud.Server) error
	AddIPTargetToLoadBalancer(context.Context, hcloud.LoadBalancerAddIPTargetOpts, *hcloud.LoadBalancer) error
	DeleteIPTargetOfLoadBalancer(context.Context, *hcloud.LoadBalancer, net.IP) error
	AddServiceToLoadBalancer(context.Context, *hcloud.LoadBalancer, hcloud.LoadBalancerAddServiceOpts) error
	DeleteServiceFromLoadBalancer(context.Context, *hcloud.LoadBalancer, int) error
	ListImages(context.Context, hcloud.ImageListOpts) ([]*hcloud.Image, error)
	CreateServer(context.Context, hcloud.ServerCreateOpts) (*hcloud.Server, error)
	AttachServerToNetwork(context.Context, *hcloud.Server, hcloud.ServerAttachToNetworkOpts) error
	ListServers(context.Context, hcloud.ServerListOpts) ([]*hcloud.Server, error)
	GetServer(context.Context, int64) (*hcloud.Server, error)
	DeleteServer(context.Context, *hcloud.Server) error
	ListServerTypes(context.Context) ([]*hcloud.ServerType, error)
	GetServerType(context.Context, string) (*hcloud.ServerType, error)
	PowerOnServer(context.Context, *hcloud.Server) error
	ShutdownServer(context.Context, *hcloud.Server) error
	RebootServer(context.Context, *hcloud.Server) error
	CreateNetwork(context.Context, hcloud.NetworkCreateOpts) (*hcloud.Network, error)
	ListNetworks(context.Context, hcloud.NetworkListOpts) ([]*hcloud.Network, error)
	DeleteNetwork(context.Context, *hcloud.Network) error
	ListSSHKeys(context.Context, hcloud.SSHKeyListOpts) ([]*hcloud.SSHKey, error)
	CreatePlacementGroup(context.Context, hcloud.PlacementGroupCreateOpts) (*hcloud.PlacementGroup, error)
	DeletePlacementGroup(context.Context, int64) error
	ListPlacementGroups(context.Context, hcloud.PlacementGroupListOpts) ([]*hcloud.PlacementGroup, error)
	AddServerToPlacementGroup(context.Context, *hcloud.Server, *hcloud.PlacementGroup) error
}

Client collects all methods used by the controller in the hcloud cloud API.

type Factory

type Factory interface {
	// NewClient returns a new Client in the real implementation, and the shared global Client in the fake implementation.
	NewClient(hcloudToken string) Client
}

Factory is the interface for creating new Client objects.

func NewFactory

func NewFactory() Factory

NewFactory creates a new factory for HCloud clients.

type LoggingTransport

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

LoggingTransport is a struct for creating new logger for hcloud API.

func (*LoggingTransport) RoundTrip

func (lt *LoggingTransport) RoundTrip(req *http.Request) (resp *http.Response, err error)

RoundTrip is used for logging api calls to hcloud API.

Directories

Path Synopsis
Package fake implements fakes for important interfaces like the HCloud API.
Package fake implements fakes for important interfaces like the HCloud API.

Jump to

Keyboard shortcuts

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