Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
. 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.
Constructors
Token ByteString |
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.
Constructors
Metadata | |
Fields
|
Instances
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.
Constructors
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 Methods showsPrec :: Int -> ActionStatus -> ShowS # show :: ActionStatus -> String # showList :: [ActionStatus] -> ShowS # |
data ActionCommand Source #
Command performed by an action.
Constructors
CreateServer | |
DeleteServer | |
StartServer | |
StopServer | |
SetFirewallRules | |
ApplyFirewall | |
CreateVolume | |
AttachVolume |
Instances
FromJSON ActionCommand Source # | |
Defined in Hetzner.Cloud Methods parseJSON :: Value -> Parser ActionCommand # parseJSONList :: Value -> Parser [ActionCommand] # | |
Show ActionCommand Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> ActionCommand -> ShowS # show :: ActionCommand -> String # showList :: [ActionCommand] -> ShowS # |
Action identifier.
Action.
Constructors
Action | |
Fields
|
Get actions.
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.
Constructors
DatacenterID Int |
Instances
FromJSON DatacenterID Source # | |
Defined in Hetzner.Cloud | |
ToJSON DatacenterID Source # | |
Defined in Hetzner.Cloud Methods toJSON :: DatacenterID -> Value # toEncoding :: DatacenterID -> Encoding # toJSONList :: [DatacenterID] -> Value # toEncodingList :: [DatacenterID] -> Encoding # | |
Show DatacenterID Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> DatacenterID -> ShowS # show :: DatacenterID -> String # showList :: [DatacenterID] -> ShowS # | |
Eq DatacenterID Source # | |
Defined in Hetzner.Cloud | |
Ord DatacenterID Source # | |
Defined in Hetzner.Cloud Methods compare :: DatacenterID -> DatacenterID -> Ordering # (<) :: DatacenterID -> DatacenterID -> Bool # (<=) :: DatacenterID -> DatacenterID -> Bool # (>) :: DatacenterID -> DatacenterID -> Bool # (>=) :: DatacenterID -> DatacenterID -> Bool # max :: DatacenterID -> DatacenterID -> DatacenterID # min :: DatacenterID -> DatacenterID -> DatacenterID # |
data DatacenterServers Source #
Server types available in a datacenter.
Constructors
DatacenterServers | |
Fields |
Instances
FromJSON DatacenterServers Source # | |
Defined in Hetzner.Cloud Methods parseJSON :: Value -> Parser DatacenterServers # parseJSONList :: Value -> Parser [DatacenterServers] # | |
Show DatacenterServers Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> DatacenterServers -> ShowS # show :: DatacenterServers -> String # showList :: [DatacenterServers] -> ShowS # |
data Datacenter Source #
A datacenter within a location.
Constructors
Datacenter | |
Instances
FromJSON Datacenter Source # | |
Defined in Hetzner.Cloud | |
Show Datacenter Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> Datacenter -> ShowS # show :: Datacenter -> String # showList :: [Datacenter] -> ShowS # |
data DatacentersWithRecommendation Source #
Datacenter list with a datacenter recommendation for new servers.
Constructors
DatacentersWithRecommendation | |
Fields
|
Instances
FromJSON DatacentersWithRecommendation Source # | |
Defined in Hetzner.Cloud Methods parseJSON :: Value -> Parser DatacentersWithRecommendation # parseJSONList :: Value -> Parser [DatacentersWithRecommendation] # | |
Show DatacentersWithRecommendation Source # | |
Defined in Hetzner.Cloud Methods 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.
Constructors
FirewallID Int |
Instances
FromJSON FirewallID Source # | |
Defined in Hetzner.Cloud | |
ToJSON FirewallID Source # | |
Defined in Hetzner.Cloud Methods toJSON :: FirewallID -> Value # toEncoding :: FirewallID -> Encoding # toJSONList :: [FirewallID] -> Value # toEncodingList :: [FirewallID] -> Encoding # | |
Show FirewallID Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> FirewallID -> ShowS # show :: FirewallID -> String # showList :: [FirewallID] -> ShowS # | |
Eq FirewallID Source # | |
Defined in Hetzner.Cloud | |
Ord FirewallID Source # | |
Defined in Hetzner.Cloud Methods 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.
Constructors
FloatingIPID Int |
Instances
FromJSON FloatingIPID Source # | |
Defined in Hetzner.Cloud | |
Show FloatingIPID Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> FloatingIPID -> ShowS # show :: FloatingIPID -> String # showList :: [FloatingIPID] -> ShowS # | |
Eq FloatingIPID Source # | |
Defined in Hetzner.Cloud | |
Ord FloatingIPID Source # | |
Defined in Hetzner.Cloud Methods 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.
Instances
Image type.
Image identifier.
An image that can be mounted to a server.
Constructors
Image | |
Fields
|
Load Balancers
newtype LoadBalancerID Source #
Load balancer identifier
Constructors
LoadBalancerID Int |
Instances
Locations
Cities where Hetzner hosts their servers.
Constructors
Falkenstein | |
Nuremberg | |
Helsinki | |
AshburnVA | |
HillsboroOR |
newtype LocationID Source #
Location identifier.
Constructors
LocationID Int |
Instances
FromJSON LocationID Source # | |
Defined in Hetzner.Cloud | |
ToJSON LocationID Source # | |
Defined in Hetzner.Cloud Methods toJSON :: LocationID -> Value # toEncoding :: LocationID -> Encoding # toJSONList :: [LocationID] -> Value # toEncodingList :: [LocationID] -> Encoding # | |
Show LocationID Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> LocationID -> ShowS # show :: LocationID -> String # showList :: [LocationID] -> ShowS # | |
Eq LocationID Source # | |
Defined in Hetzner.Cloud | |
Ord LocationID Source # | |
Defined in Hetzner.Cloud Methods compare :: LocationID -> LocationID -> Ordering # (<) :: LocationID -> LocationID -> Bool # (<=) :: LocationID -> LocationID -> Bool # (>) :: LocationID -> LocationID -> Bool # (>=) :: LocationID -> LocationID -> Bool # max :: LocationID -> LocationID -> LocationID # min :: LocationID -> LocationID -> LocationID # |
getLocation :: Token -> LocationID -> IO Location Source #
Get a single location.
Networks
Network identifier.
Instances
FromJSON NetworkID Source # | |
ToJSON NetworkID Source # | |
Defined in Hetzner.Cloud | |
Show NetworkID Source # | |
Eq NetworkID Source # | |
Ord NetworkID Source # | |
A route that sends all packets for a given destination to a given gateway.
Constructors
Route | |
Fields |
data SubnetType Source #
Types of subnetworks.
Constructors
SubnetCloud | |
SubnetServer | |
SubnetVSwitch |
Instances
FromJSON SubnetType Source # | |
Defined in Hetzner.Cloud | |
ToJSON SubnetType Source # | |
Defined in Hetzner.Cloud Methods toJSON :: SubnetType -> Value # toEncoding :: SubnetType -> Encoding # toJSONList :: [SubnetType] -> Value # toEncodingList :: [SubnetType] -> Encoding # | |
Show SubnetType Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> SubnetType -> ShowS # show :: SubnetType -> String # showList :: [SubnetType] -> ShowS # | |
Eq SubnetType Source # | |
Defined in Hetzner.Cloud |
Subnets divide the IP range of a parent Network
.
Constructors
Subnet | |
Fields |
A private network.
Constructors
Network | |
Fields
|
Instances
data NewNetwork Source #
Network creation configuration to be used with createNetwork
.
Constructors
NewNetwork | |
Fields
|
Instances
ToJSON NewNetwork Source # | |
Defined in Hetzner.Cloud Methods toJSON :: NewNetwork -> Value # toEncoding :: NewNetwork -> Encoding # toJSONList :: [NewNetwork] -> Value # toEncodingList :: [NewNetwork] -> Encoding # |
Arguments
:: Text | Network name. |
-> IPv4Range | IP range of the network. |
-> NewNetwork |
Default network configuration for new networks.
Get networks.
createNetwork :: Token -> NewNetwork -> IO Network Source #
Create a new network.
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
A resource's price.
Constructors
Price | |
Fields |
data PriceInLocation Source #
The price of a resource in a location. Hourly pricing is unavailable for some resources.
Constructors
PriceInLocation | |
Fields
|
Instances
FromJSON PriceInLocation Source # | |
Defined in Hetzner.Cloud Methods parseJSON :: Value -> Parser PriceInLocation # parseJSONList :: Value -> Parser [PriceInLocation] # | |
Show PriceInLocation Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> PriceInLocation -> ShowS # show :: PriceInLocation -> String # showList :: [PriceInLocation] -> ShowS # |
Servers
data ServerStatus Source #
A server status.
Constructors
Running | |
Initializing | |
Starting | |
Stopping | |
Off | |
Deleting | |
Migrating | |
Rebuilding | |
StatusUnknown |
Instances
FromJSON ServerStatus Source # | |
Defined in Hetzner.Cloud | |
Show ServerStatus Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> ServerStatus -> ShowS # show :: ServerStatus -> String # showList :: [ServerStatus] -> ShowS # | |
Eq ServerStatus Source # | |
Defined in Hetzner.Cloud |
Server identifier.
A server.
Constructors
Server | |
Fields |
Server creation configuration to be used with createServer
.
Constructors
NewServer | |
Fields
|
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
FromJSON CreatedServer Source # | |
Defined in Hetzner.Cloud Methods parseJSON :: Value -> Parser CreatedServer # parseJSONList :: Value -> Parser [CreatedServer] # | |
Show CreatedServer Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> CreatedServer -> ShowS # show :: CreatedServer -> String # showList :: [CreatedServer] -> ShowS # |
Get servers.
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 | |
Show Architecture Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> Architecture -> ShowS # show :: Architecture -> String # showList :: [Architecture] -> ShowS # | |
Eq Architecture Source # | |
Defined in Hetzner.Cloud |
data StorageType Source #
Type of server boot drive.
Constructors
LocalStorage | |
NetworkStorage |
Instances
FromJSON StorageType Source # | |
Defined in Hetzner.Cloud | |
Show StorageType Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> StorageType -> ShowS # show :: StorageType -> String # showList :: [StorageType] -> ShowS # | |
Eq StorageType Source # | |
Defined in Hetzner.Cloud |
CPU types available.
Constructors
SharedCPU | |
DedicatedCPU |
newtype ServerTypeID Source #
Server type identifier.
Constructors
ServerTypeID Int |
Instances
FromJSON ServerTypeID Source # | |
Defined in Hetzner.Cloud | |
ToJSON ServerTypeID Source # | |
Defined in Hetzner.Cloud Methods toJSON :: ServerTypeID -> Value # toEncoding :: ServerTypeID -> Encoding # toJSONList :: [ServerTypeID] -> Value # toEncodingList :: [ServerTypeID] -> Encoding # | |
Show ServerTypeID Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> ServerTypeID -> ShowS # show :: ServerTypeID -> String # showList :: [ServerTypeID] -> ShowS # | |
Eq ServerTypeID Source # | |
Defined in Hetzner.Cloud | |
Ord ServerTypeID Source # | |
Defined in Hetzner.Cloud Methods compare :: ServerTypeID -> ServerTypeID -> Ordering # (<) :: ServerTypeID -> ServerTypeID -> Bool # (<=) :: ServerTypeID -> ServerTypeID -> Bool # (>) :: ServerTypeID -> ServerTypeID -> Bool # (>=) :: ServerTypeID -> ServerTypeID -> Bool # max :: ServerTypeID -> ServerTypeID -> ServerTypeID # min :: ServerTypeID -> ServerTypeID -> ServerTypeID # |
data ServerType Source #
Server characteristics.
Constructors
ServerType | |
Fields
|
Instances
FromJSON ServerType Source # | |
Defined in Hetzner.Cloud | |
Show ServerType Source # | |
Defined in Hetzner.Cloud Methods 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.
Constructors
SSHKey | |
Fields |
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.
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
Volume identifier.
data VolumeFormat Source #
Volume format.
Instances
FromJSON VolumeFormat Source # | |
Defined in Hetzner.Cloud | |
ToJSON VolumeFormat Source # | |
Defined in Hetzner.Cloud Methods toJSON :: VolumeFormat -> Value # toEncoding :: VolumeFormat -> Encoding # toJSONList :: [VolumeFormat] -> Value # toEncodingList :: [VolumeFormat] -> Encoding # | |
Show VolumeFormat Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> VolumeFormat -> ShowS # show :: VolumeFormat -> String # showList :: [VolumeFormat] -> ShowS # | |
Eq VolumeFormat Source # | |
Defined in Hetzner.Cloud |
data VolumeStatus Source #
Volume status.
Constructors
VolumeCreating | |
VolumeAvailable |
Instances
FromJSON VolumeStatus Source # | |
Defined in Hetzner.Cloud | |
Show VolumeStatus Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> VolumeStatus -> ShowS # show :: VolumeStatus -> String # showList :: [VolumeStatus] -> ShowS # | |
Eq VolumeStatus Source # | |
Defined in Hetzner.Cloud |
A volume that can be attached to a server.
Constructors
Volume | |
Fields
|
data AttachToServer Source #
Attach a volume to a server. The boolean parameter indicates whether the volume will be auto-mounted.
Constructors
AttachToServer ServerID Bool |
Volume creation configuration to be used with createVolume
.
Constructors
NewVolume | |
Fields
|
data CreatedVolume Source #
A volume created with createVolume
.
Constructors
CreatedVolume | |
Fields |
Instances
FromJSON CreatedVolume Source # | |
Defined in Hetzner.Cloud Methods parseJSON :: Value -> Parser CreatedVolume # parseJSONList :: Value -> Parser [CreatedVolume] # | |
Show CreatedVolume Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> CreatedVolume -> ShowS # show :: CreatedVolume -> String # showList :: [CreatedVolume] -> ShowS # |
createVolume :: Token -> NewVolume -> IO CreatedVolume Source #
Create a new volume.
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
An error returned by Hetzner.
Constructors
Error | |
Fields
|
data CloudException Source #
Exception produced while performing a request to Hetzner Cloud.
Constructors
CloudError Error | |
JSONError (Response ByteString) String |
Instances
Exception CloudException Source # | |
Defined in Hetzner.Cloud Methods toException :: CloudException -> SomeException # | |
Show CloudException Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> CloudException -> ShowS # show :: CloudException -> String # showList :: [CloudException] -> ShowS # |
Labels
Label key.
Constructors
LabelKey | |
Fields
|
Instances
FromJSON LabelKey Source # | |
FromJSONKey LabelKey Source # | |
Defined in Hetzner.Cloud Methods | |
ToJSON LabelKey Source # | |
Defined in Hetzner.Cloud | |
ToJSONKey LabelKey Source # | |
Defined in Hetzner.Cloud | |
Show LabelKey Source # | |
Eq LabelKey Source # | |
Ord LabelKey Source # | |
Defined in Hetzner.Cloud |
Labels are key-value pairs that can be attached to all resources.
Constructors
Label | |
Fields
|
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.
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. |
LabelAll [LabelSelector] | Select only when all selectors succeed. |
Instances
Monoid LabelSelector Source # | Neutral element is a selector that always succeeds. |
Defined in Hetzner.Cloud Methods mempty :: LabelSelector # mappend :: LabelSelector -> LabelSelector -> LabelSelector # mconcat :: [LabelSelector] -> LabelSelector # | |
Semigroup LabelSelector Source # | Semigroup under "and" operation. |
Defined in Hetzner.Cloud Methods (<>) :: 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.
Constructors
ResourceServerID ServerID | Server ID. |
ResourceVolumeID VolumeID | Volume ID. |
Instances
FromJSON ResourceID Source # | |
Defined in Hetzner.Cloud | |
Show ResourceID Source # | |
Defined in Hetzner.Cloud Methods 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.
Constructors
FirewallStatus | |
Fields |
Instances
FromJSON FirewallStatus Source # | |
Defined in Hetzner.Cloud Methods parseJSON :: Value -> Parser FirewallStatus # parseJSONList :: Value -> Parser [FirewallStatus] # | |
Show FirewallStatus Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> FirewallStatus -> ShowS # show :: FirewallStatus -> String # showList :: [FirewallStatus] -> ShowS # |
data PublicIPInfo dnsptr ip Source #
Public IP information.
Constructors
PublicIPInfo | |
Fields
|
Instances
(FromJSON dnsptr, FromJSON ip) => FromJSON (PublicIPInfo dnsptr ip) Source # | |
Defined in Hetzner.Cloud Methods 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 Methods 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
.
Constructors
PublicNetwork | |
Fields |
Instances
FromJSON PublicNetwork Source # | |
Defined in Hetzner.Cloud Methods parseJSON :: Value -> Parser PublicNetwork # parseJSONList :: Value -> Parser [PublicNetwork] # | |
Show PublicNetwork Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> PublicNetwork -> ShowS # show :: PublicNetwork -> String # showList :: [PublicNetwork] -> ShowS # |
Streaming
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
Arguments
:: (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.
Constructors
WithKey | |
Fields
|
Instances
Foldable (WithKey key) Source # | |
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 # | |
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.
Constructors
WithMeta | |
Fields
|
Instances
Foldable (WithMeta key) Source # | |
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 # | |
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.
Constructors
ResponseMeta | |
Fields |
Instances
FromJSON ResponseMeta Source # | |
Defined in Hetzner.Cloud | |
Show ResponseMeta Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> ResponseMeta -> ShowS # show :: ResponseMeta -> String # showList :: [ResponseMeta] -> ShowS # |
data Pagination Source #
Pagination information.
Constructors
Pagination | |
Fields
|
Instances
FromJSON Pagination Source # | |
Defined in Hetzner.Cloud | |
Show Pagination Source # | |
Defined in Hetzner.Cloud Methods showsPrec :: Int -> Pagination -> ShowS # show :: Pagination -> String # showList :: [Pagination] -> ShowS # |