Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Client for the Hetzner DNS API.
Synopsis
- newtype Token = Token ByteString
- getTokenFromEnv :: IO (Maybe Token)
- newtype ZoneID = ZoneID Text
- data ZoneStatus
- data Zone = Zone {}
- getZones :: Token -> Maybe Int -> IO (WithMeta "zones" [Zone])
- getZone :: Token -> ZoneID -> IO Zone
- updateZone :: Token -> ZoneID -> Text -> Maybe Int -> IO Zone
- deleteZone :: Token -> ZoneID -> IO ()
- newtype RecordID = RecordID Text
- data RecordType
- allRecordTypes :: [RecordType]
- data Record = Record {}
- getRecords :: Token -> Maybe ZoneID -> IO [Record]
- getRecord :: Token -> RecordID -> IO Record
- createRecord :: Token -> ZoneID -> Text -> RecordType -> Text -> Maybe Int -> IO Record
- updateRecord :: Token -> RecordID -> ZoneID -> Text -> RecordType -> Text -> Maybe Int -> IO Record
- deleteRecord :: Token -> RecordID -> IO ()
- data DNSException
- 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]
- dnsQuery :: (ToJSON body, FromJSON a) => ByteString -> ByteString -> Maybe body -> Query -> 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.
You can create one in the Hetzner DNS Console.
getTokenFromEnv :: IO (Maybe Token) Source #
Lookup Token
from the environment variable HETZNER_DNS_TOKEN
.
Hetzner DNS
Zones
Zone identifier.
data ZoneStatus Source #
Status of a Zone
.
Instances
FromJSON ZoneStatus Source # | |
Defined in Hetzner.DNS parseJSON :: Value -> Parser ZoneStatus # parseJSONList :: Value -> Parser [ZoneStatus] # | |
Show ZoneStatus Source # | |
Defined in Hetzner.DNS showsPrec :: Int -> ZoneStatus -> ShowS # show :: ZoneStatus -> String # showList :: [ZoneStatus] -> ShowS # |
DNS zone.
Zone | |
|
:: Token | |
-> ZoneID | ID of zone to update. |
-> Text | New zone name. |
-> Maybe Int | New TTL. If not provided, it won't change. |
-> IO Zone |
Update a zone's name and TTL.
Records
A record identifier.
data RecordType Source #
Record type.
Instances
allRecordTypes :: [RecordType] Source #
List with all supported record types.
A DNS record.
Record | |
|
Get DNS records.
:: Token | |
-> ZoneID | Zone to add the record to. |
-> Text | Record name. |
-> RecordType | Record type. |
-> Text | Record value. |
-> Maybe Int | Optional TTL. |
-> IO Record |
Create a DNS record.
:: Token | |
-> RecordID | Record to update. |
-> ZoneID | Zone for the record. |
-> Text | New record name. |
-> RecordType | New recored type. |
-> Text | New record value. |
-> Maybe Int | Optinally, a new TTL. |
-> IO Record |
Update a DNS record.
Exceptions
data DNSException Source #
Exception produced while performing a request to Hetzner DNS.
Instances
Exception DNSException Source # | |
Defined in Hetzner.DNS | |
Show DNSException Source # | |
Defined in Hetzner.DNS showsPrec :: Int -> DNSException -> ShowS # show :: DNSException -> String # showList :: [DNSException] -> 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 |
-> Query | Additional query options. |
-> Token | Authorization token. |
-> Maybe Int | Page. |
-> IO a |
Generic Hetzner DNS query.
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 # |