hetzner-0.6.0.0: Hetzner Cloud and DNS library.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hetzner.Cloud

Description

Hetzner Cloud API client.

More information can be found on the official documentation.

Although not necessary, this module was designed with qualified imports in mind. For example:

import qualified Hetzner.Cloud as Hetzner

Pagination

Some requests use pagination. These take a page argument of type Maybe Int. You can use streamPages to get all pages through a conduit-based stream. For example, to get all servers as a stream:

streamPages $ getServers token :: ConduitT i Server m ()

Or to get all volumes as a stream:

streamPages $ getVolumes token :: ConduitT i Action m ()

If you are not interested in the streaming functionality, you can simply use streamToList to turn the stream into a list:

streamToList $ streamPages $ getServers token :: m [Server]

Exceptions

This library makes extensive use of exceptions. Exceptions from this module have type CloudException. All functions that perform requests to Hetzner Cloud can throw this type of exception.

Synopsis

Tokens

newtype Token Source #

A token used to authenticate requests. All requests made with a token will have as scope the project where the token was made.

You can obtain one through the Hetzner Cloud Console.

Constructors

Token ByteString 

Instances

Instances details
IsString Token Source # 
Instance details

Defined in Hetzner.Cloud

Methods

fromString :: String -> Token #

Show Token Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

Eq Token Source # 
Instance details

Defined in Hetzner.Cloud

Methods

(==) :: Token -> Token -> Bool #

(/=) :: Token -> Token -> Bool #

Ord Token Source # 
Instance details

Defined in Hetzner.Cloud

Methods

compare :: Token -> Token -> Ordering #

(<) :: Token -> Token -> Bool #

(<=) :: Token -> Token -> Bool #

(>) :: Token -> Token -> Bool #

(>=) :: Token -> Token -> Bool #

max :: Token -> Token -> Token #

min :: Token -> Token -> Token #

getTokenFromEnv :: IO (Maybe Token) Source #

Lookup Token from the environment variable HETZNER_API_TOKEN.

Server metadata

data Metadata Source #

Metadata that any server in the Hetzner cloud can discover about itself.

Constructors

Metadata 

Fields

Instances

Instances details
FromJSON Metadata Source # 
Instance details

Defined in Hetzner.Cloud

Show Metadata Source # 
Instance details

Defined in Hetzner.Cloud

getMetadata :: IO Metadata Source #

Obtain metadata from running server. It doesn't need a Token but must be run from a server in Hetzner Cloud.

Hetzner Cloud API

Sections are in the same order as in the official documentation.

Actions

data ActionStatus Source #

Status of an action.

Constructors

ActionRunning Int

Action is still running. The Int argument is the progress percentage.

ActionSuccess ZonedTime

Action finished successfully. The finishing time is provided.

ActionError ZonedTime Error

Action finished with an error. The finishing time is provided, together with the error message.

Instances

Instances details
Show ActionStatus Source # 
Instance details

Defined in Hetzner.Cloud

newtype ActionID Source #

Action identifier.

Constructors

ActionID Int 

Instances

Instances details
FromJSON ActionID Source # 
Instance details

Defined in Hetzner.Cloud

Show ActionID Source # 
Instance details

Defined in Hetzner.Cloud

Eq ActionID Source # 
Instance details

Defined in Hetzner.Cloud

Ord ActionID Source # 
Instance details

Defined in Hetzner.Cloud

data Action Source #

Action.

Constructors

Action 

Instances

Instances details
FromJSON Action Source # 
Instance details

Defined in Hetzner.Cloud

Show Action Source # 
Instance details

Defined in Hetzner.Cloud

getAction :: Token -> ActionID -> IO Action Source #

Get a single action.

waitForAction :: Token -> ActionID -> IO ZonedTime Source #

Wait until an action is complete and returns the finishing time. It throws a CloudException if the action fails.

Datacenters

data Datacenter Source #

A datacenter within a location.

Instances

Instances details
FromJSON Datacenter Source # 
Instance details

Defined in Hetzner.Cloud

Show Datacenter Source # 
Instance details

Defined in Hetzner.Cloud

data DatacentersWithRecommendation Source #

Datacenter list with a datacenter recommendation for new servers.

Constructors

DatacentersWithRecommendation 

Fields

getDatacenter :: Token -> DatacenterID -> IO Datacenter Source #

Get a single datacenter.

Firewalls

newtype FirewallID Source #

Firewall identifier.

Constructors

FirewallID Int 

data PortRange Source #

A port range. It can contain only one port if both ends are the same.

Constructors

PortRange Int Int 

Instances

Instances details
FromJSON PortRange Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON PortRange Source # 
Instance details

Defined in Hetzner.Cloud

Show PortRange Source # 
Instance details

Defined in Hetzner.Cloud

data FirewallRuleProtocol Source #

Protocol used in a FirewallRule.

Constructors

FirewallRuleTCP PortRange

TCP protocol on the given port range.

FirewallRuleUDP PortRange

UDP protocol on the given port range.

FirewallRuleICMP

ICMP protocol.

FirewallRuleESP

ESP protocol.

FirewallRuleGRE

GRE protocol.

Instances

Instances details
Show FirewallRuleProtocol Source # 
Instance details

Defined in Hetzner.Cloud

data FirewallRule Source #

A firewall rule.

Constructors

FirewallRule 

Fields

anyIPv4 :: IPv4Range Source #

IPv4 range containing every IP.

anyIPv6 :: IPv6Range Source #

IPv6 range containing every IP.

data Firewall Source #

A firewall that can be applied to other resources, via applyFirewall or directly on creation.

Constructors

Firewall 

Fields

Instances

Instances details
FromJSON Firewall Source # 
Instance details

Defined in Hetzner.Cloud

Show Firewall Source # 
Instance details

Defined in Hetzner.Cloud

data NewFirewall Source #

Information used to create a new firewall with createFirewall.

Constructors

NewFirewall 

Fields

defaultNewFirewall Source #

Arguments

:: Text

Firewall name.

-> NewFirewall 

Default firewall with two rules:

  • Allow SSH on default port 22 from any address.
  • Allow ICMP from any address.

data CreatedFirewall Source #

Result of creating a firewall with createFirewall.

Constructors

CreatedFirewall 

Fields

getFirewalls :: Token -> Maybe Int -> IO (WithMeta "firewalls" [Firewall]) Source #

Get all firewalls in a project.

getFirewall :: Token -> FirewallID -> IO Firewall Source #

Get a single firewall.

deleteFirewall :: Token -> FirewallID -> IO () Source #

Delete a firewall.

updateFirewall Source #

Arguments

:: Token 
-> FirewallID

Firewall to update.

-> Text

New name for the firewall.

-> [Label]

New labels for the firewall.

-> IO Firewall 

Update name and labels of a firewall.

Firewall actions

applyFirewall Source #

Arguments

:: Token 
-> FirewallID

Firewall to apply.

-> [ServerID]

Servers to apply the firewall to.

-> [LabelSelectorAll]

Label selectors to apply.

-> IO [Action] 

Apply a firewall to resources.

removeFirewall Source #

Arguments

:: Token 
-> FirewallID

Firewall to remove.

-> [ServerID]

Servers to remove the firewall from.

-> [LabelSelectorAll]

Label selectors to remove from the firewall.

-> IO [Action] 

Remove a firewall from the given resources. The firewall itself is not deleted. For that, use deleteFirewall.

Floating IPs

Images

data OSFlavor Source #

Flavor of operative system.

Instances

Instances details
FromJSON OSFlavor Source # 
Instance details

Defined in Hetzner.Cloud

Show OSFlavor Source # 
Instance details

Defined in Hetzner.Cloud

data ImageType Source #

Image type.

Constructors

SystemImage Text

System image with name.

AppImage 
Snapshot Double

Snapshot with size in GB.

Backup ServerID 
Temporary 

Instances

Instances details
Show ImageType Source # 
Instance details

Defined in Hetzner.Cloud

newtype ImageID Source #

Image identifier.

Constructors

ImageID Int 

Instances

Instances details
FromJSON ImageID Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON ImageID Source # 
Instance details

Defined in Hetzner.Cloud

Show ImageID Source # 
Instance details

Defined in Hetzner.Cloud

Eq ImageID Source # 
Instance details

Defined in Hetzner.Cloud

Methods

(==) :: ImageID -> ImageID -> Bool #

(/=) :: ImageID -> ImageID -> Bool #

Ord ImageID Source # 
Instance details

Defined in Hetzner.Cloud

data Image Source #

An image that can be mounted to a server.

Instances

Instances details
FromJSON Image Source # 
Instance details

Defined in Hetzner.Cloud

Show Image Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> Image -> ShowS #

show :: Image -> String #

showList :: [Image] -> ShowS #

getImages Source #

Arguments

:: Token 
-> Maybe Int

Page.

-> IO (WithMeta "images" [Image]) 

Get images.

A regularly updated list of images can be found here.

getImage :: Token -> ImageID -> IO Image Source #

Get a single image.

Load Balancers

Locations

data City Source #

Cities where Hetzner hosts their servers.

Instances

Instances details
FromJSON City Source # 
Instance details

Defined in Hetzner.Cloud

Show City Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> City -> ShowS #

show :: City -> String #

showList :: [City] -> ShowS #

Eq City Source # 
Instance details

Defined in Hetzner.Cloud

Methods

(==) :: City -> City -> Bool #

(/=) :: City -> City -> Bool #

newtype LocationID Source #

Location identifier.

Constructors

LocationID Int 

getLocations :: Token -> IO [Location] Source #

Get all locations.

getLocation :: Token -> LocationID -> IO Location Source #

Get a single location.

Primary IPs

data PrimaryIP Source #

Primary IP.

Constructors

PrimaryIP 

Fields

Instances

Instances details
FromJSON PrimaryIP Source # 
Instance details

Defined in Hetzner.Cloud

Show PrimaryIP Source # 
Instance details

Defined in Hetzner.Cloud

getPrimaryIPs Source #

Arguments

:: Token 
-> Maybe Int

Page.

-> IO (WithMeta "primary_ips" [PrimaryIP]) 

Get primary IPs.

getPrimaryIP :: Token -> PrimaryIPID -> IO PrimaryIP Source #

Get a single primary IP.

setReverseDNS Source #

Arguments

:: Token 
-> PrimaryIPID

Primary IP to set reverse DNS for.

-> PublicIPInfo Text (Either IPv4 IPv6)

Reverse DNS settings.

-> IO Action 

Set reverse DNS for a primary IP.

  • If the primary IP corresponds to an IPv4, the reverse DNS setting's IP must coincide with the primary IP's IPv4.
  • If the primary IP corresponds to an IPv6, the reverse DNS setting's IP must be within the primary IP's IPv6 range.

Networks

newtype NetworkID Source #

Network identifier.

Constructors

NetworkID Int 

Instances

Instances details
FromJSON NetworkID Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON NetworkID Source # 
Instance details

Defined in Hetzner.Cloud

Show NetworkID Source # 
Instance details

Defined in Hetzner.Cloud

Eq NetworkID Source # 
Instance details

Defined in Hetzner.Cloud

Ord NetworkID Source # 
Instance details

Defined in Hetzner.Cloud

data Route Source #

A route that sends all packets for a given destination to a given gateway.

Constructors

Route 

Instances

Instances details
FromJSON Route Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON Route Source # 
Instance details

Defined in Hetzner.Cloud

Show Route Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> Route -> ShowS #

show :: Route -> String #

showList :: [Route] -> ShowS #

data SubnetType Source #

Types of subnetworks.

Instances

Instances details
FromJSON SubnetType Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON SubnetType Source # 
Instance details

Defined in Hetzner.Cloud

Show SubnetType Source # 
Instance details

Defined in Hetzner.Cloud

Eq SubnetType Source # 
Instance details

Defined in Hetzner.Cloud

data Subnet Source #

Subnets divide the IP range of a parent Network.

Instances

Instances details
FromJSON Subnet Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON Subnet Source # 
Instance details

Defined in Hetzner.Cloud

Show Subnet Source # 
Instance details

Defined in Hetzner.Cloud

data Network Source #

A private network.

Instances

Instances details
FromJSON Network Source # 
Instance details

Defined in Hetzner.Cloud

Show Network Source # 
Instance details

Defined in Hetzner.Cloud

data NewNetwork Source #

Network creation configuration to be used with createNetwork.

Instances

Instances details
ToJSON NewNetwork Source # 
Instance details

Defined in Hetzner.Cloud

defaultNewNetwork Source #

Arguments

:: Text

Network name.

-> IPv4Range

IP range of the network.

-> NewNetwork 

Default network configuration for new networks.

getNetworks Source #

Arguments

:: Token 
-> Maybe Int

Page.

-> IO (WithMeta "networks" [Network]) 

Get networks.

getNetwork :: Token -> NetworkID -> IO Network Source #

Get a single network.

createNetwork :: Token -> NewNetwork -> IO Network Source #

Create a new network.

deleteNetwork :: Token -> NetworkID -> IO () Source #

Delete a network.

updateNetwork Source #

Arguments

:: Token 
-> NetworkID

Network to update.

-> Text

New name for the network.

-> [Label]

New labels for the network.

-> IO Network 

Update name and labels of a network.

Pricing

data Price Source #

A resource's price.

Constructors

Price 

Instances

Instances details
FromJSON Price Source # 
Instance details

Defined in Hetzner.Cloud

Show Price Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> Price -> ShowS #

show :: Price -> String #

showList :: [Price] -> ShowS #

Eq Price Source # 
Instance details

Defined in Hetzner.Cloud

Methods

(==) :: Price -> Price -> Bool #

(/=) :: Price -> Price -> Bool #

Ord Price Source #

The Ord instance can be used to compare prices. Only the gross price is used for comparisons.

Instance details

Defined in Hetzner.Cloud

Methods

compare :: Price -> Price -> Ordering #

(<) :: Price -> Price -> Bool #

(<=) :: Price -> Price -> Bool #

(>) :: Price -> Price -> Bool #

(>=) :: Price -> Price -> Bool #

max :: Price -> Price -> Price #

min :: Price -> Price -> Price #

data PriceInLocation Source #

The price of a resource in a location. Hourly pricing is unavailable for some resources.

Constructors

PriceInLocation 

Fields

Servers

data ServerStatus Source #

A server status.

Instances

Instances details
FromJSON ServerStatus Source # 
Instance details

Defined in Hetzner.Cloud

Show ServerStatus Source # 
Instance details

Defined in Hetzner.Cloud

Eq ServerStatus Source # 
Instance details

Defined in Hetzner.Cloud

newtype ServerID Source #

Server identifier.

Constructors

ServerID Int 

Instances

Instances details
FromJSON ServerID Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON ServerID Source # 
Instance details

Defined in Hetzner.Cloud

Show ServerID Source # 
Instance details

Defined in Hetzner.Cloud

data NewServer Source #

Server creation configuration to be used with createServer.

Constructors

NewServer 

Fields

Instances

Instances details
ToJSON NewServer Source # 
Instance details

Defined in Hetzner.Cloud

Show NewServer Source # 
Instance details

Defined in Hetzner.Cloud

defaultNewServer Source #

Arguments

:: Text

Server name.

-> NewServer 

Default server configuration that can be used as a starting point for a custom server configuration.

Note that by default no SSH key is installed, which means you'll need the password in the response in order to access the server (you will also receive an e-mail with the password).

data CreatedServer Source #

A server that was just created with createServer.

Constructors

CreatedServer 

Fields

Instances

Instances details
FromJSON CreatedServer Source # 
Instance details

Defined in Hetzner.Cloud

Show CreatedServer Source # 
Instance details

Defined in Hetzner.Cloud

getServers Source #

Arguments

:: Token 
-> Maybe Int

Page.

-> IO (WithMeta "servers" [Server]) 

Get servers.

getServer :: Token -> ServerID -> IO Server Source #

Get a single server.

createServer :: Token -> NewServer -> IO CreatedServer Source #

Create a new server.

deleteServer :: Token -> ServerID -> IO Action Source #

Delete a server.

Server actions

setServerReverseDNS :: Token -> ServerID -> PublicIPInfo Text (Either IPv4 IPv6) -> IO Action Source #

Set reverse DNS entry for a server.

powerOnServer :: Token -> ServerID -> IO Action Source #

Turn server on.

powerOffServer :: Token -> ServerID -> IO Action Source #

Turn server off. This is not a graceful shutdown.

shutdownServer :: Token -> ServerID -> IO Action Source #

Send ACPI shutdown request to a server. Use this instead of powerOffServer if you wish for a graceful shutdown. However, the returned action finishes when the shutdown request is sent, so waitForAction won't help you to tell whether the server is actually off.

rebootServer :: Token -> ServerID -> IO Action Source #

Send ACPI reboot request to a server.

changeServerType Source #

Arguments

:: Token 
-> ServerID 
-> ServerTypeID 
-> Bool

Should the disk also be upgraded? If not, it will stay the same size.

-> IO Action 

Change a server's type. The target type must have equal or larger disk. The server needs to be turned off before changing its type.

Server types

data Architecture Source #

Computer architecture.

Constructors

X86 
Arm 

Instances

Instances details
FromJSON Architecture Source # 
Instance details

Defined in Hetzner.Cloud

Show Architecture Source # 
Instance details

Defined in Hetzner.Cloud

Eq Architecture Source # 
Instance details

Defined in Hetzner.Cloud

data StorageType Source #

Type of server boot drive.

Instances

Instances details
FromJSON StorageType Source # 
Instance details

Defined in Hetzner.Cloud

Show StorageType Source # 
Instance details

Defined in Hetzner.Cloud

Eq StorageType Source # 
Instance details

Defined in Hetzner.Cloud

data CPUType Source #

CPU types available.

Constructors

SharedCPU 
DedicatedCPU 

Instances

Instances details
FromJSON CPUType Source # 
Instance details

Defined in Hetzner.Cloud

Show CPUType Source # 
Instance details

Defined in Hetzner.Cloud

Eq CPUType Source # 
Instance details

Defined in Hetzner.Cloud

Methods

(==) :: CPUType -> CPUType -> Bool #

(/=) :: CPUType -> CPUType -> Bool #

data ServerType Source #

Server characteristics.

Constructors

ServerType 

Fields

Instances

Instances details
FromJSON ServerType Source # 
Instance details

Defined in Hetzner.Cloud

Show ServerType Source # 
Instance details

Defined in Hetzner.Cloud

getServerTypes :: Token -> Maybe Int -> IO (WithMeta "server_types" [ServerType]) Source #

Get all server types.

A regularly updated list of server types can be browsed here.

SSH Keys

newtype SSHKeyID Source #

SSH key identifier.

Constructors

SSHKeyID Int 

Instances

Instances details
FromJSON SSHKeyID Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON SSHKeyID Source # 
Instance details

Defined in Hetzner.Cloud

Show SSHKeyID Source # 
Instance details

Defined in Hetzner.Cloud

Eq SSHKeyID Source # 
Instance details

Defined in Hetzner.Cloud

Ord SSHKeyID Source # 
Instance details

Defined in Hetzner.Cloud

data SSHKey Source #

SSH key information.

Instances

Instances details
FromJSON SSHKey Source # 
Instance details

Defined in Hetzner.Cloud

Show SSHKey Source # 
Instance details

Defined in Hetzner.Cloud

getSSHKeys :: Token -> IO [SSHKey] Source #

Get all uploaded SSH keys.

getSSHKey :: Token -> SSHKeyID -> IO SSHKey Source #

Get a single SSH key.

createSSHKey Source #

Arguments

:: Token 
-> Text

Name for the SSH key.

-> Text

Public key.

-> [Label]

List of labels to attach to the key.

-> IO SSHKey 

Upload an SSH key.

deleteSSHKey :: Token -> SSHKeyID -> IO () Source #

Delete an SSH key.

updateSSHKey Source #

Arguments

:: Token 
-> SSHKeyID 
-> Text

New name for the key.

-> [Label]

New labels for the key.

-> IO SSHKey

Updated SSH key.

Update name and labels of an SSH key.

Volumes

newtype VolumeID Source #

Volume identifier.

Constructors

VolumeID Int 

Instances

Instances details
FromJSON VolumeID Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON VolumeID Source # 
Instance details

Defined in Hetzner.Cloud

Show VolumeID Source # 
Instance details

Defined in Hetzner.Cloud

Eq VolumeID Source # 
Instance details

Defined in Hetzner.Cloud

Ord VolumeID Source # 
Instance details

Defined in Hetzner.Cloud

data VolumeFormat Source #

Volume format.

Constructors

EXT4 
XFS 

data VolumeStatus Source #

Volume status.

Instances

Instances details
FromJSON VolumeStatus Source # 
Instance details

Defined in Hetzner.Cloud

Show VolumeStatus Source # 
Instance details

Defined in Hetzner.Cloud

Eq VolumeStatus Source # 
Instance details

Defined in Hetzner.Cloud

data Volume Source #

A volume that can be attached to a server.

Constructors

Volume 

Fields

Instances

Instances details
FromJSON Volume Source # 
Instance details

Defined in Hetzner.Cloud

Show Volume Source # 
Instance details

Defined in Hetzner.Cloud

data AttachToServer Source #

Attach a volume to a server. The boolean parameter indicates whether the volume will be auto-mounted.

data NewVolume Source #

Volume creation configuration to be used with createVolume.

Constructors

NewVolume 

Fields

Instances

Instances details
ToJSON NewVolume Source # 
Instance details

Defined in Hetzner.Cloud

getVolumes :: Token -> Maybe Int -> IO (WithMeta "volumes" [Volume]) Source #

Get volumes.

getVolume :: Token -> VolumeID -> IO Volume Source #

Get a single volume.

createVolume :: Token -> NewVolume -> IO CreatedVolume Source #

Create a new volume.

deleteVolume :: Token -> VolumeID -> IO () Source #

Delete a volume.

updateVolume Source #

Arguments

:: Token 
-> VolumeID 
-> Text

New name for the volume.

-> [Label]

New labels for the volume.

-> IO Volume

Updated volume.

Update name and labels of a volume.

Exceptions

data Error Source #

An error returned by Hetzner.

Constructors

Error 

Fields

Instances

Instances details
FromJSON Error Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON Error Source # 
Instance details

Defined in Hetzner.Cloud

Show Error Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

data CloudException Source #

Exception produced while performing a request to Hetzner Cloud.

Labels

data LabelKey Source #

Label key.

Constructors

LabelKey 

Fields

data Label Source #

Labels are key-value pairs that can be attached to all resources.

Constructors

Label 

Instances

Instances details
Show Label Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> Label -> ShowS #

show :: Label -> String #

showList :: [Label] -> ShowS #

Eq Label Source # 
Instance details

Defined in Hetzner.Cloud

Methods

(==) :: Label -> Label -> Bool #

(/=) :: Label -> Label -> Bool #

type LabelMap = Map LabelKey Text Source #

A label map maps label keys to values.

toLabelMap :: [Label] -> LabelMap Source #

Build a label map from a list of labels.

fromLabelMap :: LabelMap -> [Label] Source #

Get a list of labels from a label map.

data LabelSelector Source #

Label selectors can be used to filter resources.

Constructors

LabelEqual Label

Select when label is equal.

LabelNotEqual Label

Select when label is not equal.

KeyPresent LabelKey

Select when key is present.

KeyNotPresent LabelKey

Select when key is not present.

KeyValueIn LabelKey [Text]

Select when label has one of the values.

KeyValueNotIn LabelKey [Text]

Select when label has none of the values.

Instances

Instances details
Show LabelSelector Source # 
Instance details

Defined in Hetzner.Cloud

newtype LabelSelectorAll Source #

Combine a list of label selectors, giving you a selector that selects labels that match all selectors in the list.

Other types

Regions

data Region Source #

Network zones.

Constructors

EUCentral

Nuremberg, Falkenstein, Helsinki.

USWest

Hillsboro (OR).

USEast

Ashburn (VA).

Instances

Instances details
FromJSON Region Source # 
Instance details

Defined in Hetzner.Cloud

ToJSON Region Source # 
Instance details

Defined in Hetzner.Cloud

Show Region Source # 
Instance details

Defined in Hetzner.Cloud

Eq Region Source # 
Instance details

Defined in Hetzner.Cloud

Methods

(==) :: Region -> Region -> Bool #

(/=) :: Region -> Region -> Bool #

Resources

data ResourceID Source #

A resource ID is an ID from one of the available resources.

Instances

Instances details
FromJSON ResourceID Source # 
Instance details

Defined in Hetzner.Cloud

Show ResourceID Source # 
Instance details

Defined in Hetzner.Cloud

Public networks

data FirewallStatus Source #

A firewall ID and whether the firewall is applied or not.

Instances

Instances details
FromJSON FirewallStatus Source # 
Instance details

Defined in Hetzner.Cloud

Show FirewallStatus Source # 
Instance details

Defined in Hetzner.Cloud

data PublicIPInfo dnsptr ip Source #

Public IP information.

Constructors

PublicIPInfo 

Fields

Instances

Instances details
Foldable (PublicIPInfo dnsptr) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

fold :: Monoid m => PublicIPInfo dnsptr m -> m #

foldMap :: Monoid m => (a -> m) -> PublicIPInfo dnsptr a -> m #

foldMap' :: Monoid m => (a -> m) -> PublicIPInfo dnsptr a -> m #

foldr :: (a -> b -> b) -> b -> PublicIPInfo dnsptr a -> b #

foldr' :: (a -> b -> b) -> b -> PublicIPInfo dnsptr a -> b #

foldl :: (b -> a -> b) -> b -> PublicIPInfo dnsptr a -> b #

foldl' :: (b -> a -> b) -> b -> PublicIPInfo dnsptr a -> b #

foldr1 :: (a -> a -> a) -> PublicIPInfo dnsptr a -> a #

foldl1 :: (a -> a -> a) -> PublicIPInfo dnsptr a -> a #

toList :: PublicIPInfo dnsptr a -> [a] #

null :: PublicIPInfo dnsptr a -> Bool #

length :: PublicIPInfo dnsptr a -> Int #

elem :: Eq a => a -> PublicIPInfo dnsptr a -> Bool #

maximum :: Ord a => PublicIPInfo dnsptr a -> a #

minimum :: Ord a => PublicIPInfo dnsptr a -> a #

sum :: Num a => PublicIPInfo dnsptr a -> a #

product :: Num a => PublicIPInfo dnsptr a -> a #

Traversable (PublicIPInfo dnsptr) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

traverse :: Applicative f => (a -> f b) -> PublicIPInfo dnsptr a -> f (PublicIPInfo dnsptr b) #

sequenceA :: Applicative f => PublicIPInfo dnsptr (f a) -> f (PublicIPInfo dnsptr a) #

mapM :: Monad m => (a -> m b) -> PublicIPInfo dnsptr a -> m (PublicIPInfo dnsptr b) #

sequence :: Monad m => PublicIPInfo dnsptr (m a) -> m (PublicIPInfo dnsptr a) #

Functor (PublicIPInfo dnsptr) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

fmap :: (a -> b) -> PublicIPInfo dnsptr a -> PublicIPInfo dnsptr b #

(<$) :: a -> PublicIPInfo dnsptr b -> PublicIPInfo dnsptr a #

(FromJSON dnsptr, FromJSON ip) => FromJSON (PublicIPInfo dnsptr ip) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

parseJSON :: Value -> Parser (PublicIPInfo dnsptr ip) #

parseJSONList :: Value -> Parser [PublicIPInfo dnsptr ip] #

(ToJSON dnsptr, ToJSON ip) => ToJSON (PublicIPInfo dnsptr ip) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

toJSON :: PublicIPInfo dnsptr ip -> Value #

toEncoding :: PublicIPInfo dnsptr ip -> Encoding #

toJSONList :: [PublicIPInfo dnsptr ip] -> Value #

toEncodingList :: [PublicIPInfo dnsptr ip] -> Encoding #

(Show dnsptr, Show ip) => Show (PublicIPInfo dnsptr ip) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> PublicIPInfo dnsptr ip -> ShowS #

show :: PublicIPInfo dnsptr ip -> String #

showList :: [PublicIPInfo dnsptr ip] -> ShowS #

Streaming

streamPages Source #

Arguments

:: forall key f a i m. (Foldable f, MonadIO m) 
=> (Maybe Int -> IO (WithMeta key (f a)))

Function that takes page number and returns result.

-> ConduitT i a m ()

Conduit-based stream that yields results downstream.

Stream results using a function that takes a page number, going through all the pages.

streamToList :: Monad m => ConduitT () a m () -> m [a] Source #

Convenient function to turn streams into lists.

Generic interface

Generic queries

cloudQuery Source #

Arguments

:: (ToJSON body, FromJSON a) 
=> ByteString

Method

-> ByteString

Path

-> Maybe body

Request body. You may use noBody to skip.

-> Token

Authorization token

-> Maybe Int

Page

-> IO a 

Generic Hetzner Cloud query.

This function is used to implement Hetzner Cloud queries.

If there is any issue while performing the request, a CloudException will be thrown.

The page argument determines which page will be requested. If not provided, it will request the first page. If a page is requested outside the valid range, an empty list will be returned, not a failure.

noBody :: Maybe Void Source #

Used to send requests without a body.

JSON Wrappers

data WithKey (key :: Symbol) a Source #

Wrap a value with the key of the value within a JSON object.

Constructors

WithKey 

Fields

Instances

Instances details
Foldable (WithKey key) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

fold :: Monoid m => WithKey key m -> m #

foldMap :: Monoid m => (a -> m) -> WithKey key a -> m #

foldMap' :: Monoid m => (a -> m) -> WithKey key a -> m #

foldr :: (a -> b -> b) -> b -> WithKey key a -> b #

foldr' :: (a -> b -> b) -> b -> WithKey key a -> b #

foldl :: (b -> a -> b) -> b -> WithKey key a -> b #

foldl' :: (b -> a -> b) -> b -> WithKey key a -> b #

foldr1 :: (a -> a -> a) -> WithKey key a -> a #

foldl1 :: (a -> a -> a) -> WithKey key a -> a #

toList :: WithKey key a -> [a] #

null :: WithKey key a -> Bool #

length :: WithKey key a -> Int #

elem :: Eq a => a -> WithKey key a -> Bool #

maximum :: Ord a => WithKey key a -> a #

minimum :: Ord a => WithKey key a -> a #

sum :: Num a => WithKey key a -> a #

product :: Num a => WithKey key a -> a #

Functor (WithKey key) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

fmap :: (a -> b) -> WithKey key a -> WithKey key b #

(<$) :: a -> WithKey key b -> WithKey key a #

(KnownSymbol key, FromJSON a) => FromJSON (WithKey key a) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

parseJSON :: Value -> Parser (WithKey key a) #

parseJSONList :: Value -> Parser [WithKey key a] #

Show a => Show (WithKey key a) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> WithKey key a -> ShowS #

show :: WithKey key a -> String #

showList :: [WithKey key a] -> ShowS #

data WithMeta (key :: Symbol) a Source #

A value together with response metadata. The type is annotated with the JSON key of the value.

Constructors

WithMeta 

Fields

Instances

Instances details
Foldable (WithMeta key) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

fold :: Monoid m => WithMeta key m -> m #

foldMap :: Monoid m => (a -> m) -> WithMeta key a -> m #

foldMap' :: Monoid m => (a -> m) -> WithMeta key a -> m #

foldr :: (a -> b -> b) -> b -> WithMeta key a -> b #

foldr' :: (a -> b -> b) -> b -> WithMeta key a -> b #

foldl :: (b -> a -> b) -> b -> WithMeta key a -> b #

foldl' :: (b -> a -> b) -> b -> WithMeta key a -> b #

foldr1 :: (a -> a -> a) -> WithMeta key a -> a #

foldl1 :: (a -> a -> a) -> WithMeta key a -> a #

toList :: WithMeta key a -> [a] #

null :: WithMeta key a -> Bool #

length :: WithMeta key a -> Int #

elem :: Eq a => a -> WithMeta key a -> Bool #

maximum :: Ord a => WithMeta key a -> a #

minimum :: Ord a => WithMeta key a -> a #

sum :: Num a => WithMeta key a -> a #

product :: Num a => WithMeta key a -> a #

Functor (WithMeta key) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

fmap :: (a -> b) -> WithMeta key a -> WithMeta key b #

(<$) :: a -> WithMeta key b -> WithMeta key a #

(KnownSymbol key, FromJSON a) => FromJSON (WithMeta key a) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

parseJSON :: Value -> Parser (WithMeta key a) #

parseJSONList :: Value -> Parser [WithMeta key a] #

Show a => Show (WithMeta key a) Source # 
Instance details

Defined in Hetzner.Cloud

Methods

showsPrec :: Int -> WithMeta key a -> ShowS #

show :: WithMeta key a -> String #

showList :: [WithMeta key a] -> ShowS #

Response metadata

data ResponseMeta Source #

Metadata attached to a response.

Constructors

ResponseMeta 

Instances

Instances details
FromJSON ResponseMeta Source # 
Instance details

Defined in Hetzner.Cloud

Show ResponseMeta Source # 
Instance details

Defined in Hetzner.Cloud

data Pagination Source #

Pagination information.

Instances

Instances details
FromJSON Pagination Source # 
Instance details

Defined in Hetzner.Cloud

Show Pagination Source # 
Instance details

Defined in Hetzner.Cloud