Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
. You can use Maybe
Int
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 actions as a stream:
streamPages $ getActions 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
- newtype Token = Token ByteString
- getTokenFromEnv :: IO (Maybe Token)
- data Metadata = Metadata {}
- getMetadata :: IO Metadata
- data ActionStatus
- data ActionCommand
- newtype ActionID = ActionID Int
- data Action = Action {}
- getActions :: Token -> Maybe Int -> IO (WithMeta "actions" [Action])
- getAction :: Token -> ActionID -> IO Action
- waitForAction :: Token -> ActionID -> IO ZonedTime
- newtype DatacenterID = DatacenterID Int
- data DatacenterServers = DatacenterServers {}
- data Datacenter = Datacenter {}
- data DatacentersWithRecommendation = DatacentersWithRecommendation {}
- getDatacenters :: Token -> IO DatacentersWithRecommendation
- getDatacenter :: Token -> DatacenterID -> IO Datacenter
- newtype FirewallID = FirewallID Int
- newtype FloatingIPID = FloatingIPID Int
- data OSFlavor
- data ImageType
- newtype ImageID = ImageID Int
- data Image = Image {}
- getImages :: Token -> Maybe Int -> IO (WithMeta "images" [Image])
- getImage :: Token -> ImageID -> IO Image
- newtype LoadBalancerID = LoadBalancerID Int
- data City
- newtype LocationID = LocationID Int
- data Location = Location {}
- getLocations :: Token -> IO [Location]
- getLocation :: Token -> LocationID -> IO Location
- newtype NetworkID = NetworkID Int
- data Route = Route {}
- data SubnetType
- data Subnet = Subnet {}
- data Network = Network {}
- data NewNetwork = NewNetwork {}
- defaultNewNetwork :: Text -> IPv4Range -> NewNetwork
- getNetworks :: Token -> Maybe Int -> IO (WithMeta "networks" [Network])
- getNetwork :: Token -> NetworkID -> IO Network
- createNetwork :: Token -> NewNetwork -> IO Network
- deleteNetwork :: Token -> NetworkID -> IO ()
- updateNetwork :: Token -> NetworkID -> Text -> [Label] -> IO Network
- data Price = Price {}
- data PriceInLocation = PriceInLocation {}
- data ServerStatus
- newtype ServerID = ServerID Int
- data Server = Server {}
- data NewServer = NewServer {
- newServerAutomount :: Bool
- newServerLocation :: Maybe (Either DatacenterID LocationID)
- newServerFirewalls :: [FirewallID]
- newServerImage :: ImageID
- newServerLabels :: [Label]
- newServerName :: Text
- newServerEnableIPv4 :: Bool
- newServerEnableIPv6 :: Bool
- newServerType :: ServerTypeID
- newServerSSHKeys :: [SSHKeyID]
- newServerStart :: Bool
- newServerVolumes :: [VolumeID]
- defaultNewServer :: Text -> NewServer
- data CreatedServer = CreatedServer {}
- getServers :: Token -> Maybe Int -> IO (WithMeta "servers" [Server])
- getServer :: Token -> ServerID -> IO Server
- createServer :: Token -> NewServer -> IO CreatedServer
- deleteServer :: Token -> ServerID -> IO Action
- data Architecture
- data StorageType
- data CPUType
- newtype ServerTypeID = ServerTypeID Int
- data ServerType = ServerType {}
- getServerTypes :: Token -> IO [ServerType]
- newtype SSHKeyID = SSHKeyID Int
- data SSHKey = SSHKey {}
- getSSHKeys :: Token -> IO [SSHKey]
- getSSHKey :: Token -> SSHKeyID -> IO SSHKey
- createSSHKey :: Token -> Text -> Text -> [Label] -> IO SSHKey
- deleteSSHKey :: Token -> SSHKeyID -> IO ()
- updateSSHKey :: Token -> SSHKeyID -> Text -> [Label] -> IO SSHKey
- newtype VolumeID = VolumeID Int
- data VolumeFormat
- data VolumeStatus
- data Volume = Volume {}
- data AttachToServer = AttachToServer ServerID Bool
- data NewVolume = NewVolume {}
- data CreatedVolume = CreatedVolume {}
- getVolumes :: Token -> Maybe Int -> IO (WithMeta "volumes" [Volume])
- getVolume :: Token -> VolumeID -> IO Volume
- createVolume :: Token -> NewVolume -> IO CreatedVolume
- deleteVolume :: Token -> VolumeID -> IO ()
- updateVolume :: Token -> VolumeID -> Text -> [Label] -> IO Volume
- data Error = Error {
- errorCode :: Text
- errorMessage :: Text
- data CloudException
- data LabelKey = LabelKey {}
- data Label = Label {
- labelKey :: LabelKey
- labelValue :: Text
- type LabelMap = Map LabelKey Text
- toLabelMap :: [Label] -> LabelMap
- fromLabelMap :: LabelMap -> [Label]
- data LabelSelector
- data Region
- data ResourceID
- data FirewallStatus = FirewallStatus {}
- data PublicIPInfo dnsptr ip = PublicIPInfo {
- reverseDNS :: dnsptr
- publicIP :: ip
- data PublicNetwork = PublicNetwork {}
- streamPages :: forall key f a i m. (Foldable f, MonadIO m) => (Maybe Int -> IO (WithMeta key (f a))) -> ConduitT i a m ()
- streamToList :: Monad m => ConduitT () a m () -> m [a]
- cloudQuery :: (ToJSON body, FromJSON a) => ByteString -> ByteString -> Maybe body -> Token -> Maybe Int -> IO a
- noBody :: Maybe Void
- data WithKey (key :: Symbol) a = WithKey {
- withoutKey :: a
- data WithMeta (key :: Symbol) a = WithMeta {
- responseMeta :: ResponseMeta
- withoutMeta :: a
- data ResponseMeta = ResponseMeta {}
- data Pagination = Pagination {
- currentPage :: Int
- itemsPerPage :: Int
- previousPage :: Maybe Int
- nextPage :: Maybe Int
- lastPage :: Maybe Int
- totalEntries :: Maybe Int
Tokens
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.
getTokenFromEnv :: IO (Maybe Token) Source #
Lookup Token
from the environment variable HETZNER_API_TOKEN
.
Server metadata
Metadata that any server in the Hetzner cloud can discover about itself.
Metadata | |
|
getMetadata :: IO Metadata Source #
Obtain metadata from running server.
Hetzner Cloud API
Sections are in the same order as in the official documentation.
Actions
data ActionStatus Source #
Status of an action.
ActionRunning Int | Action is still running. The |
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
Show ActionStatus Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> ActionStatus -> ShowS # show :: ActionStatus -> String # showList :: [ActionStatus] -> ShowS # |
data ActionCommand Source #
Command performed by an action.
CreateServer | |
DeleteServer | |
StartServer | |
StopServer | |
SetFirewallRules | |
ApplyFirewall | |
CreateVolume | |
AttachVolume |
Instances
FromJSON ActionCommand Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser ActionCommand # parseJSONList :: Value -> Parser [ActionCommand] # | |
Show ActionCommand Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> ActionCommand -> ShowS # show :: ActionCommand -> String # showList :: [ActionCommand] -> ShowS # |
Action identifier.
Action.
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
newtype DatacenterID Source #
Datacenter identifier.
Instances
data DatacenterServers Source #
Server types available in a datacenter.
Instances
FromJSON DatacenterServers Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser DatacenterServers # parseJSONList :: Value -> Parser [DatacenterServers] # | |
Show DatacenterServers Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> DatacenterServers -> ShowS # show :: DatacenterServers -> String # showList :: [DatacenterServers] -> ShowS # |
data Datacenter Source #
A datacenter within a location.
Instances
FromJSON Datacenter Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser Datacenter # parseJSONList :: Value -> Parser [Datacenter] # | |
Show Datacenter Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> Datacenter -> ShowS # show :: Datacenter -> String # showList :: [Datacenter] -> ShowS # |
data DatacentersWithRecommendation Source #
Datacenter list with a datacenter recommendation for new servers.
DatacentersWithRecommendation | |
|
Instances
FromJSON DatacentersWithRecommendation Source # | |
Defined in Hetzner.Cloud | |
Show DatacentersWithRecommendation Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> DatacentersWithRecommendation -> ShowS # show :: DatacentersWithRecommendation -> String # showList :: [DatacentersWithRecommendation] -> ShowS # |
getDatacenters :: Token -> IO DatacentersWithRecommendation Source #
Get all datacenters.
getDatacenter :: Token -> DatacenterID -> IO Datacenter Source #
Get a single datacenter.
Firewalls
newtype FirewallID Source #
Firewall identifier.
Instances
FromJSON FirewallID Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser FirewallID # parseJSONList :: Value -> Parser [FirewallID] # | |
ToJSON FirewallID Source # | |
Defined in Hetzner.Cloud toJSON :: FirewallID -> Value # toEncoding :: FirewallID -> Encoding # toJSONList :: [FirewallID] -> Value # toEncodingList :: [FirewallID] -> Encoding # | |
Show FirewallID Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> FirewallID -> ShowS # show :: FirewallID -> String # showList :: [FirewallID] -> ShowS # | |
Eq FirewallID Source # | |
Defined in Hetzner.Cloud (==) :: FirewallID -> FirewallID -> Bool # (/=) :: FirewallID -> FirewallID -> Bool # | |
Ord FirewallID Source # | |
Defined in Hetzner.Cloud compare :: FirewallID -> FirewallID -> Ordering # (<) :: FirewallID -> FirewallID -> Bool # (<=) :: FirewallID -> FirewallID -> Bool # (>) :: FirewallID -> FirewallID -> Bool # (>=) :: FirewallID -> FirewallID -> Bool # max :: FirewallID -> FirewallID -> FirewallID # min :: FirewallID -> FirewallID -> FirewallID # |
Floating IPs
newtype FloatingIPID Source #
Floating IP identifier.
Instances
FromJSON FloatingIPID Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser FloatingIPID # parseJSONList :: Value -> Parser [FloatingIPID] # | |
Show FloatingIPID Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> FloatingIPID -> ShowS # show :: FloatingIPID -> String # showList :: [FloatingIPID] -> ShowS # | |
Eq FloatingIPID Source # | |
Defined in Hetzner.Cloud (==) :: FloatingIPID -> FloatingIPID -> Bool # (/=) :: FloatingIPID -> FloatingIPID -> Bool # | |
Ord FloatingIPID Source # | |
Defined in Hetzner.Cloud compare :: FloatingIPID -> FloatingIPID -> Ordering # (<) :: FloatingIPID -> FloatingIPID -> Bool # (<=) :: FloatingIPID -> FloatingIPID -> Bool # (>) :: FloatingIPID -> FloatingIPID -> Bool # (>=) :: FloatingIPID -> FloatingIPID -> Bool # max :: FloatingIPID -> FloatingIPID -> FloatingIPID # min :: FloatingIPID -> FloatingIPID -> FloatingIPID # |
Images
Flavor of operative system.
Image type.
Image identifier.
An image that can be mounted to a server.
Image | |
|
Load Balancers
newtype LoadBalancerID Source #
Load balancer identifier
Instances
Locations
Cities where Hetzner hosts their servers.
newtype LocationID Source #
Location identifier.
Instances
FromJSON LocationID Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser LocationID # parseJSONList :: Value -> Parser [LocationID] # | |
ToJSON LocationID Source # | |
Defined in Hetzner.Cloud toJSON :: LocationID -> Value # toEncoding :: LocationID -> Encoding # toJSONList :: [LocationID] -> Value # toEncodingList :: [LocationID] -> Encoding # | |
Show LocationID Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> LocationID -> ShowS # show :: LocationID -> String # showList :: [LocationID] -> ShowS # | |
Eq LocationID Source # | |
Defined in Hetzner.Cloud (==) :: LocationID -> LocationID -> Bool # (/=) :: LocationID -> LocationID -> Bool # | |
Ord LocationID Source # | |
Defined in Hetzner.Cloud compare :: LocationID -> LocationID -> Ordering # (<) :: LocationID -> LocationID -> Bool # (<=) :: LocationID -> LocationID -> Bool # (>) :: LocationID -> LocationID -> Bool # (>=) :: LocationID -> LocationID -> Bool # max :: LocationID -> LocationID -> LocationID # min :: LocationID -> LocationID -> LocationID # |
A location.
getLocation :: Token -> LocationID -> IO Location Source #
Get a single location.
Networks
Network identifier.
A route that sends all packets for a given destination to a given gateway.
data SubnetType Source #
Types of subnetworks.
Instances
FromJSON SubnetType Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser SubnetType # parseJSONList :: Value -> Parser [SubnetType] # | |
ToJSON SubnetType Source # | |
Defined in Hetzner.Cloud toJSON :: SubnetType -> Value # toEncoding :: SubnetType -> Encoding # toJSONList :: [SubnetType] -> Value # toEncodingList :: [SubnetType] -> Encoding # | |
Show SubnetType Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> SubnetType -> ShowS # show :: SubnetType -> String # showList :: [SubnetType] -> ShowS # | |
Eq SubnetType Source # | |
Defined in Hetzner.Cloud (==) :: SubnetType -> SubnetType -> Bool # (/=) :: SubnetType -> SubnetType -> Bool # |
Subnets divide the IP range of a parent Network
.
A private network.
Network | |
|
data NewNetwork Source #
Network creation configuration to be used with createNetwork
.
NewNetwork | |
|
Instances
ToJSON NewNetwork Source # | |
Defined in Hetzner.Cloud toJSON :: NewNetwork -> Value # toEncoding :: NewNetwork -> Encoding # toJSONList :: [NewNetwork] -> Value # toEncodingList :: [NewNetwork] -> Encoding # |
:: Text | Network name. |
-> IPv4Range | IP range of the network. |
-> NewNetwork |
Default network configuration for new networks.
createNetwork :: Token -> NewNetwork -> IO Network Source #
Create a new network.
:: 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
A resource's price.
data PriceInLocation Source #
The price of a resource in a location. Hourly pricing is unavailable for some resources.
PriceInLocation | |
|
Instances
FromJSON PriceInLocation Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser PriceInLocation # parseJSONList :: Value -> Parser [PriceInLocation] # | |
Show PriceInLocation Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> PriceInLocation -> ShowS # show :: PriceInLocation -> String # showList :: [PriceInLocation] -> ShowS # |
Servers
data ServerStatus Source #
A server status.
Instances
FromJSON ServerStatus Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser ServerStatus # parseJSONList :: Value -> Parser [ServerStatus] # | |
Show ServerStatus Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> ServerStatus -> ShowS # show :: ServerStatus -> String # showList :: [ServerStatus] -> ShowS # | |
Eq ServerStatus Source # | |
Defined in Hetzner.Cloud (==) :: ServerStatus -> ServerStatus -> Bool # (/=) :: ServerStatus -> ServerStatus -> Bool # |
Server identifier.
A server.
Server creation configuration to be used with createServer
.
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
.
CreatedServer | |
|
Instances
FromJSON CreatedServer Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser CreatedServer # parseJSONList :: Value -> Parser [CreatedServer] # | |
Show CreatedServer Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> CreatedServer -> ShowS # show :: CreatedServer -> String # showList :: [CreatedServer] -> ShowS # |
createServer :: Token -> NewServer -> IO CreatedServer Source #
Create a new server.
Server types
data Architecture Source #
Computer architecture.
Instances
FromJSON Architecture Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser Architecture # parseJSONList :: Value -> Parser [Architecture] # | |
Show Architecture Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> Architecture -> ShowS # show :: Architecture -> String # showList :: [Architecture] -> ShowS # | |
Eq Architecture Source # | |
Defined in Hetzner.Cloud (==) :: Architecture -> Architecture -> Bool # (/=) :: Architecture -> Architecture -> Bool # |
data StorageType Source #
Type of server boot drive.
Instances
FromJSON StorageType Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser StorageType # parseJSONList :: Value -> Parser [StorageType] # | |
Show StorageType Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> StorageType -> ShowS # show :: StorageType -> String # showList :: [StorageType] -> ShowS # | |
Eq StorageType Source # | |
Defined in Hetzner.Cloud (==) :: StorageType -> StorageType -> Bool # (/=) :: StorageType -> StorageType -> Bool # |
newtype ServerTypeID Source #
Server type identifier.
Instances
data ServerType Source #
Server characteristics.
ServerType | |
|
Instances
FromJSON ServerType Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser ServerType # parseJSONList :: Value -> Parser [ServerType] # | |
Show ServerType Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> ServerType -> ShowS # show :: ServerType -> String # showList :: [ServerType] -> ShowS # |
getServerTypes :: Token -> IO [ServerType] Source #
Get all server types.
SSH Keys
SSH key identifier.
SSH key information.
:: 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.
:: 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
Volume identifier.
data VolumeFormat Source #
Volume format.
Instances
FromJSON VolumeFormat Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser VolumeFormat # parseJSONList :: Value -> Parser [VolumeFormat] # | |
ToJSON VolumeFormat Source # | |
Defined in Hetzner.Cloud toJSON :: VolumeFormat -> Value # toEncoding :: VolumeFormat -> Encoding # toJSONList :: [VolumeFormat] -> Value # toEncodingList :: [VolumeFormat] -> Encoding # | |
Show VolumeFormat Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> VolumeFormat -> ShowS # show :: VolumeFormat -> String # showList :: [VolumeFormat] -> ShowS # | |
Eq VolumeFormat Source # | |
Defined in Hetzner.Cloud (==) :: VolumeFormat -> VolumeFormat -> Bool # (/=) :: VolumeFormat -> VolumeFormat -> Bool # |
data VolumeStatus Source #
Volume status.
Instances
FromJSON VolumeStatus Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser VolumeStatus # parseJSONList :: Value -> Parser [VolumeStatus] # | |
Show VolumeStatus Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> VolumeStatus -> ShowS # show :: VolumeStatus -> String # showList :: [VolumeStatus] -> ShowS # | |
Eq VolumeStatus Source # | |
Defined in Hetzner.Cloud (==) :: VolumeStatus -> VolumeStatus -> Bool # (/=) :: VolumeStatus -> VolumeStatus -> Bool # |
A volume that can be attached to a server.
Volume | |
|
data AttachToServer Source #
Attach a volume to a server. The boolean parameter indicates whether the volume will be auto-mounted.
Volume creation configuration to be used with createVolume
.
NewVolume | |
|
data CreatedVolume Source #
A volume created with createVolume
.
Instances
FromJSON CreatedVolume Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser CreatedVolume # parseJSONList :: Value -> Parser [CreatedVolume] # | |
Show CreatedVolume Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> CreatedVolume -> ShowS # show :: CreatedVolume -> String # showList :: [CreatedVolume] -> ShowS # |
createVolume :: Token -> NewVolume -> IO CreatedVolume Source #
Create a new volume.
:: 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
An error returned by Hetzner.
Error | |
|
data CloudException Source #
Exception produced while performing a request to Hetzner Cloud.
Instances
Exception CloudException Source # | |
Defined in Hetzner.Cloud | |
Show CloudException Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> CloudException -> ShowS # show :: CloudException -> String # showList :: [CloudException] -> ShowS # |
Labels
Label key.
LabelKey | |
|
Labels are key-value pairs that can be attached to all resources.
Label | |
|
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 results.
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. |
LabelAll [LabelSelector] | Select only when all selectors succeed. |
Instances
Monoid LabelSelector Source # | Neutral element is a selector that always succeeds. |
Defined in Hetzner.Cloud mempty :: LabelSelector # mappend :: LabelSelector -> LabelSelector -> LabelSelector # mconcat :: [LabelSelector] -> LabelSelector # | |
Semigroup LabelSelector Source # | Semigroup under "and" operation. |
Defined in Hetzner.Cloud (<>) :: LabelSelector -> LabelSelector -> LabelSelector # sconcat :: NonEmpty LabelSelector -> LabelSelector # stimes :: Integral b => b -> LabelSelector -> LabelSelector # |
Other types
Regions
Network zones.
Resources
data ResourceID Source #
A resource ID is an ID from one of the available resources.
ResourceServerID ServerID | Server ID. |
ResourceVolumeID VolumeID | Volume ID. |
Instances
FromJSON ResourceID Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser ResourceID # parseJSONList :: Value -> Parser [ResourceID] # | |
Show ResourceID Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> ResourceID -> ShowS # show :: ResourceID -> String # showList :: [ResourceID] -> ShowS # |
Public networks
data FirewallStatus Source #
A firewall ID and whether the firewall is applied or not.
Instances
FromJSON FirewallStatus Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser FirewallStatus # parseJSONList :: Value -> Parser [FirewallStatus] # | |
Show FirewallStatus Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> FirewallStatus -> ShowS # show :: FirewallStatus -> String # showList :: [FirewallStatus] -> ShowS # |
data PublicIPInfo dnsptr ip Source #
Public IP information.
PublicIPInfo | |
|
Instances
(FromJSON dnsptr, FromJSON ip) => FromJSON (PublicIPInfo dnsptr ip) Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser (PublicIPInfo dnsptr ip) # parseJSONList :: Value -> Parser [PublicIPInfo dnsptr ip] # | |
(Show dnsptr, Show ip) => Show (PublicIPInfo dnsptr ip) Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> PublicIPInfo dnsptr ip -> ShowS # show :: PublicIPInfo dnsptr ip -> String # showList :: [PublicIPInfo dnsptr ip] -> ShowS # |
data PublicNetwork Source #
Public network information associated with a Server
.
Instances
FromJSON PublicNetwork Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser PublicNetwork # parseJSONList :: Value -> Parser [PublicNetwork] # | |
Show PublicNetwork Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> PublicNetwork -> ShowS # show :: PublicNetwork -> String # showList :: [PublicNetwork] -> ShowS # |
Streaming
:: 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
:: (ToJSON body, FromJSON a) | |
=> ByteString | Method |
-> ByteString | Path |
-> Maybe body | Request body. You may use |
-> 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.
JSON Wrappers
data WithKey (key :: Symbol) a Source #
Wrap a value with the key of the value within a JSON object.
WithKey | |
|
Instances
Foldable (WithKey key) Source # | |
Defined in Hetzner.Cloud 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 # | |
Functor (WithKey key) Source # | |
(KnownSymbol key, FromJSON a) => FromJSON (WithKey key a) Source # | |
Show a => Show (WithKey key a) Source # | |
data WithMeta (key :: Symbol) a Source #
A value together with response metadata. The type is annotated with the JSON key of the value.
WithMeta | |
|
Instances
Foldable (WithMeta key) Source # | |
Defined in Hetzner.Cloud 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 # | |
Functor (WithMeta key) Source # | |
(KnownSymbol key, FromJSON a) => FromJSON (WithMeta key a) Source # | |
Show a => Show (WithMeta key a) Source # | |
Response metadata
data ResponseMeta Source #
Metadata attached to a response.
Instances
FromJSON ResponseMeta Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser ResponseMeta # parseJSONList :: Value -> Parser [ResponseMeta] # | |
Show ResponseMeta Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> ResponseMeta -> ShowS # show :: ResponseMeta -> String # showList :: [ResponseMeta] -> ShowS # |
data Pagination Source #
Pagination information.
Pagination | |
|
Instances
FromJSON Pagination Source # | |
Defined in Hetzner.Cloud parseJSON :: Value -> Parser Pagination # parseJSONList :: Value -> Parser [Pagination] # | |
Show Pagination Source # | |
Defined in Hetzner.Cloud showsPrec :: Int -> Pagination -> ShowS # show :: Pagination -> String # showList :: [Pagination] -> ShowS # |