Documentation ¶
Overview ¶
Package hcloud is a library for the Hetzner Cloud API.
Example ¶
package main import ( "context" "fmt" "log" "github.com/hetznercloud/hcloud-go/hcloud" ) func main() { client := hcloud.NewClient(hcloud.WithToken("token")) server, _, err := client.Server.GetByID(context.Background(), 1) if err != nil { log.Fatalf("error retrieving server: %s\n", err) } if server != nil { fmt.Printf("server 1 is called %q\n", server.Name) } else { fmt.Println("server 1 not found") } }
Output:
Index ¶
- Constants
- func Bool(b bool) *bool
- func Duration(d time.Duration) *time.Duration
- func Int(i int) *int
- func IsError(err error, code ErrorCode) bool
- func String(s string) *string
- type Action
- type ActionClient
- func (c *ActionClient) All(ctx context.Context) ([]*Action, error)
- func (c *ActionClient) GetByID(ctx context.Context, id int) (*Action, *Response, error)
- func (c *ActionClient) List(ctx context.Context, opts ActionListOpts) ([]*Action, *Response, error)
- func (c *ActionClient) WatchProgress(ctx context.Context, action *Action) (<-chan int, <-chan error)
- type ActionError
- type ActionListOpts
- type ActionResource
- type ActionResourceType
- type ActionStatus
- type BackoffFunc
- type CPUType
- type Certificate
- type CertificateClient
- func (c *CertificateClient) All(ctx context.Context) ([]*Certificate, error)
- func (c *CertificateClient) AllWithOpts(ctx context.Context, opts CertificateListOpts) ([]*Certificate, error)
- func (c *CertificateClient) Create(ctx context.Context, opts CertificateCreateOpts) (*Certificate, *Response, error)
- func (c *CertificateClient) Delete(ctx context.Context, certificate *Certificate) (*Response, error)
- func (c *CertificateClient) Get(ctx context.Context, idOrName string) (*Certificate, *Response, error)
- func (c *CertificateClient) GetByID(ctx context.Context, id int) (*Certificate, *Response, error)
- func (c *CertificateClient) GetByName(ctx context.Context, name string) (*Certificate, *Response, error)
- func (c *CertificateClient) List(ctx context.Context, opts CertificateListOpts) ([]*Certificate, *Response, error)
- func (c *CertificateClient) Update(ctx context.Context, certificate *Certificate, opts CertificateUpdateOpts) (*Certificate, *Response, error)
- type CertificateCreateOpts
- type CertificateListOpts
- type CertificateUpdateOpts
- type Client
- type ClientOption
- func WithApplication(name, version string) ClientOption
- func WithBackoffFunc(f BackoffFunc) ClientOption
- func WithDebugWriter(debugWriter io.Writer) ClientOption
- func WithEndpoint(endpoint string) ClientOption
- func WithHTTPClient(httpClient *http.Client) ClientOption
- func WithPollInterval(pollInterval time.Duration) ClientOption
- func WithToken(token string) ClientOption
- type Datacenter
- type DatacenterClient
- func (c *DatacenterClient) All(ctx context.Context) ([]*Datacenter, error)
- func (c *DatacenterClient) Get(ctx context.Context, idOrName string) (*Datacenter, *Response, error)
- func (c *DatacenterClient) GetByID(ctx context.Context, id int) (*Datacenter, *Response, error)
- func (c *DatacenterClient) GetByName(ctx context.Context, name string) (*Datacenter, *Response, error)
- func (c *DatacenterClient) List(ctx context.Context, opts DatacenterListOpts) ([]*Datacenter, *Response, error)
- type DatacenterListOpts
- type DatacenterServerTypes
- type Error
- type ErrorCode
- type ErrorDetailsInvalidInput
- type ErrorDetailsInvalidInputField
- type FloatingIP
- type FloatingIPChangeProtectionOpts
- type FloatingIPClient
- func (c *FloatingIPClient) All(ctx context.Context) ([]*FloatingIP, error)
- func (c *FloatingIPClient) AllWithOpts(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, error)
- func (c *FloatingIPClient) Assign(ctx context.Context, floatingIP *FloatingIP, server *Server) (*Action, *Response, error)
- func (c *FloatingIPClient) ChangeDNSPtr(ctx context.Context, floatingIP *FloatingIP, ip string, ptr *string) (*Action, *Response, error)
- func (c *FloatingIPClient) ChangeProtection(ctx context.Context, floatingIP *FloatingIP, ...) (*Action, *Response, error)
- func (c *FloatingIPClient) Create(ctx context.Context, opts FloatingIPCreateOpts) (FloatingIPCreateResult, *Response, error)
- func (c *FloatingIPClient) Delete(ctx context.Context, floatingIP *FloatingIP) (*Response, error)
- func (c *FloatingIPClient) Get(ctx context.Context, idOrName string) (*FloatingIP, *Response, error)
- func (c *FloatingIPClient) GetByID(ctx context.Context, id int) (*FloatingIP, *Response, error)
- func (c *FloatingIPClient) GetByName(ctx context.Context, name string) (*FloatingIP, *Response, error)
- func (c *FloatingIPClient) List(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, *Response, error)
- func (c *FloatingIPClient) Unassign(ctx context.Context, floatingIP *FloatingIP) (*Action, *Response, error)
- func (c *FloatingIPClient) Update(ctx context.Context, floatingIP *FloatingIP, opts FloatingIPUpdateOpts) (*FloatingIP, *Response, error)
- type FloatingIPCreateOpts
- type FloatingIPCreateResult
- type FloatingIPListOpts
- type FloatingIPPricing
- type FloatingIPProtection
- type FloatingIPType
- type FloatingIPUpdateOpts
- type ISO
- type ISOClient
- func (c *ISOClient) All(ctx context.Context) ([]*ISO, error)
- func (c *ISOClient) Get(ctx context.Context, idOrName string) (*ISO, *Response, error)
- func (c *ISOClient) GetByID(ctx context.Context, id int) (*ISO, *Response, error)
- func (c *ISOClient) GetByName(ctx context.Context, name string) (*ISO, *Response, error)
- func (c *ISOClient) List(ctx context.Context, opts ISOListOpts) ([]*ISO, *Response, error)
- type ISOListOpts
- type ISOType
- type Image
- type ImageChangeProtectionOpts
- type ImageClient
- func (c *ImageClient) All(ctx context.Context) ([]*Image, error)
- func (c *ImageClient) AllWithOpts(ctx context.Context, opts ImageListOpts) ([]*Image, error)
- func (c *ImageClient) ChangeProtection(ctx context.Context, image *Image, opts ImageChangeProtectionOpts) (*Action, *Response, error)
- func (c *ImageClient) Delete(ctx context.Context, image *Image) (*Response, error)
- func (c *ImageClient) Get(ctx context.Context, idOrName string) (*Image, *Response, error)
- func (c *ImageClient) GetByID(ctx context.Context, id int) (*Image, *Response, error)
- func (c *ImageClient) GetByName(ctx context.Context, name string) (*Image, *Response, error)
- func (c *ImageClient) List(ctx context.Context, opts ImageListOpts) ([]*Image, *Response, error)
- func (c *ImageClient) Update(ctx context.Context, image *Image, opts ImageUpdateOpts) (*Image, *Response, error)
- type ImageListOpts
- type ImagePricing
- type ImageProtection
- type ImageStatus
- type ImageType
- type ImageUpdateOpts
- type ListOpts
- type LoadBalancer
- type LoadBalancerAddServerTargetOpts
- type LoadBalancerAddServiceOpts
- type LoadBalancerAddServiceOptsHTTP
- type LoadBalancerAddServiceOptsHealthCheck
- type LoadBalancerAddServiceOptsHealthCheckHTTP
- type LoadBalancerAlgorithm
- type LoadBalancerAlgorithmType
- type LoadBalancerAttachToNetworkOpts
- type LoadBalancerChangeAlgorithmOpts
- type LoadBalancerChangeProtectionOpts
- type LoadBalancerClient
- func (c *LoadBalancerClient) AddServerTarget(ctx context.Context, loadBalancer *LoadBalancer, ...) (*Action, *Response, error)
- func (c *LoadBalancerClient) AddService(ctx context.Context, loadBalancer *LoadBalancer, ...) (*Action, *Response, error)
- func (c *LoadBalancerClient) All(ctx context.Context) ([]*LoadBalancer, error)
- func (c *LoadBalancerClient) AllWithOpts(ctx context.Context, opts LoadBalancerListOpts) ([]*LoadBalancer, error)
- func (c *LoadBalancerClient) AttachToNetwork(ctx context.Context, loadBalancer *LoadBalancer, ...) (*Action, *Response, error)
- func (c *LoadBalancerClient) ChangeAlgorithm(ctx context.Context, loadBalancer *LoadBalancer, ...) (*Action, *Response, error)
- func (c *LoadBalancerClient) ChangeProtection(ctx context.Context, loadBalancer *LoadBalancer, ...) (*Action, *Response, error)
- func (c *LoadBalancerClient) Create(ctx context.Context, opts LoadBalancerCreateOpts) (LoadBalancerCreateResult, *Response, error)
- func (c *LoadBalancerClient) Delete(ctx context.Context, loadBalancer *LoadBalancer) (*Response, error)
- func (c *LoadBalancerClient) DeleteService(ctx context.Context, loadBalancer *LoadBalancer, listenPort int) (*Action, *Response, error)
- func (c *LoadBalancerClient) DetachFromNetwork(ctx context.Context, loadBalancer *LoadBalancer, ...) (*Action, *Response, error)
- func (c *LoadBalancerClient) DisablePublicInterface(ctx context.Context, loadBalancer *LoadBalancer) (*Action, *Response, error)
- func (c *LoadBalancerClient) EnablePublicInterface(ctx context.Context, loadBalancer *LoadBalancer) (*Action, *Response, error)
- func (c *LoadBalancerClient) Get(ctx context.Context, idOrName string) (*LoadBalancer, *Response, error)
- func (c *LoadBalancerClient) GetByID(ctx context.Context, id int) (*LoadBalancer, *Response, error)
- func (c *LoadBalancerClient) GetByName(ctx context.Context, name string) (*LoadBalancer, *Response, error)
- func (c *LoadBalancerClient) List(ctx context.Context, opts LoadBalancerListOpts) ([]*LoadBalancer, *Response, error)
- func (c *LoadBalancerClient) RemoveServerTarget(ctx context.Context, loadBalancer *LoadBalancer, server *Server) (*Action, *Response, error)
- func (c *LoadBalancerClient) Update(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerUpdateOpts) (*LoadBalancer, *Response, error)
- func (c *LoadBalancerClient) UpdateService(ctx context.Context, loadBalancer *LoadBalancer, listenPort int, ...) (*Action, *Response, error)
- type LoadBalancerCreateOpts
- type LoadBalancerCreateOptsService
- type LoadBalancerCreateOptsServiceHTTP
- type LoadBalancerCreateOptsServiceHealthCheck
- type LoadBalancerCreateOptsServiceHealthCheckHTTP
- type LoadBalancerCreateOptsTarget
- type LoadBalancerCreateOptsTargetServer
- type LoadBalancerCreateResult
- type LoadBalancerDetachFromNetworkOpts
- type LoadBalancerListOpts
- type LoadBalancerPrivateNet
- type LoadBalancerProtection
- type LoadBalancerPublicNet
- type LoadBalancerPublicNetIPv4
- type LoadBalancerPublicNetIPv6
- type LoadBalancerService
- type LoadBalancerServiceHTTP
- type LoadBalancerServiceHealthCheck
- type LoadBalancerServiceHealthCheckHTTP
- type LoadBalancerServiceProtocol
- type LoadBalancerTarget
- type LoadBalancerTargetHealthStatus
- type LoadBalancerTargetHealthStatusStatus
- type LoadBalancerTargetServer
- type LoadBalancerTargetType
- type LoadBalancerType
- type LoadBalancerTypeClient
- func (c *LoadBalancerTypeClient) All(ctx context.Context) ([]*LoadBalancerType, error)
- func (c *LoadBalancerTypeClient) Get(ctx context.Context, idOrName string) (*LoadBalancerType, *Response, error)
- func (c *LoadBalancerTypeClient) GetByID(ctx context.Context, id int) (*LoadBalancerType, *Response, error)
- func (c *LoadBalancerTypeClient) GetByName(ctx context.Context, name string) (*LoadBalancerType, *Response, error)
- func (c *LoadBalancerTypeClient) List(ctx context.Context, opts LoadBalancerTypeListOpts) ([]*LoadBalancerType, *Response, error)
- type LoadBalancerTypeListOpts
- type LoadBalancerTypeLocationPricing
- type LoadBalancerTypePricing
- type LoadBalancerUpdateOpts
- type LoadBalancerUpdateServiceOpts
- type LoadBalancerUpdateServiceOptsHTTP
- type LoadBalancerUpdateServiceOptsHealthCheck
- type LoadBalancerUpdateServiceOptsHealthCheckHTTP
- type Location
- type LocationClient
- func (c *LocationClient) All(ctx context.Context) ([]*Location, error)
- func (c *LocationClient) Get(ctx context.Context, idOrName string) (*Location, *Response, error)
- func (c *LocationClient) GetByID(ctx context.Context, id int) (*Location, *Response, error)
- func (c *LocationClient) GetByName(ctx context.Context, name string) (*Location, *Response, error)
- func (c *LocationClient) List(ctx context.Context, opts LocationListOpts) ([]*Location, *Response, error)
- type LocationListOpts
- type Meta
- type Network
- type NetworkAddRouteOpts
- type NetworkAddSubnetOpts
- type NetworkChangeIPRangeOpts
- type NetworkChangeProtectionOpts
- type NetworkClient
- func (c *NetworkClient) AddRoute(ctx context.Context, network *Network, opts NetworkAddRouteOpts) (*Action, *Response, error)
- func (c *NetworkClient) AddSubnet(ctx context.Context, network *Network, opts NetworkAddSubnetOpts) (*Action, *Response, error)
- func (c *NetworkClient) All(ctx context.Context) ([]*Network, error)
- func (c *NetworkClient) AllWithOpts(ctx context.Context, opts NetworkListOpts) ([]*Network, error)
- func (c *NetworkClient) ChangeIPRange(ctx context.Context, network *Network, opts NetworkChangeIPRangeOpts) (*Action, *Response, error)
- func (c *NetworkClient) ChangeProtection(ctx context.Context, network *Network, opts NetworkChangeProtectionOpts) (*Action, *Response, error)
- func (c *NetworkClient) Create(ctx context.Context, opts NetworkCreateOpts) (*Network, *Response, error)
- func (c *NetworkClient) Delete(ctx context.Context, network *Network) (*Response, error)
- func (c *NetworkClient) DeleteRoute(ctx context.Context, network *Network, opts NetworkDeleteRouteOpts) (*Action, *Response, error)
- func (c *NetworkClient) DeleteSubnet(ctx context.Context, network *Network, opts NetworkDeleteSubnetOpts) (*Action, *Response, error)
- func (c *NetworkClient) Get(ctx context.Context, idOrName string) (*Network, *Response, error)
- func (c *NetworkClient) GetByID(ctx context.Context, id int) (*Network, *Response, error)
- func (c *NetworkClient) GetByName(ctx context.Context, name string) (*Network, *Response, error)
- func (c *NetworkClient) List(ctx context.Context, opts NetworkListOpts) ([]*Network, *Response, error)
- func (c *NetworkClient) Update(ctx context.Context, network *Network, opts NetworkUpdateOpts) (*Network, *Response, error)
- type NetworkCreateOpts
- type NetworkDeleteRouteOpts
- type NetworkDeleteSubnetOpts
- type NetworkListOpts
- type NetworkProtection
- type NetworkRoute
- type NetworkSubnet
- type NetworkSubnetType
- type NetworkUpdateOpts
- type NetworkZone
- type Pagination
- type Price
- type Pricing
- type PricingClient
- type Ratelimit
- type Response
- type SSHKey
- type SSHKeyClient
- func (c *SSHKeyClient) All(ctx context.Context) ([]*SSHKey, error)
- func (c *SSHKeyClient) AllWithOpts(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey, error)
- func (c *SSHKeyClient) Create(ctx context.Context, opts SSHKeyCreateOpts) (*SSHKey, *Response, error)
- func (c *SSHKeyClient) Delete(ctx context.Context, sshKey *SSHKey) (*Response, error)
- func (c *SSHKeyClient) Get(ctx context.Context, idOrName string) (*SSHKey, *Response, error)
- func (c *SSHKeyClient) GetByFingerprint(ctx context.Context, fingerprint string) (*SSHKey, *Response, error)
- func (c *SSHKeyClient) GetByID(ctx context.Context, id int) (*SSHKey, *Response, error)
- func (c *SSHKeyClient) GetByName(ctx context.Context, name string) (*SSHKey, *Response, error)
- func (c *SSHKeyClient) List(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey, *Response, error)
- func (c *SSHKeyClient) Update(ctx context.Context, sshKey *SSHKey, opts SSHKeyUpdateOpts) (*SSHKey, *Response, error)
- type SSHKeyCreateOpts
- type SSHKeyListOpts
- type SSHKeyUpdateOpts
- type Server
- type ServerAttachToNetworkOpts
- type ServerBackupPricing
- type ServerChangeAliasIPsOpts
- type ServerChangeProtectionOpts
- type ServerChangeTypeOpts
- type ServerClient
- func (c *ServerClient) All(ctx context.Context) ([]*Server, error)
- func (c *ServerClient) AllWithOpts(ctx context.Context, opts ServerListOpts) ([]*Server, error)
- func (c *ServerClient) AttachISO(ctx context.Context, server *Server, iso *ISO) (*Action, *Response, error)
- func (c *ServerClient) AttachToNetwork(ctx context.Context, server *Server, opts ServerAttachToNetworkOpts) (*Action, *Response, error)
- func (c *ServerClient) ChangeAliasIPs(ctx context.Context, server *Server, opts ServerChangeAliasIPsOpts) (*Action, *Response, error)
- func (c *ServerClient) ChangeDNSPtr(ctx context.Context, server *Server, ip string, ptr *string) (*Action, *Response, error)
- func (c *ServerClient) ChangeProtection(ctx context.Context, server *Server, opts ServerChangeProtectionOpts) (*Action, *Response, error)
- func (c *ServerClient) ChangeType(ctx context.Context, server *Server, opts ServerChangeTypeOpts) (*Action, *Response, error)
- func (c *ServerClient) Create(ctx context.Context, opts ServerCreateOpts) (ServerCreateResult, *Response, error)
- func (c *ServerClient) CreateImage(ctx context.Context, server *Server, opts *ServerCreateImageOpts) (ServerCreateImageResult, *Response, error)
- func (c *ServerClient) Delete(ctx context.Context, server *Server) (*Response, error)
- func (c *ServerClient) DetachFromNetwork(ctx context.Context, server *Server, opts ServerDetachFromNetworkOpts) (*Action, *Response, error)
- func (c *ServerClient) DetachISO(ctx context.Context, server *Server) (*Action, *Response, error)
- func (c *ServerClient) DisableBackup(ctx context.Context, server *Server) (*Action, *Response, error)
- func (c *ServerClient) DisableRescue(ctx context.Context, server *Server) (*Action, *Response, error)
- func (c *ServerClient) EnableBackup(ctx context.Context, server *Server, window string) (*Action, *Response, error)
- func (c *ServerClient) EnableRescue(ctx context.Context, server *Server, opts ServerEnableRescueOpts) (ServerEnableRescueResult, *Response, error)
- func (c *ServerClient) Get(ctx context.Context, idOrName string) (*Server, *Response, error)
- func (c *ServerClient) GetByID(ctx context.Context, id int) (*Server, *Response, error)
- func (c *ServerClient) GetByName(ctx context.Context, name string) (*Server, *Response, error)
- func (c *ServerClient) List(ctx context.Context, opts ServerListOpts) ([]*Server, *Response, error)
- func (c *ServerClient) Poweroff(ctx context.Context, server *Server) (*Action, *Response, error)
- func (c *ServerClient) Poweron(ctx context.Context, server *Server) (*Action, *Response, error)
- func (c *ServerClient) Reboot(ctx context.Context, server *Server) (*Action, *Response, error)
- func (c *ServerClient) Rebuild(ctx context.Context, server *Server, opts ServerRebuildOpts) (*Action, *Response, error)
- func (c *ServerClient) RequestConsole(ctx context.Context, server *Server) (ServerRequestConsoleResult, *Response, error)
- func (c *ServerClient) Reset(ctx context.Context, server *Server) (*Action, *Response, error)
- func (c *ServerClient) ResetPassword(ctx context.Context, server *Server) (ServerResetPasswordResult, *Response, error)
- func (c *ServerClient) Shutdown(ctx context.Context, server *Server) (*Action, *Response, error)
- func (c *ServerClient) Update(ctx context.Context, server *Server, opts ServerUpdateOpts) (*Server, *Response, error)
- type ServerCreateImageOpts
- type ServerCreateImageResult
- type ServerCreateOpts
- type ServerCreateResult
- type ServerDetachFromNetworkOpts
- type ServerEnableRescueOpts
- type ServerEnableRescueResult
- type ServerListOpts
- type ServerPrivateNet
- type ServerProtection
- type ServerPublicNet
- type ServerPublicNetIPv4
- type ServerPublicNetIPv6
- type ServerRebuildOpts
- type ServerRequestConsoleResult
- type ServerRescueType
- type ServerResetPasswordResult
- type ServerStatus
- type ServerType
- type ServerTypeClient
- func (c *ServerTypeClient) All(ctx context.Context) ([]*ServerType, error)
- func (c *ServerTypeClient) Get(ctx context.Context, idOrName string) (*ServerType, *Response, error)
- func (c *ServerTypeClient) GetByID(ctx context.Context, id int) (*ServerType, *Response, error)
- func (c *ServerTypeClient) GetByName(ctx context.Context, name string) (*ServerType, *Response, error)
- func (c *ServerTypeClient) List(ctx context.Context, opts ServerTypeListOpts) ([]*ServerType, *Response, error)
- type ServerTypeListOpts
- type ServerTypeLocationPricing
- type ServerTypePricing
- type ServerUpdateOpts
- type StorageType
- type TrafficPricing
- type Volume
- type VolumeAttachOpts
- type VolumeChangeProtectionOpts
- type VolumeClient
- func (c *VolumeClient) All(ctx context.Context) ([]*Volume, error)
- func (c *VolumeClient) AllWithOpts(ctx context.Context, opts VolumeListOpts) ([]*Volume, error)
- func (c *VolumeClient) Attach(ctx context.Context, volume *Volume, server *Server) (*Action, *Response, error)
- func (c *VolumeClient) AttachWithOpts(ctx context.Context, volume *Volume, opts VolumeAttachOpts) (*Action, *Response, error)
- func (c *VolumeClient) ChangeProtection(ctx context.Context, volume *Volume, opts VolumeChangeProtectionOpts) (*Action, *Response, error)
- func (c *VolumeClient) Create(ctx context.Context, opts VolumeCreateOpts) (VolumeCreateResult, *Response, error)
- func (c *VolumeClient) Delete(ctx context.Context, volume *Volume) (*Response, error)
- func (c *VolumeClient) Detach(ctx context.Context, volume *Volume) (*Action, *Response, error)
- func (c *VolumeClient) Get(ctx context.Context, idOrName string) (*Volume, *Response, error)
- func (c *VolumeClient) GetByID(ctx context.Context, id int) (*Volume, *Response, error)
- func (c *VolumeClient) GetByName(ctx context.Context, name string) (*Volume, *Response, error)
- func (c *VolumeClient) List(ctx context.Context, opts VolumeListOpts) ([]*Volume, *Response, error)
- func (c *VolumeClient) Resize(ctx context.Context, volume *Volume, size int) (*Action, *Response, error)
- func (c *VolumeClient) Update(ctx context.Context, volume *Volume, opts VolumeUpdateOpts) (*Volume, *Response, error)
- type VolumeCreateOpts
- type VolumeCreateResult
- type VolumeListOpts
- type VolumeProtection
- type VolumeStatus
- type VolumeUpdateOpts
Examples ¶
Constants ¶
const Endpoint = "https://api.hetzner.cloud/v1"
Endpoint is the base URL of the API.
const UserAgent = "hcloud-go/" + Version
UserAgent is the value for the library part of the User-Agent header that is sent with each request.
const Version = "1.18.2"
Version is the library's version following Semantic Versioning.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct { ID int Status ActionStatus Command string Progress int Started time.Time Finished time.Time ErrorCode string ErrorMessage string Resources []*ActionResource }
Action represents an action in the Hetzner Cloud.
func ActionFromSchema ¶
ActionFromSchema converts a schema.Action to an Action.
func ActionsFromSchema ¶ added in v1.11.0
ActionsFromSchema converts a slice of schema.Action to a slice of Action.
type ActionClient ¶
type ActionClient struct {
// contains filtered or unexported fields
}
ActionClient is a client for the actions API.
func (*ActionClient) All ¶
func (c *ActionClient) All(ctx context.Context) ([]*Action, error)
All returns all actions.
func (*ActionClient) GetByID ¶
GetByID retrieves an action by its ID. If the action does not exist, nil is returned.
func (*ActionClient) List ¶
func (c *ActionClient) List(ctx context.Context, opts ActionListOpts) ([]*Action, *Response, error)
List returns a list of actions for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*ActionClient) WatchProgress ¶ added in v1.2.0
func (c *ActionClient) WatchProgress(ctx context.Context, action *Action) (<-chan int, <-chan error)
WatchProgress watches the action's progress until it completes with success or error.
type ActionError ¶ added in v1.2.0
ActionError is the error of an action.
func (ActionError) Error ¶ added in v1.2.0
func (e ActionError) Error() string
type ActionListOpts ¶
type ActionListOpts struct { ListOpts Status []ActionStatus Sort []string }
ActionListOpts specifies options for listing actions.
type ActionResource ¶
type ActionResource struct { ID int Type ActionResourceType }
ActionResource references other resources from an action.
type ActionResourceType ¶
type ActionResourceType string
ActionResourceType represents an action's resource reference type.
const ( ActionResourceTypeServer ActionResourceType = "server" ActionResourceTypeImage ActionResourceType = "image" ActionResourceTypeISO ActionResourceType = "iso" ActionResourceTypeFloatingIP ActionResourceType = "floating_ip" ActionResourceTypeVolume ActionResourceType = "volume" )
List of action resource reference types.
type ActionStatus ¶
type ActionStatus string
ActionStatus represents an action's status.
const ( ActionStatusRunning ActionStatus = "running" ActionStatusSuccess ActionStatus = "success" ActionStatusError ActionStatus = "error" )
List of action statuses.
type BackoffFunc ¶
A BackoffFunc returns the duration to wait before performing the next retry. The retries argument specifies how many retries have already been performed. When called for the first time, retries is 0.
func ConstantBackoff ¶
func ConstantBackoff(d time.Duration) BackoffFunc
ConstantBackoff returns a BackoffFunc which backs off for constant duration d.
func ExponentialBackoff ¶
func ExponentialBackoff(b float64, d time.Duration) BackoffFunc
ExponentialBackoff returns a BackoffFunc which implements an exponential backoff using the formula: b^retries * d
type Certificate ¶ added in v1.18.0
type Certificate struct { ID int Name string Labels map[string]string Certificate string Created time.Time NotValidBefore time.Time NotValidAfter time.Time DomainNames []string Fingerprint string }
Certificate represents an certificate in the Hetzner Cloud.
func CertificateFromSchema ¶ added in v1.18.0
func CertificateFromSchema(s schema.Certificate) *Certificate
CertificateFromSchema converts a schema.Certificate to a Certificate.
type CertificateClient ¶ added in v1.18.0
type CertificateClient struct {
// contains filtered or unexported fields
}
CertificateClient is a client for the Certificates API.
func (*CertificateClient) All ¶ added in v1.18.0
func (c *CertificateClient) All(ctx context.Context) ([]*Certificate, error)
All returns all Certificates.
func (*CertificateClient) AllWithOpts ¶ added in v1.18.0
func (c *CertificateClient) AllWithOpts(ctx context.Context, opts CertificateListOpts) ([]*Certificate, error)
AllWithOpts returns all Certificates for the given options.
func (*CertificateClient) Create ¶ added in v1.18.0
func (c *CertificateClient) Create(ctx context.Context, opts CertificateCreateOpts) (*Certificate, *Response, error)
Create creates a new certificate.
func (*CertificateClient) Delete ¶ added in v1.18.0
func (c *CertificateClient) Delete(ctx context.Context, certificate *Certificate) (*Response, error)
Delete deletes a certificate.
func (*CertificateClient) Get ¶ added in v1.18.0
func (c *CertificateClient) Get(ctx context.Context, idOrName string) (*Certificate, *Response, error)
Get retrieves a Certificate by its ID if the input can be parsed as an integer, otherwise it retrieves a Certificate by its name. If the Certificate does not exist, nil is returned.
func (*CertificateClient) GetByID ¶ added in v1.18.0
func (c *CertificateClient) GetByID(ctx context.Context, id int) (*Certificate, *Response, error)
GetByID retrieves a Certificate by its ID. If the Certificate does not exist, nil is returned.
func (*CertificateClient) GetByName ¶ added in v1.18.0
func (c *CertificateClient) GetByName(ctx context.Context, name string) (*Certificate, *Response, error)
GetByName retrieves a Certificate by its name. If the Certificate does not exist, nil is returned.
func (*CertificateClient) List ¶ added in v1.18.0
func (c *CertificateClient) List(ctx context.Context, opts CertificateListOpts) ([]*Certificate, *Response, error)
List returns a list of Certificates for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*CertificateClient) Update ¶ added in v1.18.0
func (c *CertificateClient) Update(ctx context.Context, certificate *Certificate, opts CertificateUpdateOpts) (*Certificate, *Response, error)
Update updates a Certificate.
type CertificateCreateOpts ¶ added in v1.18.0
type CertificateCreateOpts struct { Name string Certificate string PrivateKey string Labels map[string]string }
CertificateCreateOpts specifies options for creating a new Certificate.
func (CertificateCreateOpts) Validate ¶ added in v1.18.0
func (o CertificateCreateOpts) Validate() error
Validate checks if options are valid.
type CertificateListOpts ¶ added in v1.18.0
CertificateListOpts specifies options for listing Certificates.
type CertificateUpdateOpts ¶ added in v1.18.0
CertificateUpdateOpts specifies options for updating a Certificate.
type Client ¶
type Client struct { Action ActionClient Certificate CertificateClient Datacenter DatacenterClient FloatingIP FloatingIPClient Image ImageClient ISO ISOClient LoadBalancer LoadBalancerClient LoadBalancerType LoadBalancerTypeClient Location LocationClient Network NetworkClient Pricing PricingClient Server ServerClient ServerType ServerTypeClient SSHKey SSHKeyClient Volume VolumeClient // contains filtered or unexported fields }
Client is a client for the Hetzner Cloud API.
type ClientOption ¶
type ClientOption func(*Client)
A ClientOption is used to configure a Client.
func WithApplication ¶ added in v1.10.0
func WithApplication(name, version string) ClientOption
WithApplication configures a Client with the given application name and application version. The version may be blank. Programs are encouraged to at least set an application name.
func WithBackoffFunc ¶
func WithBackoffFunc(f BackoffFunc) ClientOption
WithBackoffFunc configures a Client to use the specified backoff function.
func WithDebugWriter ¶ added in v1.15.0
func WithDebugWriter(debugWriter io.Writer) ClientOption
WithDebugWriter configures a Client to print debug information to the given writer. To, for example, print debug information on stderr, set it to os.Stderr.
func WithEndpoint ¶
func WithEndpoint(endpoint string) ClientOption
WithEndpoint configures a Client to use the specified API endpoint.
func WithHTTPClient ¶ added in v1.18.0
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient configures a Client to perform HTTP requests with httpClient.
func WithPollInterval ¶ added in v1.8.0
func WithPollInterval(pollInterval time.Duration) ClientOption
WithPollInterval configures a Client to use the specified interval when polling from the API.
func WithToken ¶
func WithToken(token string) ClientOption
WithToken configures a Client to use the specified token for authentication.
type Datacenter ¶
type Datacenter struct { ID int Name string Description string Location *Location ServerTypes DatacenterServerTypes }
Datacenter represents a datacenter in the Hetzner Cloud.
func DatacenterFromSchema ¶
func DatacenterFromSchema(s schema.Datacenter) *Datacenter
DatacenterFromSchema converts a schema.Datacenter to a Datacenter.
type DatacenterClient ¶
type DatacenterClient struct {
// contains filtered or unexported fields
}
DatacenterClient is a client for the datacenter API.
func (*DatacenterClient) All ¶
func (c *DatacenterClient) All(ctx context.Context) ([]*Datacenter, error)
All returns all datacenters.
func (*DatacenterClient) Get ¶
func (c *DatacenterClient) Get(ctx context.Context, idOrName string) (*Datacenter, *Response, error)
Get retrieves a datacenter by its ID if the input can be parsed as an integer, otherwise it retrieves a datacenter by its name. If the datacenter does not exist, nil is returned.
func (*DatacenterClient) GetByID ¶
func (c *DatacenterClient) GetByID(ctx context.Context, id int) (*Datacenter, *Response, error)
GetByID retrieves a datacenter by its ID. If the datacenter does not exist, nil is returned.
func (*DatacenterClient) GetByName ¶
func (c *DatacenterClient) GetByName(ctx context.Context, name string) (*Datacenter, *Response, error)
GetByName retrieves an datacenter by its name. If the datacenter does not exist, nil is returned.
func (*DatacenterClient) List ¶
func (c *DatacenterClient) List(ctx context.Context, opts DatacenterListOpts) ([]*Datacenter, *Response, error)
List returns a list of datacenters for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
type DatacenterListOpts ¶
DatacenterListOpts specifies options for listing datacenters.
type DatacenterServerTypes ¶
type DatacenterServerTypes struct { Supported []*ServerType Available []*ServerType }
DatacenterServerTypes represents the server types available and supported in a datacenter.
type Error ¶
Error is an error returned from the API.
func ErrorFromSchema ¶
ErrorFromSchema converts a schema.Error to an Error.
type ErrorCode ¶
type ErrorCode string
ErrorCode represents an error code returned from the API.
const ( ErrorCodeServiceError ErrorCode = "service_error" // Generic service error ErrorCodeRateLimitExceeded ErrorCode = "rate_limit_exceeded" // Rate limit exceeded ErrorCodeUnknownError ErrorCode = "unknown_error" // Unknown error ErrorCodeNotFound ErrorCode = "not_found" // Resource not found ErrorCodeInvalidInput ErrorCode = "invalid_input" // Validation error ErrorCodeForbidden ErrorCode = "forbidden" // Insufficient permissions ErrorCodeJSONError ErrorCode = "json_error" // Invalid JSON in request ErrorCodeLocked ErrorCode = "locked" // Item is locked (Another action is running) ErrorCodeResourceLimitExceeded ErrorCode = "resource_limit_exceeded" // Resource limit exceeded ErrorCodeUniquenessError ErrorCode = "uniqueness_error" // One or more fields must be unique ErrorCodeProtected ErrorCode = "protected" // The actions you are trying is protected ErrorCodeMaintenance ErrorCode = "maintenance" // Cannot perform operation due to maintenance ErrorCodeConflict ErrorCode = "conflict" // The resource has changed during the request, please retry ErrorCodeServerAlreadyAttached ErrorCode = "server_already_attached" // The server is already attached to the resource // The actual value of this error code is limit_reached. The new error code // rate_limit_exceeded for ratelimiting was introduced before Hetzner Cloud // launched into the public. To make clients using the old error code still // work as expected, we set the value of the old error code to that of the // new error code. ErrorCodeLimitReached = ErrorCodeRateLimitExceeded )
Error codes returned from the API.
type ErrorDetailsInvalidInput ¶
type ErrorDetailsInvalidInput struct {
Fields []ErrorDetailsInvalidInputField
}
ErrorDetailsInvalidInput contains the details of an 'invalid_input' error.
type ErrorDetailsInvalidInputField ¶
ErrorDetailsInvalidInputField contains the validation errors reported on a field.
type FloatingIP ¶
type FloatingIP struct { ID int Description string Created time.Time IP net.IP Network *net.IPNet Type FloatingIPType Server *Server DNSPtr map[string]string HomeLocation *Location Blocked bool Protection FloatingIPProtection Labels map[string]string Name string }
FloatingIP represents a Floating IP in the Hetzner Cloud.
func FloatingIPFromSchema ¶
func FloatingIPFromSchema(s schema.FloatingIP) *FloatingIP
FloatingIPFromSchema converts a schema.FloatingIP to a FloatingIP.
func (*FloatingIP) DNSPtrForIP ¶
func (f *FloatingIP) DNSPtrForIP(ip net.IP) string
DNSPtrForIP returns the reverse DNS pointer of the IP address.
type FloatingIPChangeProtectionOpts ¶ added in v1.6.0
type FloatingIPChangeProtectionOpts struct {
Delete *bool
}
FloatingIPChangeProtectionOpts specifies options for changing the resource protection level of a Floating IP.
type FloatingIPClient ¶
type FloatingIPClient struct {
// contains filtered or unexported fields
}
FloatingIPClient is a client for the Floating IP API.
func (*FloatingIPClient) All ¶
func (c *FloatingIPClient) All(ctx context.Context) ([]*FloatingIP, error)
All returns all Floating IPs.
func (*FloatingIPClient) AllWithOpts ¶ added in v1.9.0
func (c *FloatingIPClient) AllWithOpts(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, error)
AllWithOpts returns all Floating IPs for the given options.
func (*FloatingIPClient) Assign ¶
func (c *FloatingIPClient) Assign(ctx context.Context, floatingIP *FloatingIP, server *Server) (*Action, *Response, error)
Assign assigns a Floating IP to a server.
func (*FloatingIPClient) ChangeDNSPtr ¶
func (c *FloatingIPClient) ChangeDNSPtr(ctx context.Context, floatingIP *FloatingIP, ip string, ptr *string) (*Action, *Response, error)
ChangeDNSPtr changes or resets the reverse DNS pointer for a Floating IP address. Pass a nil ptr to reset the reverse DNS pointer to its default value.
func (*FloatingIPClient) ChangeProtection ¶ added in v1.6.0
func (c *FloatingIPClient) ChangeProtection(ctx context.Context, floatingIP *FloatingIP, opts FloatingIPChangeProtectionOpts) (*Action, *Response, error)
ChangeProtection changes the resource protection level of a Floating IP.
func (*FloatingIPClient) Create ¶
func (c *FloatingIPClient) Create(ctx context.Context, opts FloatingIPCreateOpts) (FloatingIPCreateResult, *Response, error)
Create creates a Floating IP.
func (*FloatingIPClient) Delete ¶
func (c *FloatingIPClient) Delete(ctx context.Context, floatingIP *FloatingIP) (*Response, error)
Delete deletes a Floating IP.
func (*FloatingIPClient) Get ¶ added in v1.16.0
func (c *FloatingIPClient) Get(ctx context.Context, idOrName string) (*FloatingIP, *Response, error)
Get retrieves a Floating IP by its ID if the input can be parsed as an integer, otherwise it retrieves a Floating IP by its name. If the Floating IP does not exist, nil is returned.
func (*FloatingIPClient) GetByID ¶
func (c *FloatingIPClient) GetByID(ctx context.Context, id int) (*FloatingIP, *Response, error)
GetByID retrieves a Floating IP by its ID. If the Floating IP does not exist, nil is returned.
func (*FloatingIPClient) GetByName ¶ added in v1.16.0
func (c *FloatingIPClient) GetByName(ctx context.Context, name string) (*FloatingIP, *Response, error)
GetByName retrieves a Floating IP by its name. If the Floating IP does not exist, nil is returned.
func (*FloatingIPClient) List ¶
func (c *FloatingIPClient) List(ctx context.Context, opts FloatingIPListOpts) ([]*FloatingIP, *Response, error)
List returns a list of Floating IPs for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*FloatingIPClient) Unassign ¶
func (c *FloatingIPClient) Unassign(ctx context.Context, floatingIP *FloatingIP) (*Action, *Response, error)
Unassign unassigns a Floating IP from the currently assigned server.
func (*FloatingIPClient) Update ¶
func (c *FloatingIPClient) Update(ctx context.Context, floatingIP *FloatingIP, opts FloatingIPUpdateOpts) (*FloatingIP, *Response, error)
Update updates a Floating IP.
type FloatingIPCreateOpts ¶
type FloatingIPCreateOpts struct { Type FloatingIPType HomeLocation *Location Server *Server Description *string Name *string Labels map[string]string }
FloatingIPCreateOpts specifies options for creating a Floating IP.
func (FloatingIPCreateOpts) Validate ¶
func (o FloatingIPCreateOpts) Validate() error
Validate checks if options are valid.
type FloatingIPCreateResult ¶
type FloatingIPCreateResult struct { FloatingIP *FloatingIP Action *Action }
FloatingIPCreateResult is the result of creating a Floating IP.
type FloatingIPListOpts ¶
FloatingIPListOpts specifies options for listing Floating IPs.
type FloatingIPPricing ¶
type FloatingIPPricing struct {
Monthly Price
}
FloatingIPPricing provides pricing information for Floating IPs.
type FloatingIPProtection ¶ added in v1.6.0
type FloatingIPProtection struct {
Delete bool
}
FloatingIPProtection represents the protection level of a Floating IP.
type FloatingIPType ¶
type FloatingIPType string
FloatingIPType represents the type of a Floating IP.
const ( FloatingIPTypeIPv4 FloatingIPType = "ipv4" FloatingIPTypeIPv6 FloatingIPType = "ipv6" )
Floating IP types.
type FloatingIPUpdateOpts ¶
FloatingIPUpdateOpts specifies options for updating a Floating IP.
type ISO ¶
ISO represents an ISO image in the Hetzner Cloud.
func ISOFromSchema ¶
ISOFromSchema converts a schema.ISO to an ISO.
func (*ISO) IsDeprecated ¶ added in v1.7.0
IsDeprecated returns true if the ISO is deprecated
type ISOClient ¶
type ISOClient struct {
// contains filtered or unexported fields
}
ISOClient is a client for the ISO API.
func (*ISOClient) Get ¶
Get retrieves an ISO by its ID if the input can be parsed as an integer, otherwise it retrieves an ISO by its name.
type ISOListOpts ¶
ISOListOpts specifies options for listing isos.
type Image ¶
type Image struct { ID int Name string Type ImageType Status ImageStatus Description string ImageSize float32 DiskSize float32 Created time.Time CreatedFrom *Server BoundTo *Server RapidDeploy bool OSFlavor string OSVersion string Protection ImageProtection Deprecated time.Time // The zero value denotes the image is not deprecated. Labels map[string]string }
Image represents an Image in the Hetzner Cloud.
func ImageFromSchema ¶
ImageFromSchema converts a schema.Image to an Image.
func (*Image) IsDeprecated ¶ added in v1.7.0
IsDeprecated returns whether the image is deprecated.
type ImageChangeProtectionOpts ¶ added in v1.6.0
type ImageChangeProtectionOpts struct {
Delete *bool
}
ImageChangeProtectionOpts specifies options for changing the resource protection level of an image.
type ImageClient ¶
type ImageClient struct {
// contains filtered or unexported fields
}
ImageClient is a client for the image API.
func (*ImageClient) All ¶
func (c *ImageClient) All(ctx context.Context) ([]*Image, error)
All returns all images.
func (*ImageClient) AllWithOpts ¶ added in v1.9.0
func (c *ImageClient) AllWithOpts(ctx context.Context, opts ImageListOpts) ([]*Image, error)
AllWithOpts returns all images for the given options.
func (*ImageClient) ChangeProtection ¶ added in v1.6.0
func (c *ImageClient) ChangeProtection(ctx context.Context, image *Image, opts ImageChangeProtectionOpts) (*Action, *Response, error)
ChangeProtection changes the resource protection level of an image.
func (*ImageClient) Get ¶
Get retrieves an image by its ID if the input can be parsed as an integer, otherwise it retrieves an image by its name. If the image does not exist, nil is returned.
func (*ImageClient) GetByID ¶
GetByID retrieves an image by its ID. If the image does not exist, nil is returned.
func (*ImageClient) GetByName ¶
GetByName retrieves an image by its name. If the image does not exist, nil is returned.
func (*ImageClient) List ¶
func (c *ImageClient) List(ctx context.Context, opts ImageListOpts) ([]*Image, *Response, error)
List returns a list of images for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*ImageClient) Update ¶
func (c *ImageClient) Update(ctx context.Context, image *Image, opts ImageUpdateOpts) (*Image, *Response, error)
Update updates an image.
type ImageListOpts ¶
type ImageListOpts struct { ListOpts Type []ImageType BoundTo *Server Name string Sort []string Status []ImageStatus }
ImageListOpts specifies options for listing images.
type ImagePricing ¶
type ImagePricing struct {
PerGBMonth Price
}
ImagePricing provides pricing information for imaegs.
type ImageProtection ¶ added in v1.6.0
type ImageProtection struct {
Delete bool
}
ImageProtection represents the protection level of an image.
type ImageStatus ¶
type ImageStatus string
ImageStatus specifies the status of an image.
const ( // ImageStatusCreating is the status when an image is being created. ImageStatusCreating ImageStatus = "creating" // ImageStatusAvailable is the status when an image is available. ImageStatusAvailable ImageStatus = "available" )
type ImageUpdateOpts ¶
ImageUpdateOpts specifies options for updating an image.
type ListOpts ¶
type ListOpts struct { Page int // Page (starting at 1) PerPage int // Items per page (0 means default) LabelSelector string // Label selector for filtering by labels }
ListOpts specifies options for listing resources.
type LoadBalancer ¶ added in v1.18.0
type LoadBalancer struct { ID int Name string PublicNet LoadBalancerPublicNet PrivateNet []LoadBalancerPrivateNet Location *Location LoadBalancerType *LoadBalancerType Algorithm LoadBalancerAlgorithm Services []LoadBalancerService Targets []LoadBalancerTarget Protection LoadBalancerProtection Labels map[string]string Created time.Time }
LoadBalancer represents a Load Balancer in the Hetzner Cloud.
func LoadBalancerFromSchema ¶ added in v1.18.0
func LoadBalancerFromSchema(s schema.LoadBalancer) *LoadBalancer
LoadBalancerFromSchema converts a schema.LoadBalancer to a LoadBalancer.
type LoadBalancerAddServerTargetOpts ¶ added in v1.18.0
LoadBalancerAddServerTargetOpts specifies options for adding a server target to a Load Balancer.
type LoadBalancerAddServiceOpts ¶ added in v1.18.0
type LoadBalancerAddServiceOpts struct { Protocol LoadBalancerServiceProtocol ListenPort *int DestinationPort *int Proxyprotocol *bool HTTP *LoadBalancerAddServiceOptsHTTP HealthCheck *LoadBalancerAddServiceOptsHealthCheck }
LoadBalancerAddServiceOpts specifies options for adding a service to a Load Balancer.
type LoadBalancerAddServiceOptsHTTP ¶ added in v1.18.0
type LoadBalancerAddServiceOptsHTTP struct { CookieName *string CookieLifetime *time.Duration Certificates []*Certificate RedirectHTTP *bool StickySessions *bool }
LoadBalancerAddServiceOptsHTTP holds options for specifying an HTTP service when adding a service to a Load Balancer.
type LoadBalancerAddServiceOptsHealthCheck ¶ added in v1.18.0
type LoadBalancerAddServiceOptsHealthCheck struct { Protocol LoadBalancerServiceProtocol Port *int Interval *time.Duration Timeout *time.Duration Retries *int HTTP *LoadBalancerAddServiceOptsHealthCheckHTTP }
LoadBalancerAddServiceOptsHealthCheck holds options for specifying an health check when adding a service to a Load Balancer.
type LoadBalancerAddServiceOptsHealthCheckHTTP ¶ added in v1.18.0
type LoadBalancerAddServiceOptsHealthCheckHTTP struct { Domain *string Path *string Response *string StatusCodes []string TLS *bool }
LoadBalancerAddServiceOptsHealthCheckHTTP holds options for specifying an HTTP health check when adding a service to a Load Balancer.
type LoadBalancerAlgorithm ¶ added in v1.18.0
type LoadBalancerAlgorithm struct {
Type LoadBalancerAlgorithmType
}
LoadBalancerAlgorithm configures the algorithm a Load Balancer uses for distributing requests.
type LoadBalancerAlgorithmType ¶ added in v1.18.0
type LoadBalancerAlgorithmType string
LoadBalancerAlgorithmType specifies the algorithm type a Load Balancer uses for distributing requests.
const ( // LoadBalancerAlgorithmTypeRoundRobin is an algorithm which distributes // requests to targets in a round robin fashion. LoadBalancerAlgorithmTypeRoundRobin LoadBalancerAlgorithmType = "round_robin" // LoadBalancerAlgorithmTypeLeastConnections is an algorithm which distributes // requests to targets with the least number of connections. LoadBalancerAlgorithmTypeLeastConnections LoadBalancerAlgorithmType = "least_connections" )
type LoadBalancerAttachToNetworkOpts ¶ added in v1.18.0
LoadBalancerAttachToNetworkOpts specifies options for attaching a Load Balancer to a network.
type LoadBalancerChangeAlgorithmOpts ¶ added in v1.18.0
type LoadBalancerChangeAlgorithmOpts struct {
Type LoadBalancerAlgorithmType
}
LoadBalancerChangeAlgorithmOpts specifies options for changing the algorithm of a Load Balancer.
type LoadBalancerChangeProtectionOpts ¶ added in v1.18.0
type LoadBalancerChangeProtectionOpts struct {
Delete *bool
}
LoadBalancerChangeProtectionOpts specifies options for changing the resource protection level of a Load Balancer.
type LoadBalancerClient ¶ added in v1.18.0
type LoadBalancerClient struct {
// contains filtered or unexported fields
}
LoadBalancerClient is a client for the Load Balancers API.
func (*LoadBalancerClient) AddServerTarget ¶ added in v1.18.0
func (c *LoadBalancerClient) AddServerTarget(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerAddServerTargetOpts) (*Action, *Response, error)
AddServerTarget adds a server target to a Load Balancer.
func (*LoadBalancerClient) AddService ¶ added in v1.18.0
func (c *LoadBalancerClient) AddService(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerAddServiceOpts) (*Action, *Response, error)
AddService adds a service to a Load Balancer.
func (*LoadBalancerClient) All ¶ added in v1.18.0
func (c *LoadBalancerClient) All(ctx context.Context) ([]*LoadBalancer, error)
All returns all Load Balancers.
func (*LoadBalancerClient) AllWithOpts ¶ added in v1.18.0
func (c *LoadBalancerClient) AllWithOpts(ctx context.Context, opts LoadBalancerListOpts) ([]*LoadBalancer, error)
AllWithOpts returns all Load Balancers for the given options.
func (*LoadBalancerClient) AttachToNetwork ¶ added in v1.18.0
func (c *LoadBalancerClient) AttachToNetwork(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerAttachToNetworkOpts) (*Action, *Response, error)
AttachToNetwork attaches a Load Balancer to a network.
func (*LoadBalancerClient) ChangeAlgorithm ¶ added in v1.18.0
func (c *LoadBalancerClient) ChangeAlgorithm(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerChangeAlgorithmOpts) (*Action, *Response, error)
ChangeAlgorithm changes the algorithm of a Load Balancer.
func (*LoadBalancerClient) ChangeProtection ¶ added in v1.18.0
func (c *LoadBalancerClient) ChangeProtection(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerChangeProtectionOpts) (*Action, *Response, error)
ChangeProtection changes the resource protection level of a Load Balancer.
func (*LoadBalancerClient) Create ¶ added in v1.18.0
func (c *LoadBalancerClient) Create(ctx context.Context, opts LoadBalancerCreateOpts) (LoadBalancerCreateResult, *Response, error)
Create creates a new Load Balancer.
func (*LoadBalancerClient) Delete ¶ added in v1.18.0
func (c *LoadBalancerClient) Delete(ctx context.Context, loadBalancer *LoadBalancer) (*Response, error)
Delete deletes a Load Balancer.
func (*LoadBalancerClient) DeleteService ¶ added in v1.18.0
func (c *LoadBalancerClient) DeleteService(ctx context.Context, loadBalancer *LoadBalancer, listenPort int) (*Action, *Response, error)
DeleteService deletes a Load Balancer service.
func (*LoadBalancerClient) DetachFromNetwork ¶ added in v1.18.0
func (c *LoadBalancerClient) DetachFromNetwork(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerDetachFromNetworkOpts) (*Action, *Response, error)
DetachFromNetwork detaches a Load Balancer from a network.
func (*LoadBalancerClient) DisablePublicInterface ¶ added in v1.18.0
func (c *LoadBalancerClient) DisablePublicInterface(ctx context.Context, loadBalancer *LoadBalancer) (*Action, *Response, error)
DisablePublicInterface disables the Load Balancer's public network interface.
func (*LoadBalancerClient) EnablePublicInterface ¶ added in v1.18.0
func (c *LoadBalancerClient) EnablePublicInterface(ctx context.Context, loadBalancer *LoadBalancer) (*Action, *Response, error)
EnablePublicInterface enables the Load Balancer's public network interface.
func (*LoadBalancerClient) Get ¶ added in v1.18.0
func (c *LoadBalancerClient) Get(ctx context.Context, idOrName string) (*LoadBalancer, *Response, error)
Get retrieves a Load Balancer by its ID if the input can be parsed as an integer, otherwise it retrieves a Load Balancer by its name. If the Load Balancer does not exist, nil is returned.
func (*LoadBalancerClient) GetByID ¶ added in v1.18.0
func (c *LoadBalancerClient) GetByID(ctx context.Context, id int) (*LoadBalancer, *Response, error)
GetByID retrieves a Load Balancer by its ID. If the Load Balancer does not exist, nil is returned.
func (*LoadBalancerClient) GetByName ¶ added in v1.18.0
func (c *LoadBalancerClient) GetByName(ctx context.Context, name string) (*LoadBalancer, *Response, error)
GetByName retrieves a Load Balancer by its name. If the Load Balancer does not exist, nil is returned.
func (*LoadBalancerClient) List ¶ added in v1.18.0
func (c *LoadBalancerClient) List(ctx context.Context, opts LoadBalancerListOpts) ([]*LoadBalancer, *Response, error)
List returns a list of Load Balancers for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*LoadBalancerClient) RemoveServerTarget ¶ added in v1.18.0
func (c *LoadBalancerClient) RemoveServerTarget(ctx context.Context, loadBalancer *LoadBalancer, server *Server) (*Action, *Response, error)
RemoveServerTarget removes a server target from a Load Balancer.
func (*LoadBalancerClient) Update ¶ added in v1.18.0
func (c *LoadBalancerClient) Update(ctx context.Context, loadBalancer *LoadBalancer, opts LoadBalancerUpdateOpts) (*LoadBalancer, *Response, error)
Update updates a Load Balancer.
func (*LoadBalancerClient) UpdateService ¶ added in v1.18.0
func (c *LoadBalancerClient) UpdateService(ctx context.Context, loadBalancer *LoadBalancer, listenPort int, opts LoadBalancerUpdateServiceOpts) (*Action, *Response, error)
UpdateService updates a Load Balancer service.
type LoadBalancerCreateOpts ¶ added in v1.18.0
type LoadBalancerCreateOpts struct { Name string LoadBalancerType *LoadBalancerType Algorithm *LoadBalancerAlgorithm Location *Location NetworkZone NetworkZone Labels map[string]string Targets []LoadBalancerCreateOptsTarget Services []LoadBalancerCreateOptsService PublicInterface *bool Network *Network }
LoadBalancerCreateOpts specifies options for creating a new Load Balancer.
type LoadBalancerCreateOptsService ¶ added in v1.18.0
type LoadBalancerCreateOptsService struct { Protocol LoadBalancerServiceProtocol ListenPort *int DestinationPort *int Proxyprotocol *bool HTTP *LoadBalancerCreateOptsServiceHTTP HealthCheck *LoadBalancerCreateOptsServiceHealthCheck }
LoadBalancerCreateOptsService holds options for specifying a service when creating a new Load Balancer.
type LoadBalancerCreateOptsServiceHTTP ¶ added in v1.18.0
type LoadBalancerCreateOptsServiceHTTP struct { CookieName *string CookieLifetime *time.Duration Certificates []*Certificate RedirectHTTP *bool StickySessions *bool }
LoadBalancerCreateOptsServiceHTTP holds options for specifying an HTTP service when creating a new Load Balancer.
type LoadBalancerCreateOptsServiceHealthCheck ¶ added in v1.18.0
type LoadBalancerCreateOptsServiceHealthCheck struct { Protocol LoadBalancerServiceProtocol Port *int Interval *time.Duration Timeout *time.Duration Retries *int HTTP *LoadBalancerCreateOptsServiceHealthCheckHTTP }
LoadBalancerCreateOptsServiceHealthCheck holds options for specifying a service health check when creating a new Load Balancer.
type LoadBalancerCreateOptsServiceHealthCheckHTTP ¶ added in v1.18.0
type LoadBalancerCreateOptsServiceHealthCheckHTTP struct { Domain *string Path *string Response *string StatusCodes []string TLS *bool }
LoadBalancerCreateOptsServiceHealthCheckHTTP holds options for specifying a service HTTP health check when creating a new Load Balancer.
type LoadBalancerCreateOptsTarget ¶ added in v1.18.0
type LoadBalancerCreateOptsTarget struct { Type LoadBalancerTargetType Server LoadBalancerCreateOptsTargetServer UsePrivateIP *bool }
LoadBalancerCreateOptsTarget holds options for specifying a target when creating a new Load Balancer.
type LoadBalancerCreateOptsTargetServer ¶ added in v1.18.0
type LoadBalancerCreateOptsTargetServer struct {
Server *Server
}
LoadBalancerCreateOptsTargetServer holds options for specifying a server target when creating a new Load Balancer.
type LoadBalancerCreateResult ¶ added in v1.18.0
type LoadBalancerCreateResult struct { LoadBalancer *LoadBalancer Action *Action }
LoadBalancerCreateResult is the result of a create Load Balancer call.
type LoadBalancerDetachFromNetworkOpts ¶ added in v1.18.0
type LoadBalancerDetachFromNetworkOpts struct {
Network *Network
}
LoadBalancerDetachFromNetworkOpts specifies options for detaching a Load Balancer from a network.
type LoadBalancerListOpts ¶ added in v1.18.0
LoadBalancerListOpts specifies options for listing Load Balancers.
type LoadBalancerPrivateNet ¶ added in v1.18.0
LoadBalancerPrivateNet represents a Load Balancer's private network.
type LoadBalancerProtection ¶ added in v1.18.0
type LoadBalancerProtection struct {
Delete bool
}
LoadBalancerProtection represents the protection level of a Load Balancer.
type LoadBalancerPublicNet ¶ added in v1.18.0
type LoadBalancerPublicNet struct { Enabled bool IPv4 LoadBalancerPublicNetIPv4 IPv6 LoadBalancerPublicNetIPv6 }
LoadBalancerPublicNet represents a Load Balancer's public network.
type LoadBalancerPublicNetIPv4 ¶ added in v1.18.0
LoadBalancerPublicNetIPv4 represents a Load Balancer's public IPv4 address.
type LoadBalancerPublicNetIPv6 ¶ added in v1.18.0
LoadBalancerPublicNetIPv6 represents a Load Balancer's public IPv6 address.
type LoadBalancerService ¶ added in v1.18.0
type LoadBalancerService struct { Protocol LoadBalancerServiceProtocol ListenPort int DestinationPort int Proxyprotocol bool HTTP LoadBalancerServiceHTTP HealthCheck LoadBalancerServiceHealthCheck }
LoadBalancerService represents a Load Balancer service.
func LoadBalancerServiceFromSchema ¶ added in v1.18.0
func LoadBalancerServiceFromSchema(s schema.LoadBalancerService) LoadBalancerService
LoadBalancerServiceFromSchema converts a schema.LoadBalancerService to a LoadBalancerService.
type LoadBalancerServiceHTTP ¶ added in v1.18.0
type LoadBalancerServiceHTTP struct { CookieName string CookieLifetime time.Duration Certificates []*Certificate RedirectHTTP bool StickySessions bool }
LoadBalancerServiceHTTP stores configuration for a service using the HTTP protocol.
type LoadBalancerServiceHealthCheck ¶ added in v1.18.0
type LoadBalancerServiceHealthCheck struct { Protocol LoadBalancerServiceProtocol Port int Interval time.Duration Timeout time.Duration Retries int HTTP *LoadBalancerServiceHealthCheckHTTP }
LoadBalancerServiceHealthCheck stores configuration for a service health check.
func LoadBalancerServiceHealthCheckFromSchema ¶ added in v1.18.0
func LoadBalancerServiceHealthCheckFromSchema(s *schema.LoadBalancerServiceHealthCheck) LoadBalancerServiceHealthCheck
LoadBalancerServiceHealthCheckFromSchema converts a schema.LoadBalancerServiceHealthCheck to a LoadBalancerServiceHealthCheck.
type LoadBalancerServiceHealthCheckHTTP ¶ added in v1.18.0
type LoadBalancerServiceHealthCheckHTTP struct { Domain string Path string Response string StatusCodes []string TLS bool }
LoadBalancerServiceHealthCheckHTTP stores configuration for a service health check using the HTTP protocol.
type LoadBalancerServiceProtocol ¶ added in v1.18.0
type LoadBalancerServiceProtocol string
LoadBalancerServiceProtocol specifies the protocol of a Load Balancer service.
const ( // LoadBalancerServiceProtocolTCP specifies a TCP service. LoadBalancerServiceProtocolTCP LoadBalancerServiceProtocol = "tcp" // LoadBalancerServiceProtocolHTTP specifies an HTTP service. LoadBalancerServiceProtocolHTTP LoadBalancerServiceProtocol = "http" // LoadBalancerServiceProtocolHTTPS specifies an HTTPS service. LoadBalancerServiceProtocolHTTPS LoadBalancerServiceProtocol = "https" )
type LoadBalancerTarget ¶ added in v1.18.0
type LoadBalancerTarget struct { Type LoadBalancerTargetType Server *LoadBalancerTargetServer HealthStatus []LoadBalancerTargetHealthStatus Targets []LoadBalancerTarget UsePrivateIP bool }
LoadBalancerTarget represents a Load Balancer target.
func LoadBalancerTargetFromSchema ¶ added in v1.18.0
func LoadBalancerTargetFromSchema(s schema.LoadBalancerTarget) LoadBalancerTarget
LoadBalancerTargetFromSchema converts a schema.LoadBalancerTarget to a LoadBalancerTarget.
type LoadBalancerTargetHealthStatus ¶ added in v1.18.0
type LoadBalancerTargetHealthStatus struct { ListenPort int Status LoadBalancerTargetHealthStatusStatus }
LoadBalancerTargetHealthStatus describes a target's health for a specific service.
func LoadBalancerTargetHealthStatusFromSchema ¶ added in v1.18.0
func LoadBalancerTargetHealthStatusFromSchema(s schema.LoadBalancerTargetHealthStatus) LoadBalancerTargetHealthStatus
LoadBalancerTargetHealthStatusFromSchema converts a schema.LoadBalancerTarget to a LoadBalancerTarget.
type LoadBalancerTargetHealthStatusStatus ¶ added in v1.18.0
type LoadBalancerTargetHealthStatusStatus string
LoadBalancerTargetHealthStatusStatus describes a target's health status.
const ( // LoadBalancerTargetHealthStatusStatusUnknown denotes that the health status is unknown. LoadBalancerTargetHealthStatusStatusUnknown LoadBalancerTargetHealthStatusStatus = "unknown" // LoadBalancerTargetHealthStatusStatusHealthy denotes a healthy target. LoadBalancerTargetHealthStatusStatusHealthy LoadBalancerTargetHealthStatusStatus = "healthy" // LoadBalancerTargetHealthStatusStatusUnhealthy denotes an unhealthy target. LoadBalancerTargetHealthStatusStatusUnhealthy LoadBalancerTargetHealthStatusStatus = "unhealthy" )
type LoadBalancerTargetServer ¶ added in v1.18.0
type LoadBalancerTargetServer struct {
Server *Server
}
LoadBalancerTargetServer configures a Load Balancer target pointing to a specific server.
type LoadBalancerTargetType ¶ added in v1.18.0
type LoadBalancerTargetType string
LoadBalancerTargetType specifies the type of a Load Balancer target.
const ( // LoadBalancerTargetTypeServer is a target type which points to a specific server. LoadBalancerTargetTypeServer LoadBalancerTargetType = "server" )
type LoadBalancerType ¶ added in v1.18.0
type LoadBalancerType struct { ID int Name string Description string MaxConnections int MaxServices int MaxTargets int MaxAssignedCertificates int Pricings []LoadBalancerTypeLocationPricing }
LoadBalancerType represents a LoadBalancer type in the Hetzner Cloud.
func LoadBalancerTypeFromSchema ¶ added in v1.18.0
func LoadBalancerTypeFromSchema(s schema.LoadBalancerType) *LoadBalancerType
LoadBalancerTypeFromSchema converts a schema.LoadBalancerType to a LoadBalancerType.
type LoadBalancerTypeClient ¶ added in v1.18.0
type LoadBalancerTypeClient struct {
// contains filtered or unexported fields
}
LoadBalancerTypeClient is a client for the Load Balancer types API.
func (*LoadBalancerTypeClient) All ¶ added in v1.18.0
func (c *LoadBalancerTypeClient) All(ctx context.Context) ([]*LoadBalancerType, error)
All returns all Load Balancer types.
func (*LoadBalancerTypeClient) Get ¶ added in v1.18.0
func (c *LoadBalancerTypeClient) Get(ctx context.Context, idOrName string) (*LoadBalancerType, *Response, error)
Get retrieves a Load Balancer type by its ID if the input can be parsed as an integer, otherwise it retrieves a Load Balancer type by its name. If the Load Balancer type does not exist, nil is returned.
func (*LoadBalancerTypeClient) GetByID ¶ added in v1.18.0
func (c *LoadBalancerTypeClient) GetByID(ctx context.Context, id int) (*LoadBalancerType, *Response, error)
GetByID retrieves a Load Balancer type by its ID. If the Load Balancer type does not exist, nil is returned.
func (*LoadBalancerTypeClient) GetByName ¶ added in v1.18.0
func (c *LoadBalancerTypeClient) GetByName(ctx context.Context, name string) (*LoadBalancerType, *Response, error)
GetByName retrieves a Load Balancer type by its name. If the Load Balancer type does not exist, nil is returned.
func (*LoadBalancerTypeClient) List ¶ added in v1.18.0
func (c *LoadBalancerTypeClient) List(ctx context.Context, opts LoadBalancerTypeListOpts) ([]*LoadBalancerType, *Response, error)
List returns a list of Load Balancer types for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
type LoadBalancerTypeListOpts ¶ added in v1.18.0
LoadBalancerTypeListOpts specifies options for listing Load Balancer types.
type LoadBalancerTypeLocationPricing ¶ added in v1.18.0
LoadBalancerTypeLocationPricing provides pricing information for a Load Balancer type at a location.
type LoadBalancerTypePricing ¶ added in v1.18.0
type LoadBalancerTypePricing struct { LoadBalancerType *LoadBalancerType Pricings []LoadBalancerTypeLocationPricing }
LoadBalancerTypePricing provides pricing information for a Load Balancer type.
type LoadBalancerUpdateOpts ¶ added in v1.18.0
LoadBalancerUpdateOpts specifies options for updating a Load Balancer.
type LoadBalancerUpdateServiceOpts ¶ added in v1.18.0
type LoadBalancerUpdateServiceOpts struct { Protocol LoadBalancerServiceProtocol DestinationPort *int Proxyprotocol *bool HTTP *LoadBalancerUpdateServiceOptsHTTP HealthCheck *LoadBalancerUpdateServiceOptsHealthCheck }
LoadBalancerUpdateServiceOpts specifies options for updating a service.
type LoadBalancerUpdateServiceOptsHTTP ¶ added in v1.18.0
type LoadBalancerUpdateServiceOptsHTTP struct { CookieName *string CookieLifetime *time.Duration Certificates []*Certificate RedirectHTTP *bool StickySessions *bool }
LoadBalancerUpdateServiceOptsHTTP specifies options for updating an HTTP(S) service.
type LoadBalancerUpdateServiceOptsHealthCheck ¶ added in v1.18.0
type LoadBalancerUpdateServiceOptsHealthCheck struct { Protocol LoadBalancerServiceProtocol Port *int Interval *time.Duration Timeout *time.Duration Retries *int HTTP *LoadBalancerUpdateServiceOptsHealthCheckHTTP }
LoadBalancerUpdateServiceOptsHealthCheck specifies options for updating a service's health check.
type LoadBalancerUpdateServiceOptsHealthCheckHTTP ¶ added in v1.18.0
type LoadBalancerUpdateServiceOptsHealthCheckHTTP struct { Domain *string Path *string Response *string StatusCodes []string TLS *bool }
LoadBalancerUpdateServiceOptsHealthCheckHTTP specifies options for updating the HTTP-specific settings of a service's health check.
type Location ¶
type Location struct { ID int Name string Description string Country string City string Latitude float64 Longitude float64 NetworkZone NetworkZone }
Location represents a location in the Hetzner Cloud.
func LocationFromSchema ¶
LocationFromSchema converts a schema.Location to a Location.
type LocationClient ¶
type LocationClient struct {
// contains filtered or unexported fields
}
LocationClient is a client for the location API.
func (*LocationClient) All ¶
func (c *LocationClient) All(ctx context.Context) ([]*Location, error)
All returns all locations.
func (*LocationClient) Get ¶
Get retrieves a location by its ID if the input can be parsed as an integer, otherwise it retrieves a location by its name. If the location does not exist, nil is returned.
func (*LocationClient) GetByID ¶
GetByID retrieves a location by its ID. If the location does not exist, nil is returned.
func (*LocationClient) GetByName ¶
GetByName retrieves an location by its name. If the location does not exist, nil is returned.
func (*LocationClient) List ¶
func (c *LocationClient) List(ctx context.Context, opts LocationListOpts) ([]*Location, *Response, error)
List returns a list of locations for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
type LocationListOpts ¶
LocationListOpts specifies options for listing location.
type Meta ¶
type Meta struct { Pagination *Pagination Ratelimit Ratelimit }
Meta represents meta information included in an API response.
type Network ¶ added in v1.14.0
type Network struct { ID int Name string Created time.Time IPRange *net.IPNet Subnets []NetworkSubnet Routes []NetworkRoute Servers []*Server Protection NetworkProtection Labels map[string]string }
Network represents a network in the Hetzner Cloud.
func NetworkFromSchema ¶ added in v1.14.0
NetworkFromSchema converts a schema.Network to a Network.
type NetworkAddRouteOpts ¶ added in v1.14.0
type NetworkAddRouteOpts struct {
Route NetworkRoute
}
NetworkAddRouteOpts specifies options for adding a route to a network.
type NetworkAddSubnetOpts ¶ added in v1.14.0
type NetworkAddSubnetOpts struct {
Subnet NetworkSubnet
}
NetworkAddSubnetOpts specifies options for adding a subnet to a network.
type NetworkChangeIPRangeOpts ¶ added in v1.14.0
NetworkChangeIPRangeOpts specifies options for changing the IP range of a network.
type NetworkChangeProtectionOpts ¶ added in v1.14.0
type NetworkChangeProtectionOpts struct {
Delete *bool
}
NetworkChangeProtectionOpts specifies options for changing the resource protection level of a network.
type NetworkClient ¶ added in v1.14.0
type NetworkClient struct {
// contains filtered or unexported fields
}
NetworkClient is a client for the network API.
func (*NetworkClient) AddRoute ¶ added in v1.14.0
func (c *NetworkClient) AddRoute(ctx context.Context, network *Network, opts NetworkAddRouteOpts) (*Action, *Response, error)
AddRoute adds a route to a network.
func (*NetworkClient) AddSubnet ¶ added in v1.14.0
func (c *NetworkClient) AddSubnet(ctx context.Context, network *Network, opts NetworkAddSubnetOpts) (*Action, *Response, error)
AddSubnet adds a subnet to a network.
func (*NetworkClient) All ¶ added in v1.14.0
func (c *NetworkClient) All(ctx context.Context) ([]*Network, error)
All returns all networks.
func (*NetworkClient) AllWithOpts ¶ added in v1.14.0
func (c *NetworkClient) AllWithOpts(ctx context.Context, opts NetworkListOpts) ([]*Network, error)
AllWithOpts returns all networks for the given options.
func (*NetworkClient) ChangeIPRange ¶ added in v1.14.0
func (c *NetworkClient) ChangeIPRange(ctx context.Context, network *Network, opts NetworkChangeIPRangeOpts) (*Action, *Response, error)
ChangeIPRange changes the IP range of a network.
func (*NetworkClient) ChangeProtection ¶ added in v1.14.0
func (c *NetworkClient) ChangeProtection(ctx context.Context, network *Network, opts NetworkChangeProtectionOpts) (*Action, *Response, error)
ChangeProtection changes the resource protection level of a network.
func (*NetworkClient) Create ¶ added in v1.14.0
func (c *NetworkClient) Create(ctx context.Context, opts NetworkCreateOpts) (*Network, *Response, error)
Create creates a new network.
func (*NetworkClient) DeleteRoute ¶ added in v1.14.0
func (c *NetworkClient) DeleteRoute(ctx context.Context, network *Network, opts NetworkDeleteRouteOpts) (*Action, *Response, error)
DeleteRoute deletes a route from a network.
func (*NetworkClient) DeleteSubnet ¶ added in v1.14.0
func (c *NetworkClient) DeleteSubnet(ctx context.Context, network *Network, opts NetworkDeleteSubnetOpts) (*Action, *Response, error)
DeleteSubnet deletes a subnet from a network.
func (*NetworkClient) Get ¶ added in v1.14.0
Get retrieves a network by its ID if the input can be parsed as an integer, otherwise it retrieves a network by its name. If the network does not exist, nil is returned.
func (*NetworkClient) GetByID ¶ added in v1.14.0
GetByID retrieves a network by its ID. If the network does not exist, nil is returned.
func (*NetworkClient) GetByName ¶ added in v1.14.0
GetByName retrieves a network by its name. If the network does not exist, nil is returned.
func (*NetworkClient) List ¶ added in v1.14.0
func (c *NetworkClient) List(ctx context.Context, opts NetworkListOpts) ([]*Network, *Response, error)
List returns a list of networks for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*NetworkClient) Update ¶ added in v1.14.0
func (c *NetworkClient) Update(ctx context.Context, network *Network, opts NetworkUpdateOpts) (*Network, *Response, error)
Update updates a network.
type NetworkCreateOpts ¶ added in v1.14.0
type NetworkCreateOpts struct { Name string IPRange *net.IPNet Subnets []NetworkSubnet Routes []NetworkRoute Labels map[string]string }
NetworkCreateOpts specifies options for creating a new network.
func (NetworkCreateOpts) Validate ¶ added in v1.14.0
func (o NetworkCreateOpts) Validate() error
Validate checks if options are valid.
type NetworkDeleteRouteOpts ¶ added in v1.14.0
type NetworkDeleteRouteOpts struct {
Route NetworkRoute
}
NetworkDeleteRouteOpts specifies options for deleting a route from a network.
type NetworkDeleteSubnetOpts ¶ added in v1.14.0
type NetworkDeleteSubnetOpts struct {
Subnet NetworkSubnet
}
NetworkDeleteSubnetOpts specifies options for deleting a subnet from a network.
type NetworkListOpts ¶ added in v1.14.0
NetworkListOpts specifies options for listing networks.
type NetworkProtection ¶ added in v1.14.0
type NetworkProtection struct {
Delete bool
}
NetworkProtection represents the protection level of a network.
type NetworkRoute ¶ added in v1.14.0
NetworkRoute represents a route of a network.
func NetworkRouteFromSchema ¶ added in v1.14.0
func NetworkRouteFromSchema(s schema.NetworkRoute) NetworkRoute
NetworkRouteFromSchema converts a schema.NetworkRoute to a NetworkRoute.
type NetworkSubnet ¶ added in v1.14.0
type NetworkSubnet struct { Type NetworkSubnetType IPRange *net.IPNet NetworkZone NetworkZone Gateway net.IP }
NetworkSubnet represents a subnet of a network in the Hetzner Cloud.
func NetworkSubnetFromSchema ¶ added in v1.14.0
func NetworkSubnetFromSchema(s schema.NetworkSubnet) NetworkSubnet
NetworkSubnetFromSchema converts a schema.NetworkSubnet to a NetworkSubnet.
type NetworkSubnetType ¶ added in v1.14.0
type NetworkSubnetType string
NetworkSubnetType specifies a type of a subnet.
const ( NetworkSubnetTypeCloud NetworkSubnetType = "cloud" NetworkSubnetTypeServer NetworkSubnetType = "server" )
List of available network subnet types.
type NetworkUpdateOpts ¶ added in v1.14.0
NetworkUpdateOpts specifies options for updating a network.
type NetworkZone ¶ added in v1.14.0
type NetworkZone string
NetworkZone specifies a network zone.
const (
NetworkZoneEUCentral NetworkZone = "eu-central"
)
List of available Network Zones.
type Pagination ¶
type Pagination struct { Page int PerPage int PreviousPage int NextPage int LastPage int TotalEntries int }
Pagination represents pagination meta information.
func PaginationFromSchema ¶
func PaginationFromSchema(s schema.MetaPagination) Pagination
PaginationFromSchema converts a schema.MetaPagination to a Pagination.
type Price ¶
Price represents a price. Net amount, gross amount, as well as VAT rate are specified as strings and it is the user's responsibility to convert them to appropriate types for calculations.
type Pricing ¶
type Pricing struct { Image ImagePricing FloatingIP FloatingIPPricing Traffic TrafficPricing ServerBackup ServerBackupPricing ServerTypes []ServerTypePricing LoadBalancerTypes []LoadBalancerTypePricing }
Pricing specifies pricing information for various resources.
func PricingFromSchema ¶
PricingFromSchema converts a schema.Pricing to a Pricing.
type PricingClient ¶
type PricingClient struct {
// contains filtered or unexported fields
}
PricingClient is a client for the pricing API.
type SSHKey ¶
type SSHKey struct { ID int Name string Fingerprint string PublicKey string Labels map[string]string Created time.Time }
SSHKey represents a SSH key in the Hetzner Cloud.
func SSHKeyFromSchema ¶
SSHKeyFromSchema converts a schema.SSHKey to a SSHKey.
type SSHKeyClient ¶
type SSHKeyClient struct {
// contains filtered or unexported fields
}
SSHKeyClient is a client for the SSH keys API.
func (*SSHKeyClient) All ¶
func (c *SSHKeyClient) All(ctx context.Context) ([]*SSHKey, error)
All returns all SSH keys.
func (*SSHKeyClient) AllWithOpts ¶ added in v1.9.0
func (c *SSHKeyClient) AllWithOpts(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey, error)
AllWithOpts returns all SSH keys with the given options.
func (*SSHKeyClient) Create ¶
func (c *SSHKeyClient) Create(ctx context.Context, opts SSHKeyCreateOpts) (*SSHKey, *Response, error)
Create creates a new SSH key with the given options.
func (*SSHKeyClient) Get ¶
Get retrieves a SSH key by its ID if the input can be parsed as an integer, otherwise it retrieves a SSH key by its name. If the SSH key does not exist, nil is returned.
func (*SSHKeyClient) GetByFingerprint ¶ added in v1.5.0
func (c *SSHKeyClient) GetByFingerprint(ctx context.Context, fingerprint string) (*SSHKey, *Response, error)
GetByFingerprint retreives a SSH key by its fingerprint. If the SSH key does not exist, nil is returned.
func (*SSHKeyClient) GetByID ¶
GetByID retrieves a SSH key by its ID. If the SSH key does not exist, nil is returned.
func (*SSHKeyClient) GetByName ¶
GetByName retrieves a SSH key by its name. If the SSH key does not exist, nil is returned.
func (*SSHKeyClient) List ¶
func (c *SSHKeyClient) List(ctx context.Context, opts SSHKeyListOpts) ([]*SSHKey, *Response, error)
List returns a list of SSH keys for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*SSHKeyClient) Update ¶
func (c *SSHKeyClient) Update(ctx context.Context, sshKey *SSHKey, opts SSHKeyUpdateOpts) (*SSHKey, *Response, error)
Update updates a SSH key.
type SSHKeyCreateOpts ¶
SSHKeyCreateOpts specifies parameters for creating a SSH key.
func (SSHKeyCreateOpts) Validate ¶
func (o SSHKeyCreateOpts) Validate() error
Validate checks if options are valid.
type SSHKeyListOpts ¶
SSHKeyListOpts specifies options for listing SSH keys.
type SSHKeyUpdateOpts ¶
SSHKeyUpdateOpts specifies options for updating a SSH key.
type Server ¶
type Server struct { ID int Name string Status ServerStatus Created time.Time PublicNet ServerPublicNet PrivateNet []ServerPrivateNet ServerType *ServerType Datacenter *Datacenter IncludedTraffic uint64 OutgoingTraffic uint64 IngoingTraffic uint64 BackupWindow string RescueEnabled bool Locked bool ISO *ISO Image *Image Protection ServerProtection Labels map[string]string Volumes []*Volume }
Server represents a server in the Hetzner Cloud.
func ServerFromSchema ¶
ServerFromSchema converts a schema.Server to a Server.
type ServerAttachToNetworkOpts ¶ added in v1.14.0
ServerAttachToNetworkOpts specifies options for attaching a server to a network.
type ServerBackupPricing ¶
type ServerBackupPricing struct {
Percentage string
}
ServerBackupPricing provides pricing information for server backups.
type ServerChangeAliasIPsOpts ¶ added in v1.14.0
ServerChangeAliasIPsOpts specifies options for changing the alias ips of an already attached network.
type ServerChangeProtectionOpts ¶ added in v1.6.0
ServerChangeProtectionOpts specifies options for changing the resource protection level of a server.
type ServerChangeTypeOpts ¶
type ServerChangeTypeOpts struct { ServerType *ServerType // new server type UpgradeDisk bool // whether disk should be upgraded }
ServerChangeTypeOpts specifies options for changing a server's type.
type ServerClient ¶
type ServerClient struct {
// contains filtered or unexported fields
}
ServerClient is a client for the servers API.
func (*ServerClient) All ¶
func (c *ServerClient) All(ctx context.Context) ([]*Server, error)
All returns all servers.
func (*ServerClient) AllWithOpts ¶ added in v1.9.0
func (c *ServerClient) AllWithOpts(ctx context.Context, opts ServerListOpts) ([]*Server, error)
AllWithOpts returns all servers for the given options.
func (*ServerClient) AttachISO ¶
func (c *ServerClient) AttachISO(ctx context.Context, server *Server, iso *ISO) (*Action, *Response, error)
AttachISO attaches an ISO to a server.
func (*ServerClient) AttachToNetwork ¶ added in v1.14.0
func (c *ServerClient) AttachToNetwork(ctx context.Context, server *Server, opts ServerAttachToNetworkOpts) (*Action, *Response, error)
AttachToNetwork attaches a server to a network.
func (*ServerClient) ChangeAliasIPs ¶ added in v1.14.0
func (c *ServerClient) ChangeAliasIPs(ctx context.Context, server *Server, opts ServerChangeAliasIPsOpts) (*Action, *Response, error)
ChangeAliasIPs changes a server's alias IPs in a network.
func (*ServerClient) ChangeDNSPtr ¶
func (c *ServerClient) ChangeDNSPtr(ctx context.Context, server *Server, ip string, ptr *string) (*Action, *Response, error)
ChangeDNSPtr changes or resets the reverse DNS pointer for a server IP address. Pass a nil ptr to reset the reverse DNS pointer to its default value.
func (*ServerClient) ChangeProtection ¶ added in v1.6.0
func (c *ServerClient) ChangeProtection(ctx context.Context, server *Server, opts ServerChangeProtectionOpts) (*Action, *Response, error)
ChangeProtection changes the resource protection level of a server.
func (*ServerClient) ChangeType ¶
func (c *ServerClient) ChangeType(ctx context.Context, server *Server, opts ServerChangeTypeOpts) (*Action, *Response, error)
ChangeType changes a server's type.
func (*ServerClient) Create ¶
func (c *ServerClient) Create(ctx context.Context, opts ServerCreateOpts) (ServerCreateResult, *Response, error)
Create creates a new server.
func (*ServerClient) CreateImage ¶
func (c *ServerClient) CreateImage(ctx context.Context, server *Server, opts *ServerCreateImageOpts) (ServerCreateImageResult, *Response, error)
CreateImage creates an image from a server.
func (*ServerClient) DetachFromNetwork ¶ added in v1.14.0
func (c *ServerClient) DetachFromNetwork(ctx context.Context, server *Server, opts ServerDetachFromNetworkOpts) (*Action, *Response, error)
DetachFromNetwork detaches a server from a network.
func (*ServerClient) DisableBackup ¶
func (c *ServerClient) DisableBackup(ctx context.Context, server *Server) (*Action, *Response, error)
DisableBackup disables backup for a server.
func (*ServerClient) DisableRescue ¶
func (c *ServerClient) DisableRescue(ctx context.Context, server *Server) (*Action, *Response, error)
DisableRescue disables rescue mode for a server.
func (*ServerClient) EnableBackup ¶
func (c *ServerClient) EnableBackup(ctx context.Context, server *Server, window string) (*Action, *Response, error)
EnableBackup enables backup for a server. Pass in an empty backup window to let the API pick a window for you. See the API documentation at docs.hetzner.cloud for a list of valid backup windows.
func (*ServerClient) EnableRescue ¶
func (c *ServerClient) EnableRescue(ctx context.Context, server *Server, opts ServerEnableRescueOpts) (ServerEnableRescueResult, *Response, error)
EnableRescue enables rescue mode for a server.
func (*ServerClient) Get ¶
Get retrieves a server by its ID if the input can be parsed as an integer, otherwise it retrieves a server by its name. If the server does not exist, nil is returned.
func (*ServerClient) GetByID ¶
GetByID retrieves a server by its ID. If the server does not exist, nil is returned.
func (*ServerClient) GetByName ¶
GetByName retrieves a server by its name. If the server does not exist, nil is returned.
func (*ServerClient) List ¶
func (c *ServerClient) List(ctx context.Context, opts ServerListOpts) ([]*Server, *Response, error)
List returns a list of servers for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*ServerClient) Rebuild ¶
func (c *ServerClient) Rebuild(ctx context.Context, server *Server, opts ServerRebuildOpts) (*Action, *Response, error)
Rebuild rebuilds a server.
func (*ServerClient) RequestConsole ¶ added in v1.18.0
func (c *ServerClient) RequestConsole(ctx context.Context, server *Server) (ServerRequestConsoleResult, *Response, error)
RequestConsole requests a WebSocket VNC console.
func (*ServerClient) ResetPassword ¶
func (c *ServerClient) ResetPassword(ctx context.Context, server *Server) (ServerResetPasswordResult, *Response, error)
ResetPassword resets a server's password.
func (*ServerClient) Update ¶
func (c *ServerClient) Update(ctx context.Context, server *Server, opts ServerUpdateOpts) (*Server, *Response, error)
Update updates a server.
type ServerCreateImageOpts ¶
ServerCreateImageOpts specifies options for creating an image from a server.
func (ServerCreateImageOpts) Validate ¶
func (o ServerCreateImageOpts) Validate() error
Validate checks if options are valid.
type ServerCreateImageResult ¶
ServerCreateImageResult is the result of creating an image from a server.
type ServerCreateOpts ¶
type ServerCreateOpts struct { Name string ServerType *ServerType Image *Image SSHKeys []*SSHKey Location *Location Datacenter *Datacenter UserData string StartAfterCreate *bool Labels map[string]string Automount *bool Volumes []*Volume Networks []*Network }
ServerCreateOpts specifies options for creating a new server.
func (ServerCreateOpts) Validate ¶
func (o ServerCreateOpts) Validate() error
Validate checks if options are valid.
type ServerCreateResult ¶
type ServerCreateResult struct { Server *Server Action *Action RootPassword string NextActions []*Action }
ServerCreateResult is the result of a create server call.
type ServerDetachFromNetworkOpts ¶ added in v1.14.0
type ServerDetachFromNetworkOpts struct {
Network *Network
}
ServerDetachFromNetworkOpts specifies options for detaching a server from a network.
type ServerEnableRescueOpts ¶
type ServerEnableRescueOpts struct { Type ServerRescueType SSHKeys []*SSHKey }
ServerEnableRescueOpts specifies options for enabling rescue mode for a server.
type ServerEnableRescueResult ¶
ServerEnableRescueResult is the result of enabling rescue mode for a server.
type ServerListOpts ¶
type ServerListOpts struct { ListOpts Name string Status []ServerStatus }
ServerListOpts specifies options for listing servers.
type ServerPrivateNet ¶ added in v1.14.0
ServerPrivateNet defines the schema of a server's private network information.
func ServerPrivateNetFromSchema ¶ added in v1.14.0
func ServerPrivateNetFromSchema(s schema.ServerPrivateNet) ServerPrivateNet
ServerPrivateNetFromSchema converts a schema.ServerPrivateNet to a ServerPrivateNet.
type ServerProtection ¶ added in v1.6.0
type ServerProtection struct {
Delete, Rebuild bool
}
ServerProtection represents the protection level of a server.
type ServerPublicNet ¶
type ServerPublicNet struct { IPv4 ServerPublicNetIPv4 IPv6 ServerPublicNetIPv6 FloatingIPs []*FloatingIP }
ServerPublicNet represents a server's public network.
func ServerPublicNetFromSchema ¶
func ServerPublicNetFromSchema(s schema.ServerPublicNet) ServerPublicNet
ServerPublicNetFromSchema converts a schema.ServerPublicNet to a ServerPublicNet.
type ServerPublicNetIPv4 ¶
ServerPublicNetIPv4 represents a server's public IPv4 address.
func ServerPublicNetIPv4FromSchema ¶
func ServerPublicNetIPv4FromSchema(s schema.ServerPublicNetIPv4) ServerPublicNetIPv4
ServerPublicNetIPv4FromSchema converts a schema.ServerPublicNetIPv4 to a ServerPublicNetIPv4.
type ServerPublicNetIPv6 ¶
type ServerPublicNetIPv6 struct { IP net.IP Network *net.IPNet Blocked bool DNSPtr map[string]string }
ServerPublicNetIPv6 represents a server's public IPv6 network and address.
func ServerPublicNetIPv6FromSchema ¶
func ServerPublicNetIPv6FromSchema(s schema.ServerPublicNetIPv6) ServerPublicNetIPv6
ServerPublicNetIPv6FromSchema converts a schema.ServerPublicNetIPv6 to a ServerPublicNetIPv6.
func (*ServerPublicNetIPv6) DNSPtrForIP ¶
func (s *ServerPublicNetIPv6) DNSPtrForIP(ip net.IP) string
DNSPtrForIP returns the reverse dns pointer of the ip address.
type ServerRebuildOpts ¶
type ServerRebuildOpts struct {
Image *Image
}
ServerRebuildOpts specifies options for rebuilding a server.
type ServerRequestConsoleResult ¶ added in v1.18.0
ServerRequestConsoleResult is the result of requesting a WebSocket VNC console.
type ServerRescueType ¶
type ServerRescueType string
ServerRescueType represents rescue types.
const ( ServerRescueTypeLinux32 ServerRescueType = "linux32" ServerRescueTypeLinux64 ServerRescueType = "linux64" ServerRescueTypeFreeBSD64 ServerRescueType = "freebsd64" )
List of rescue types.
type ServerResetPasswordResult ¶
ServerResetPasswordResult is the result of resetting a server's password.
type ServerStatus ¶
type ServerStatus string
ServerStatus specifies a server's status.
const ( // ServerStatusInitializing is the status when a server is initializing. ServerStatusInitializing ServerStatus = "initializing" // ServerStatusOff is the status when a server is off. ServerStatusOff ServerStatus = "off" // ServerStatusRunning is the status when a server is running. ServerStatusRunning ServerStatus = "running" // ServerStatusStarting is the status when a server is being started. ServerStatusStarting ServerStatus = "starting" // ServerStatusStopping is the status when a server is being stopped. ServerStatusStopping ServerStatus = "stopping" // ServerStatusMigrating is the status when a server is being migrated. ServerStatusMigrating ServerStatus = "migrating" // ServerStatusRebuilding is the status when a server is being rebuilt. ServerStatusRebuilding ServerStatus = "rebuilding" // ServerStatusDeleting is the status when a server is being deleted. ServerStatusDeleting ServerStatus = "deleting" // ServerStatusUnknown is the status when a server's state is unknown. ServerStatusUnknown ServerStatus = "unknown" )
type ServerType ¶
type ServerType struct { ID int Name string Description string Cores int Memory float32 Disk int StorageType StorageType CPUType CPUType Pricings []ServerTypeLocationPricing }
ServerType represents a server type in the Hetzner Cloud.
func ServerTypeFromSchema ¶
func ServerTypeFromSchema(s schema.ServerType) *ServerType
ServerTypeFromSchema converts a schema.ServerType to a ServerType.
type ServerTypeClient ¶
type ServerTypeClient struct {
// contains filtered or unexported fields
}
ServerTypeClient is a client for the server types API.
func (*ServerTypeClient) All ¶
func (c *ServerTypeClient) All(ctx context.Context) ([]*ServerType, error)
All returns all server types.
func (*ServerTypeClient) Get ¶
func (c *ServerTypeClient) Get(ctx context.Context, idOrName string) (*ServerType, *Response, error)
Get retrieves a server type by its ID if the input can be parsed as an integer, otherwise it retrieves a server type by its name. If the server type does not exist, nil is returned.
func (*ServerTypeClient) GetByID ¶
func (c *ServerTypeClient) GetByID(ctx context.Context, id int) (*ServerType, *Response, error)
GetByID retrieves a server type by its ID. If the server type does not exist, nil is returned.
func (*ServerTypeClient) GetByName ¶
func (c *ServerTypeClient) GetByName(ctx context.Context, name string) (*ServerType, *Response, error)
GetByName retrieves a server type by its name. If the server type does not exist, nil is returned.
func (*ServerTypeClient) List ¶
func (c *ServerTypeClient) List(ctx context.Context, opts ServerTypeListOpts) ([]*ServerType, *Response, error)
List returns a list of server types for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
type ServerTypeListOpts ¶
ServerTypeListOpts specifies options for listing server types.
type ServerTypeLocationPricing ¶
ServerTypeLocationPricing provides pricing information for a server type at a location.
type ServerTypePricing ¶
type ServerTypePricing struct { ServerType *ServerType Pricings []ServerTypeLocationPricing }
ServerTypePricing provides pricing information for a server type.
type ServerUpdateOpts ¶
ServerUpdateOpts specifies options for updating a server.
type StorageType ¶
type StorageType string
StorageType specifies the type of storage.
const ( // StorageTypeLocal is the type for local storage. StorageTypeLocal StorageType = "local" // StorageTypeCeph is the type for remote storage. StorageTypeCeph StorageType = "ceph" )
type TrafficPricing ¶
type TrafficPricing struct {
PerTB Price
}
TrafficPricing provides pricing information for traffic.
type Volume ¶ added in v1.10.0
type Volume struct { ID int Name string Status VolumeStatus Server *Server Location *Location Size int Protection VolumeProtection Labels map[string]string LinuxDevice string Created time.Time }
Volume represents a volume in the Hetzner Cloud.
func VolumeFromSchema ¶ added in v1.10.0
VolumeFromSchema converts a schema.Volume to a Volume.
type VolumeAttachOpts ¶ added in v1.12.0
VolumeAttachOpts specifies options for attaching a volume.
type VolumeChangeProtectionOpts ¶ added in v1.10.0
type VolumeChangeProtectionOpts struct {
Delete *bool
}
VolumeChangeProtectionOpts specifies options for changing the resource protection level of a volume.
type VolumeClient ¶ added in v1.10.0
type VolumeClient struct {
// contains filtered or unexported fields
}
VolumeClient is a client for the volume API.
func (*VolumeClient) All ¶ added in v1.10.0
func (c *VolumeClient) All(ctx context.Context) ([]*Volume, error)
All returns all volumes.
func (*VolumeClient) AllWithOpts ¶ added in v1.10.0
func (c *VolumeClient) AllWithOpts(ctx context.Context, opts VolumeListOpts) ([]*Volume, error)
AllWithOpts returns all volumes with the given options.
func (*VolumeClient) Attach ¶ added in v1.10.0
func (c *VolumeClient) Attach(ctx context.Context, volume *Volume, server *Server) (*Action, *Response, error)
Attach attaches a volume to a server.
func (*VolumeClient) AttachWithOpts ¶ added in v1.12.0
func (c *VolumeClient) AttachWithOpts(ctx context.Context, volume *Volume, opts VolumeAttachOpts) (*Action, *Response, error)
AttachWithOpts attaches a volume to a server.
func (*VolumeClient) ChangeProtection ¶ added in v1.10.0
func (c *VolumeClient) ChangeProtection(ctx context.Context, volume *Volume, opts VolumeChangeProtectionOpts) (*Action, *Response, error)
ChangeProtection changes the resource protection level of a volume.
func (*VolumeClient) Create ¶ added in v1.10.0
func (c *VolumeClient) Create(ctx context.Context, opts VolumeCreateOpts) (VolumeCreateResult, *Response, error)
Create creates a new volume with the given options.
func (*VolumeClient) Get ¶ added in v1.10.0
Get retrieves a volume by its ID if the input can be parsed as an integer, otherwise it retrieves a volume by its name. If the volume does not exist, nil is returned.
func (*VolumeClient) GetByID ¶ added in v1.10.0
GetByID retrieves a volume by its ID. If the volume does not exist, nil is returned.
func (*VolumeClient) GetByName ¶ added in v1.10.0
GetByName retrieves a volume by its name. If the volume does not exist, nil is returned.
func (*VolumeClient) List ¶ added in v1.10.0
func (c *VolumeClient) List(ctx context.Context, opts VolumeListOpts) ([]*Volume, *Response, error)
List returns a list of volumes for a specific page.
Please note that filters specified in opts are not taken into account when their value corresponds to their zero value or when they are empty.
func (*VolumeClient) Resize ¶ added in v1.10.0
func (c *VolumeClient) Resize(ctx context.Context, volume *Volume, size int) (*Action, *Response, error)
Resize changes the size of a volume.
func (*VolumeClient) Update ¶ added in v1.10.0
func (c *VolumeClient) Update(ctx context.Context, volume *Volume, opts VolumeUpdateOpts) (*Volume, *Response, error)
Update updates a volume.
type VolumeCreateOpts ¶ added in v1.10.0
type VolumeCreateOpts struct { Name string Size int Server *Server Location *Location Labels map[string]string Automount *bool Format *string }
VolumeCreateOpts specifies parameters for creating a volume.
func (VolumeCreateOpts) Validate ¶ added in v1.10.0
func (o VolumeCreateOpts) Validate() error
Validate checks if options are valid.
type VolumeCreateResult ¶ added in v1.10.0
VolumeCreateResult is the result of creating a volume.
type VolumeListOpts ¶ added in v1.10.0
type VolumeListOpts struct { ListOpts Name string Status []VolumeStatus }
VolumeListOpts specifies options for listing volumes.
type VolumeProtection ¶ added in v1.10.0
type VolumeProtection struct {
Delete bool
}
VolumeProtection represents the protection level of a volume.
type VolumeStatus ¶ added in v1.13.0
type VolumeStatus string
VolumeStatus specifies a volume's status.
const ( // VolumeStatusCreating is the status when a volume is being created. VolumeStatusCreating VolumeStatus = "creating" // VolumeStatusAvailable is the status when a volume is available. VolumeStatusAvailable VolumeStatus = "available" )
type VolumeUpdateOpts ¶ added in v1.10.0
VolumeUpdateOpts specifies options for updating a volume.