-- |
-- Module: PowerDNS.Client
-- Description: Servant client functions and utilities to interact with a PowerDNS Server
--
-- All the endpoints provide only a very slim wrapper around the PowerDNS API preserving
-- its idiosyncracies.

{-# LANGUAGE OverloadedStrings #-}
module PowerDNS.Client
  (
  -- * Authentication
    applyXApiKey

  -- * Zones
  --
  -- | See documentation at [PowerDNS Zones API](https://doc.powerdns.com/authoritative/http-api/zone.html)
  --
  -- Because the required fields of a 'Zone' differs between various requests and responses, every field
  -- is wrapped with Maybe. It is the users responsibility to check with the PowerDNS API to know when a
  -- field must be specified. For convenience 'empty' can be used to generate a value of 'Zone' with all
  -- fields set to 'Nothing'.
  --
  -- @
  --    let zone = empty { zone_name = Just "some.domain."
  --                     , zone_kind = Just Native
  --                     , zone_type = Just "zone" }
  --
  --    in createZone "localhost" -- Server ID
  --                  Nothing     -- Show RRsets in response
  --                  zone        -- The zone we are creating
  -- @
  , listZones
  , createZone
  , getZone
  , deleteZone
  , updateRecords
  , updateZone
  , triggerAxfr
  , notifySlaves
  , getZoneAxfr
  , rectifyZone
  -- ** Data types
  , Zone(..)
  , Kind(..)
  , RRSets(..)
  , RRSet(..)
  , Record(..)
  , Comment(..)
  , ChangeType(..)
  , RecordType(..)

  -- * Cryptokeys
  -- | See documentation at [PowerDNS Cryptokeys API](https://doc.powerdns.com/authoritative/http-api/cryptokey.html)
  , listCryptoKeys
  , createCryptokey
  , getCryptokey
  , updateCryptokey
  , deleteCryptokey
  -- ** Data types
  , Cryptokey

  -- * Servers
  -- | See documentation at [PowerDNS Servers API](https://doc.powerdns.com/authoritative/http-api/server.html)
  --
  -- Also contains [PowerDNS Search API](https://doc.powerdns.com/authoritative/http-api/search.html)
  -- and [PowerDNS Cache API](https://doc.powerdns.com/authoritative/http-api/cache.html)
  , listServers
  , getServer
  , search
  , flushCache
  , statistics
  -- ** Data types
  , Server(..)
  , SearchResult(..)
  , ObjectType(..)
  , CacheFlushResult(..)

  -- * Metadata
  -- | See documentation at [PowerDNS Metadata API](https://doc.powerdns.com/authoritative/http-api/metadata.html)
  , listMetadata
  , createMetadata
  , getMetadata
  , updateMetadata
  , deleteMetadata
  -- ** Data types
  , Metadata(..)

  -- * TSIGKeys
  -- | See documentation at [PowerDNS TSIGKeys API](https://doc.powerdns.com/authoritative/http-api/metadata.html)
  -- as well as related [TSIG documentation](https://doc.powerdns.com/authoritative/tsig.html)
  , listTSIGKeys
  , createTSIGKey
  , getTSIGKey
  , updateTSIGKey
  , deleteTSIGKey

  -- ** Data types
  , TSIGKey(..)
  , TSIGAlgorithm(..)

  -- * Utilities
  , empty
  )
where

import qualified Data.CaseInsensitive as CI
import           Data.Sequence ((|>))
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import           Servant.API (NoContent)
import           Servant.API.Generic (fromServant)
import           Servant.Client (ClientEnv(..), ClientM, client)
import           Servant.Client.Core.Request (Request, requestHeaders)
import           Servant.Client.Generic (AsClientT)

import           PowerDNS.API
import           PowerDNS.Internal.Utils (empty)

-- | Causes all requests with this 'ClientEnv' to be sent with the specified key embedded in a X-API-Key header.
applyXApiKey :: T.Text -- ^ API key
             -> ClientEnv
             -> ClientEnv
applyXApiKey :: Text -> ClientEnv -> ClientEnv
applyXApiKey Text
key ClientEnv
env = ClientEnv
env { makeClientRequest :: BaseUrl -> Request -> Request
makeClientRequest = BaseUrl -> Request -> Request
modified }
  where
    modified :: BaseUrl -> Request -> Request
modified BaseUrl
url = ClientEnv -> BaseUrl -> Request -> Request
makeClientRequest ClientEnv
env BaseUrl
url (Request -> Request) -> (Request -> Request) -> Request -> Request
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Request -> Request
applyXApiKeyHeader Text
key

applyXApiKeyHeader :: T.Text -> Request -> Request
applyXApiKeyHeader :: Text -> Request -> Request
applyXApiKeyHeader Text
key Request
req =
    Request
req { requestHeaders :: Seq Header
requestHeaders = Request -> Seq Header
forall body path. RequestF body path -> Seq Header
requestHeaders Request
req Seq Header -> Header -> Seq Header
forall a. Seq a -> a -> Seq a
|> Header
authHeader }
  where
    authHeader :: Header
authHeader = (ByteString -> CI ByteString
forall s. FoldCase s => s -> CI s
CI.mk ByteString
"X-API-Key", Text -> ByteString
T.encodeUtf8 Text
key)

----------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------

pdnsClient :: PowerDNS (AsClientT ClientM)
pdnsClient :: PowerDNS (AsClientT ClientM)
pdnsClient = ToServant PowerDNS (AsClientT ClientM)
-> PowerDNS (AsClientT ClientM)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (Proxy
  ("api"
   :> ("v1"
       :> ((((("servers" :> Get '[JSON] [Server])
              :<|> ("servers"
                    :> (Capture "server_id" Text :> Get '[JSON] Server)))
             :<|> (("servers"
                    :> (Capture "server_id" Text
                        :> ("search-data"
                            :> (QueryParamReq "q" Text
                                :> (QueryParamReq "max" Integer
                                    :> (QueryParam "object_type" ObjectType
                                        :> Get '[JSON] [SearchResult]))))))
                   :<|> (("servers"
                          :> (Capture "server_id" Text
                              :> (QueryParamReq "domain" Text :> Put '[JSON] CacheFlushResult)))
                         :<|> ("servers"
                               :> (Capture "server_id" Text
                                   :> ("statistics"
                                       :> (QueryParam "statistic" Text
                                           :> (QueryParam "includerings" Bool
                                               :> Get '[JSON] [AnyStatisticItem]))))))))
            :<|> (((("servers"
                     :> (Capture "server_id" Text
                         :> ("zones"
                             :> (QueryParam "zone" Text
                                 :> (QueryParam "dnssec" Bool :> Get '[JSON] [Zone])))))
                    :<|> ("servers"
                          :> (Capture "server_id" Text
                              :> ("zones"
                                  :> (QueryParam "rrset" Bool
                                      :> (ReqBody '[JSON] Zone :> PostCreated '[JSON] Zone))))))
                   :<|> (("servers"
                          :> (Capture "server_id" Text
                              :> ("zones"
                                  :> (Capture "zone_id" Text
                                      :> (QueryParam "rrsets" Bool :> Get '[JSON] Zone)))))
                         :<|> (("servers"
                                :> (Capture "server_id" Text
                                    :> ("zones" :> (Capture "zone_id" Text :> DeleteNoContent))))
                               :<|> ("servers"
                                     :> (Capture "server_id" Text
                                         :> ("zones"
                                             :> (Capture "zone_id" Text
                                                 :> (ReqBody '[JSON] RRSets
                                                     :> PatchNoContent))))))))
                  :<|> ((("servers"
                          :> (Capture "server_id" Text
                              :> ("zones"
                                  :> (Capture "zone_id" Text
                                      :> (ReqBody '[JSON] Zone :> PutNoContent)))))
                         :<|> ("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("axfr-retrieve" :> Put '[JSON] NoContent))))))
                        :<|> (("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("notify" :> Put '[JSON] NoContent)))))
                              :<|> (("servers"
                                     :> (Capture "server_id" Text
                                         :> ("zones"
                                             :> (Capture "zone_id" Text
                                                 :> ("export" :> Get '[JSON] Text)))))
                                    :<|> ("servers"
                                          :> (Capture "server_id" Text
                                              :> ("zones"
                                                  :> (Capture "zone_id" Text
                                                      :> ("rectify" :> Put '[JSON] Text))))))))))
           :<|> (((("servers"
                    :> (Capture "server_id" Text
                        :> ("zones"
                            :> (Capture "zone_id" Text
                                :> ("cryptokeys" :> Get '[JSON] [Cryptokey])))))
                   :<|> ("servers"
                         :> (Capture "server_id" Text
                             :> ("zones"
                                 :> (Capture "zone_id" Text
                                     :> ("cryptokeys"
                                         :> (ReqBody '[JSON] Cryptokey
                                             :> PostCreated '[JSON] Cryptokey)))))))
                  :<|> (("servers"
                         :> (Capture "server_id" Text
                             :> ("zones"
                                 :> (Capture "zone_id" Text
                                     :> ("cryptokeys"
                                         :> (Capture "cryptokey_id" Text
                                             :> Get '[JSON] Cryptokey))))))
                        :<|> (("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("cryptokeys"
                                               :> (Capture "cryptokey_id" Text
                                                   :> (ReqBody '[JSON] Cryptokey
                                                       :> PutNoContent)))))))
                              :<|> ("servers"
                                    :> (Capture "server_id" Text
                                        :> ("zones"
                                            :> (Capture "zone_id" Text
                                                :> ("cryptokeys"
                                                    :> (Capture "cryptokey_id" Text
                                                        :> DeleteNoContent)))))))))
                 :<|> (((("servers"
                          :> (Capture "server_id" Text
                              :> ("zones"
                                  :> (Capture "zone_id" Text
                                      :> ("metadata" :> Get '[JSON] [Metadata])))))
                         :<|> ("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("metadata"
                                               :> (ReqBody '[JSON] Metadata :> PostNoContent)))))))
                        :<|> (("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("metadata"
                                               :> (Capture "kind" Text :> Get '[JSON] Metadata))))))
                              :<|> (("servers"
                                     :> (Capture "server_id" Text
                                         :> ("zones"
                                             :> (Capture "zone_id" Text
                                                 :> ("metadata"
                                                     :> (Capture "kind" Text
                                                         :> (ReqBody '[JSON] Metadata
                                                             :> Put '[JSON] Metadata)))))))
                                    :<|> ("servers"
                                          :> (Capture "server_id" Text
                                              :> ("zones"
                                                  :> (Capture "zone_id" Text
                                                      :> ("metadata"
                                                          :> (Capture "kind" Text
                                                              :> DeleteNoContent)))))))))
                       :<|> ((("servers"
                               :> (Capture "server_id" Text
                                   :> ("tsigkeys" :> Get '[JSON] [TSIGKey])))
                              :<|> ("servers"
                                    :> (Capture "server_id" Text
                                        :> ("tsigkeys"
                                            :> (ReqBody '[JSON] TSIGKey
                                                :> PostCreated '[JSON] TSIGKey)))))
                             :<|> (("servers"
                                    :> (Capture "server_id" Text
                                        :> ("tsigkeys"
                                            :> (Capture "tsigkey_id" Text :> Get '[JSON] TSIGKey))))
                                   :<|> (("servers"
                                          :> (Capture "server_id" Text
                                              :> ("tsigkeys"
                                                  :> (Capture "tsigkey_id" Text
                                                      :> (ReqBody '[JSON] TSIGKey
                                                          :> Put '[JSON] TSIGKey)))))
                                         :<|> ("servers"
                                               :> (Capture "server_id" Text
                                                   :> ("tsigkeys"
                                                       :> (Capture "tsigkey_id" Text
                                                           :> DeleteNoContent))))))))))))
-> Client
     ClientM
     ("api"
      :> ("v1"
          :> ((((("servers" :> Get '[JSON] [Server])
                 :<|> ("servers"
                       :> (Capture "server_id" Text :> Get '[JSON] Server)))
                :<|> (("servers"
                       :> (Capture "server_id" Text
                           :> ("search-data"
                               :> (QueryParamReq "q" Text
                                   :> (QueryParamReq "max" Integer
                                       :> (QueryParam "object_type" ObjectType
                                           :> Get '[JSON] [SearchResult]))))))
                      :<|> (("servers"
                             :> (Capture "server_id" Text
                                 :> (QueryParamReq "domain" Text :> Put '[JSON] CacheFlushResult)))
                            :<|> ("servers"
                                  :> (Capture "server_id" Text
                                      :> ("statistics"
                                          :> (QueryParam "statistic" Text
                                              :> (QueryParam "includerings" Bool
                                                  :> Get '[JSON] [AnyStatisticItem]))))))))
               :<|> (((("servers"
                        :> (Capture "server_id" Text
                            :> ("zones"
                                :> (QueryParam "zone" Text
                                    :> (QueryParam "dnssec" Bool :> Get '[JSON] [Zone])))))
                       :<|> ("servers"
                             :> (Capture "server_id" Text
                                 :> ("zones"
                                     :> (QueryParam "rrset" Bool
                                         :> (ReqBody '[JSON] Zone :> PostCreated '[JSON] Zone))))))
                      :<|> (("servers"
                             :> (Capture "server_id" Text
                                 :> ("zones"
                                     :> (Capture "zone_id" Text
                                         :> (QueryParam "rrsets" Bool :> Get '[JSON] Zone)))))
                            :<|> (("servers"
                                   :> (Capture "server_id" Text
                                       :> ("zones" :> (Capture "zone_id" Text :> DeleteNoContent))))
                                  :<|> ("servers"
                                        :> (Capture "server_id" Text
                                            :> ("zones"
                                                :> (Capture "zone_id" Text
                                                    :> (ReqBody '[JSON] RRSets
                                                        :> PatchNoContent))))))))
                     :<|> ((("servers"
                             :> (Capture "server_id" Text
                                 :> ("zones"
                                     :> (Capture "zone_id" Text
                                         :> (ReqBody '[JSON] Zone :> PutNoContent)))))
                            :<|> ("servers"
                                  :> (Capture "server_id" Text
                                      :> ("zones"
                                          :> (Capture "zone_id" Text
                                              :> ("axfr-retrieve" :> Put '[JSON] NoContent))))))
                           :<|> (("servers"
                                  :> (Capture "server_id" Text
                                      :> ("zones"
                                          :> (Capture "zone_id" Text
                                              :> ("notify" :> Put '[JSON] NoContent)))))
                                 :<|> (("servers"
                                        :> (Capture "server_id" Text
                                            :> ("zones"
                                                :> (Capture "zone_id" Text
                                                    :> ("export" :> Get '[JSON] Text)))))
                                       :<|> ("servers"
                                             :> (Capture "server_id" Text
                                                 :> ("zones"
                                                     :> (Capture "zone_id" Text
                                                         :> ("rectify" :> Put '[JSON] Text))))))))))
              :<|> (((("servers"
                       :> (Capture "server_id" Text
                           :> ("zones"
                               :> (Capture "zone_id" Text
                                   :> ("cryptokeys" :> Get '[JSON] [Cryptokey])))))
                      :<|> ("servers"
                            :> (Capture "server_id" Text
                                :> ("zones"
                                    :> (Capture "zone_id" Text
                                        :> ("cryptokeys"
                                            :> (ReqBody '[JSON] Cryptokey
                                                :> PostCreated '[JSON] Cryptokey)))))))
                     :<|> (("servers"
                            :> (Capture "server_id" Text
                                :> ("zones"
                                    :> (Capture "zone_id" Text
                                        :> ("cryptokeys"
                                            :> (Capture "cryptokey_id" Text
                                                :> Get '[JSON] Cryptokey))))))
                           :<|> (("servers"
                                  :> (Capture "server_id" Text
                                      :> ("zones"
                                          :> (Capture "zone_id" Text
                                              :> ("cryptokeys"
                                                  :> (Capture "cryptokey_id" Text
                                                      :> (ReqBody '[JSON] Cryptokey
                                                          :> PutNoContent)))))))
                                 :<|> ("servers"
                                       :> (Capture "server_id" Text
                                           :> ("zones"
                                               :> (Capture "zone_id" Text
                                                   :> ("cryptokeys"
                                                       :> (Capture "cryptokey_id" Text
                                                           :> DeleteNoContent)))))))))
                    :<|> (((("servers"
                             :> (Capture "server_id" Text
                                 :> ("zones"
                                     :> (Capture "zone_id" Text
                                         :> ("metadata" :> Get '[JSON] [Metadata])))))
                            :<|> ("servers"
                                  :> (Capture "server_id" Text
                                      :> ("zones"
                                          :> (Capture "zone_id" Text
                                              :> ("metadata"
                                                  :> (ReqBody '[JSON] Metadata
                                                      :> PostNoContent)))))))
                           :<|> (("servers"
                                  :> (Capture "server_id" Text
                                      :> ("zones"
                                          :> (Capture "zone_id" Text
                                              :> ("metadata"
                                                  :> (Capture "kind" Text
                                                      :> Get '[JSON] Metadata))))))
                                 :<|> (("servers"
                                        :> (Capture "server_id" Text
                                            :> ("zones"
                                                :> (Capture "zone_id" Text
                                                    :> ("metadata"
                                                        :> (Capture "kind" Text
                                                            :> (ReqBody '[JSON] Metadata
                                                                :> Put '[JSON] Metadata)))))))
                                       :<|> ("servers"
                                             :> (Capture "server_id" Text
                                                 :> ("zones"
                                                     :> (Capture "zone_id" Text
                                                         :> ("metadata"
                                                             :> (Capture "kind" Text
                                                                 :> DeleteNoContent)))))))))
                          :<|> ((("servers"
                                  :> (Capture "server_id" Text
                                      :> ("tsigkeys" :> Get '[JSON] [TSIGKey])))
                                 :<|> ("servers"
                                       :> (Capture "server_id" Text
                                           :> ("tsigkeys"
                                               :> (ReqBody '[JSON] TSIGKey
                                                   :> PostCreated '[JSON] TSIGKey)))))
                                :<|> (("servers"
                                       :> (Capture "server_id" Text
                                           :> ("tsigkeys"
                                               :> (Capture "tsigkey_id" Text
                                                   :> Get '[JSON] TSIGKey))))
                                      :<|> (("servers"
                                             :> (Capture "server_id" Text
                                                 :> ("tsigkeys"
                                                     :> (Capture "tsigkey_id" Text
                                                         :> (ReqBody '[JSON] TSIGKey
                                                             :> Put '[JSON] TSIGKey)))))
                                            :<|> ("servers"
                                                  :> (Capture "server_id" Text
                                                      :> ("tsigkeys"
                                                          :> (Capture "tsigkey_id" Text
                                                              :> DeleteNoContent))))))))))))
forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client Proxy
  ("api"
   :> ("v1"
       :> ((((("servers" :> Get '[JSON] [Server])
              :<|> ("servers"
                    :> (Capture "server_id" Text :> Get '[JSON] Server)))
             :<|> (("servers"
                    :> (Capture "server_id" Text
                        :> ("search-data"
                            :> (QueryParamReq "q" Text
                                :> (QueryParamReq "max" Integer
                                    :> (QueryParam "object_type" ObjectType
                                        :> Get '[JSON] [SearchResult]))))))
                   :<|> (("servers"
                          :> (Capture "server_id" Text
                              :> (QueryParamReq "domain" Text :> Put '[JSON] CacheFlushResult)))
                         :<|> ("servers"
                               :> (Capture "server_id" Text
                                   :> ("statistics"
                                       :> (QueryParam "statistic" Text
                                           :> (QueryParam "includerings" Bool
                                               :> Get '[JSON] [AnyStatisticItem]))))))))
            :<|> (((("servers"
                     :> (Capture "server_id" Text
                         :> ("zones"
                             :> (QueryParam "zone" Text
                                 :> (QueryParam "dnssec" Bool :> Get '[JSON] [Zone])))))
                    :<|> ("servers"
                          :> (Capture "server_id" Text
                              :> ("zones"
                                  :> (QueryParam "rrset" Bool
                                      :> (ReqBody '[JSON] Zone :> PostCreated '[JSON] Zone))))))
                   :<|> (("servers"
                          :> (Capture "server_id" Text
                              :> ("zones"
                                  :> (Capture "zone_id" Text
                                      :> (QueryParam "rrsets" Bool :> Get '[JSON] Zone)))))
                         :<|> (("servers"
                                :> (Capture "server_id" Text
                                    :> ("zones" :> (Capture "zone_id" Text :> DeleteNoContent))))
                               :<|> ("servers"
                                     :> (Capture "server_id" Text
                                         :> ("zones"
                                             :> (Capture "zone_id" Text
                                                 :> (ReqBody '[JSON] RRSets
                                                     :> PatchNoContent))))))))
                  :<|> ((("servers"
                          :> (Capture "server_id" Text
                              :> ("zones"
                                  :> (Capture "zone_id" Text
                                      :> (ReqBody '[JSON] Zone :> PutNoContent)))))
                         :<|> ("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("axfr-retrieve" :> Put '[JSON] NoContent))))))
                        :<|> (("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("notify" :> Put '[JSON] NoContent)))))
                              :<|> (("servers"
                                     :> (Capture "server_id" Text
                                         :> ("zones"
                                             :> (Capture "zone_id" Text
                                                 :> ("export" :> Get '[JSON] Text)))))
                                    :<|> ("servers"
                                          :> (Capture "server_id" Text
                                              :> ("zones"
                                                  :> (Capture "zone_id" Text
                                                      :> ("rectify" :> Put '[JSON] Text))))))))))
           :<|> (((("servers"
                    :> (Capture "server_id" Text
                        :> ("zones"
                            :> (Capture "zone_id" Text
                                :> ("cryptokeys" :> Get '[JSON] [Cryptokey])))))
                   :<|> ("servers"
                         :> (Capture "server_id" Text
                             :> ("zones"
                                 :> (Capture "zone_id" Text
                                     :> ("cryptokeys"
                                         :> (ReqBody '[JSON] Cryptokey
                                             :> PostCreated '[JSON] Cryptokey)))))))
                  :<|> (("servers"
                         :> (Capture "server_id" Text
                             :> ("zones"
                                 :> (Capture "zone_id" Text
                                     :> ("cryptokeys"
                                         :> (Capture "cryptokey_id" Text
                                             :> Get '[JSON] Cryptokey))))))
                        :<|> (("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("cryptokeys"
                                               :> (Capture "cryptokey_id" Text
                                                   :> (ReqBody '[JSON] Cryptokey
                                                       :> PutNoContent)))))))
                              :<|> ("servers"
                                    :> (Capture "server_id" Text
                                        :> ("zones"
                                            :> (Capture "zone_id" Text
                                                :> ("cryptokeys"
                                                    :> (Capture "cryptokey_id" Text
                                                        :> DeleteNoContent)))))))))
                 :<|> (((("servers"
                          :> (Capture "server_id" Text
                              :> ("zones"
                                  :> (Capture "zone_id" Text
                                      :> ("metadata" :> Get '[JSON] [Metadata])))))
                         :<|> ("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("metadata"
                                               :> (ReqBody '[JSON] Metadata :> PostNoContent)))))))
                        :<|> (("servers"
                               :> (Capture "server_id" Text
                                   :> ("zones"
                                       :> (Capture "zone_id" Text
                                           :> ("metadata"
                                               :> (Capture "kind" Text :> Get '[JSON] Metadata))))))
                              :<|> (("servers"
                                     :> (Capture "server_id" Text
                                         :> ("zones"
                                             :> (Capture "zone_id" Text
                                                 :> ("metadata"
                                                     :> (Capture "kind" Text
                                                         :> (ReqBody '[JSON] Metadata
                                                             :> Put '[JSON] Metadata)))))))
                                    :<|> ("servers"
                                          :> (Capture "server_id" Text
                                              :> ("zones"
                                                  :> (Capture "zone_id" Text
                                                      :> ("metadata"
                                                          :> (Capture "kind" Text
                                                              :> DeleteNoContent)))))))))
                       :<|> ((("servers"
                               :> (Capture "server_id" Text
                                   :> ("tsigkeys" :> Get '[JSON] [TSIGKey])))
                              :<|> ("servers"
                                    :> (Capture "server_id" Text
                                        :> ("tsigkeys"
                                            :> (ReqBody '[JSON] TSIGKey
                                                :> PostCreated '[JSON] TSIGKey)))))
                             :<|> (("servers"
                                    :> (Capture "server_id" Text
                                        :> ("tsigkeys"
                                            :> (Capture "tsigkey_id" Text :> Get '[JSON] TSIGKey))))
                                   :<|> (("servers"
                                          :> (Capture "server_id" Text
                                              :> ("tsigkeys"
                                                  :> (Capture "tsigkey_id" Text
                                                      :> (ReqBody '[JSON] TSIGKey
                                                          :> Put '[JSON] TSIGKey)))))
                                         :<|> ("servers"
                                               :> (Capture "server_id" Text
                                                   :> ("tsigkeys"
                                                       :> (Capture "tsigkey_id" Text
                                                           :> DeleteNoContent))))))))))))
Proxy API
api)

zonesClient :: ZonesAPI (AsClientT ClientM)
zonesClient :: ZonesAPI (AsClientT ClientM)
zonesClient = ToServant ZonesAPI (AsClientT ClientM)
-> ZonesAPI (AsClientT ClientM)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (PowerDNS (AsClientT ClientM)
-> AsClientT ClientM :- ToServantApi ZonesAPI
forall f. PowerDNS f -> f :- ToServantApi ZonesAPI
zones PowerDNS (AsClientT ClientM)
pdnsClient)

-- | List all zones for the server. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#get--servers-server_id-zones)
listZones :: T.Text       -- ^ Server name
          -> Maybe T.Text -- ^ Limit to zone
          -> Maybe Bool   -- ^ Whether or not to include dnssec and edited_serial fields
          -> ClientM [Zone]
listZones :: Text -> Maybe Text -> Maybe Bool -> ClientM [Zone]
listZones = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (QueryParam "zone" Text
                   :> (QueryParam "dnssec" Bool :> Get '[JSON] [Zone])))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (QueryParam "zone" Text
                   :> (QueryParam "dnssec" Bool :> Get '[JSON] [Zone])))))
apiListZones ZonesAPI (AsClientT ClientM)
zonesClient

-- | Create a new zone. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#post--servers-server_id-zones)
--
-- 'empty' with record update syntax is useful avoid having to specify Nothing
-- for unwanted fields.
createZone :: T.Text       -- ^ Server name
           -> Maybe Bool   -- ^ Whether or not to include RRsets in the response
           -> Zone         -- ^ The zone to create
           -> ClientM Zone
createZone :: Text -> Maybe Bool -> Zone -> ClientM Zone
createZone = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (QueryParam "rrset" Bool
                   :> (ReqBody '[JSON] Zone :> PostCreated '[JSON] Zone)))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (QueryParam "rrset" Bool
                   :> (ReqBody '[JSON] Zone :> PostCreated '[JSON] Zone)))))
apiCreateZone ZonesAPI (AsClientT ClientM)
zonesClient

-- | Get details for zone. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#get--servers-server_id-zones-zone_id)
getZone :: T.Text       -- ^ Server name
        -> T.Text       -- ^ Zone ID
        -> Maybe Bool   -- ^ Wheher or not to include RRsets in the response
        -> ClientM Zone
getZone :: Text -> Text -> Maybe Bool -> ClientM Zone
getZone = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> (QueryParam "rrsets" Bool :> Get '[JSON] Zone)))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> (QueryParam "rrsets" Bool :> Get '[JSON] Zone)))))
apiGetZone ZonesAPI (AsClientT ClientM)
zonesClient

-- | Delete a given zone by id. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#delete--servers-server_id-zones-zone_id)
deleteZone :: T.Text       -- ^ Server name
           -> T.Text       -- ^ Zone ID
           -> ClientM NoContent
deleteZone :: Text -> Text -> ClientM NoContent
deleteZone = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones" :> (Capture "zone_id" Text :> DeleteNoContent))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones" :> (Capture "zone_id" Text :> DeleteNoContent))))
apiDeleteZone ZonesAPI (AsClientT ClientM)
zonesClient

-- | Update records of a zone. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#patch--servers-server_id-zones-zone_id)
--
-- __Caution__: If rrset_records or rrset_comments is set to @Just []@ on a 'Delete' changetype,
-- this will delete all existing records or comments respectively for the domain.
updateRecords :: T.Text       -- ^ Server name
              -> T.Text       -- ^ Zone ID
              -> RRSets       -- ^ The RRsets to create, update or delete.
              -> ClientM NoContent
updateRecords :: Text -> Text -> RRSets -> ClientM NoContent
updateRecords = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> (ReqBody '[JSON] RRSets :> PatchNoContent)))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> (ReqBody '[JSON] RRSets :> PatchNoContent)))))
apiUpdateRecords ZonesAPI (AsClientT ClientM)
zonesClient

-- | Modify zone. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#put--servers-server_id-zones-zone_id)
--
-- 'empty' with record update syntax is useful avoid having to specify Nothing
-- for unwanted fields.
updateZone :: T.Text       -- ^ Server name
           -> T.Text       -- ^ Zone ID
           -> Zone         -- ^ Patch record. Fields with Just are changed, Nothing are ignored
           -> ClientM NoContent
updateZone :: Text -> Text -> Zone -> ClientM NoContent
updateZone = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> (ReqBody '[JSON] Zone :> PutNoContent)))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> (ReqBody '[JSON] Zone :> PutNoContent)))))
apiUpdateZone ZonesAPI (AsClientT ClientM)
zonesClient

-- | Trigger zone transfer on a slave. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#put--servers-server_id-zones-zone_id-axfr-retrieve)
triggerAxfr :: T.Text       -- ^ Server name
            -> T.Text       -- ^ Zone ID
            -> ClientM NoContent
triggerAxfr :: Text -> Text -> ClientM NoContent
triggerAxfr = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("axfr-retrieve" :> Put '[JSON] NoContent)))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("axfr-retrieve" :> Put '[JSON] NoContent)))))
apiTriggerAxfr ZonesAPI (AsClientT ClientM)
zonesClient

-- | Send DNS notify to slaves. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#put--servers-server_id-zones-zone_id-notify)
notifySlaves :: T.Text       -- ^ Server name
             -> T.Text       -- ^ Zone ID
             -> ClientM NoContent
notifySlaves :: Text -> Text -> ClientM NoContent
notifySlaves = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("notify" :> Put '[JSON] NoContent)))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("notify" :> Put '[JSON] NoContent)))))
apiNotifySlaves ZonesAPI (AsClientT ClientM)
zonesClient

-- | Return zone in AXFR format. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#get--servers-server_id-zones-zone_id-export)
getZoneAxfr :: T.Text         -- ^ Server name
            -> T.Text         -- ^ Zone ID
            -> ClientM T.Text -- ^ Zone in AXFR format
getZoneAxfr :: Text -> Text -> ClientM Text
getZoneAxfr = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text :> ("export" :> Get '[JSON] Text)))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text :> ("export" :> Get '[JSON] Text)))))
apiGetZoneAxfr ZonesAPI (AsClientT ClientM)
zonesClient

-- | Rectify the zone data. See [Zones API Documentation](https://doc.powerdns.com/authoritative/http-api/zone.html#put--servers-server_id-zones-zone_id-rectify)
rectifyZone :: T.Text       -- ^ Server name
            -> T.Text       -- ^ Zone ID
            -> ClientM T.Text
rectifyZone :: Text -> Text -> ClientM Text
rectifyZone = ZonesAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text :> ("rectify" :> Put '[JSON] Text)))))
forall f.
ZonesAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text :> ("rectify" :> Put '[JSON] Text)))))
apiRectifyZone ZonesAPI (AsClientT ClientM)
zonesClient

----------------------------------------------------------------------------------------

cryptokeysClient :: CryptokeysAPI (AsClientT ClientM)
cryptokeysClient :: CryptokeysAPI (AsClientT ClientM)
cryptokeysClient = ToServant CryptokeysAPI (AsClientT ClientM)
-> CryptokeysAPI (AsClientT ClientM)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (PowerDNS (AsClientT ClientM)
-> AsClientT ClientM :- ToServantApi CryptokeysAPI
forall f. PowerDNS f -> f :- ToServantApi CryptokeysAPI
cryptokeys PowerDNS (AsClientT ClientM)
pdnsClient)

-- | List all crypto keys. See [Cryptokeys API Documentation](https://doc.powerdns.com/authoritative/http-api/cryptokey.html#get--servers-server_id-zones-zone_id-cryptokeys)
listCryptoKeys :: T.Text -- ^ Server name
               -> T.Text -- ^ Zone ID
               -> ClientM [Cryptokey]
listCryptoKeys :: Text -> Text -> ClientM [Cryptokey]
listCryptoKeys = CryptokeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys" :> Get '[JSON] [Cryptokey])))))
forall f.
CryptokeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys" :> Get '[JSON] [Cryptokey])))))
apiListCryptokeys CryptokeysAPI (AsClientT ClientM)
cryptokeysClient

-- | Create a new crypto key. See [Cryptokeys API Documentation](https://doc.powerdns.com/authoritative/http-api/cryptokey.html#post--servers-server_id-zones-zone_id-cryptokeys)
createCryptokey :: T.Text            -- ^ Server name
                -> T.Text            -- ^ Zone ID
                -> Cryptokey         -- ^ Cryptokey to create
                -> ClientM Cryptokey -- ^ Created cryptokey
createCryptokey :: Text -> Text -> Cryptokey -> ClientM Cryptokey
createCryptokey = CryptokeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys"
                       :> (ReqBody '[JSON] Cryptokey
                           :> PostCreated '[JSON] Cryptokey))))))
forall f.
CryptokeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys"
                       :> (ReqBody '[JSON] Cryptokey
                           :> PostCreated '[JSON] Cryptokey))))))
apiCreateCryptokey CryptokeysAPI (AsClientT ClientM)
cryptokeysClient

-- | Get existing crypto key. See [Cryptokeys API Documentation](https://doc.powerdns.com/authoritative/http-api/cryptokey.html#post--servers-server_id-zones-zone_id-cryptokeys)
getCryptokey :: T.Text -- ^ Server name
             -> T.Text -- ^ Zone ID
             -> T.Text -- ^ Cryptokey ID
             -> ClientM Cryptokey
getCryptokey :: Text -> Text -> Text -> ClientM Cryptokey
getCryptokey = CryptokeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys"
                       :> (Capture "cryptokey_id" Text :> Get '[JSON] Cryptokey))))))
forall f.
CryptokeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys"
                       :> (Capture "cryptokey_id" Text :> Get '[JSON] Cryptokey))))))
apiGetCryptokey CryptokeysAPI (AsClientT ClientM)
cryptokeysClient

-- | Update existing crypto key. See [Cryptokeys API Documentation](https://doc.powerdns.com/authoritative/http-api/cryptokey.html#put--servers-server_id-zones-zone_id-cryptokeys-cryptokey_id)
updateCryptokey :: T.Text    -- ^ Server name
                -> T.Text    -- ^ Zone ID
                -> T.Text    -- ^ Cryptokey ID
                -> Cryptokey -- ^ Patch record. Fields with Just are changed, Nothing are ignored
                -> ClientM NoContent
updateCryptokey :: Text -> Text -> Text -> Cryptokey -> ClientM NoContent
updateCryptokey = CryptokeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys"
                       :> (Capture "cryptokey_id" Text
                           :> (ReqBody '[JSON] Cryptokey :> PutNoContent)))))))
forall f.
CryptokeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys"
                       :> (Capture "cryptokey_id" Text
                           :> (ReqBody '[JSON] Cryptokey :> PutNoContent)))))))
apiUpdateCryptokey CryptokeysAPI (AsClientT ClientM)
cryptokeysClient

-- | Delete existing crypto key. See [Cryptokeys API Documentation](https://doc.powerdns.com/authoritative/http-api/cryptokey.html#delete--servers-server_id-zones-zone_id-cryptokeys-cryptokey_id)
deleteCryptokey :: T.Text -- ^ Server name
                -> T.Text -- ^ Zone ID
                -> T.Text -- ^ Cryptokey ID
                -> ClientM NoContent
deleteCryptokey :: Text -> Text -> Text -> ClientM NoContent
deleteCryptokey = CryptokeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys"
                       :> (Capture "cryptokey_id" Text :> DeleteNoContent))))))
forall f.
CryptokeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("cryptokeys"
                       :> (Capture "cryptokey_id" Text :> DeleteNoContent))))))
apiDeleteCryptokey CryptokeysAPI (AsClientT ClientM)
cryptokeysClient

----------------------------------------------------------------------------------------
serversClient :: ServersAPI (AsClientT ClientM)
serversClient :: ServersAPI (AsClientT ClientM)
serversClient = ToServant ServersAPI (AsClientT ClientM)
-> ServersAPI (AsClientT ClientM)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (PowerDNS (AsClientT ClientM)
-> AsClientT ClientM :- ToServantApi ServersAPI
forall f. PowerDNS f -> f :- ToServantApi ServersAPI
servers PowerDNS (AsClientT ClientM)
pdnsClient)

-- | List available servers. See [Servers API Documentation](https://doc.powerdns.com/authoritative/http-api/server.html#get--servers)
listServers :: ClientM [Server]
listServers :: ClientM [Server]
listServers = ServersAPI (AsClientT ClientM)
-> AsClientT ClientM :- ("servers" :> Get '[JSON] [Server])
forall f. ServersAPI f -> f :- ("servers" :> Get '[JSON] [Server])
apiListServers ServersAPI (AsClientT ClientM)
serversClient

-- | Get existing server. See [Servers API Documentation](https://doc.powerdns.com/authoritative/http-api/server.html#get--servers-server_id)
getServer :: T.Text -- ^ Server ID
          -> ClientM Server
getServer :: Text -> ClientM Server
getServer = ServersAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers" :> (Capture "server_id" Text :> Get '[JSON] Server))
forall f.
ServersAPI f
-> f
   :- ("servers" :> (Capture "server_id" Text :> Get '[JSON] Server))
apiGetServer ServersAPI (AsClientT ClientM)
serversClient

-- | Searches in various object types for an arbitrary string. See [Search API Documentation](https://doc.powerdns.com/authoritative/http-api/search.html#get--servers-server_id-search-data)
search :: T.Text           -- ^ Server ID
       -> T.Text           -- ^ String to search for
       -> Integer          -- ^ Maximum number of results
       -> Maybe ObjectType -- ^ Limit results to specified object type, if any.
       -> ClientM [SearchResult]
search :: Text
-> Text -> Integer -> Maybe ObjectType -> ClientM [SearchResult]
search = ServersAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("search-data"
               :> (QueryParamReq "q" Text
                   :> (QueryParamReq "max" Integer
                       :> (QueryParam "object_type" ObjectType
                           :> Get '[JSON] [SearchResult]))))))
forall f.
ServersAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("search-data"
               :> (QueryParamReq "q" Text
                   :> (QueryParamReq "max" Integer
                       :> (QueryParam "object_type" ObjectType
                           :> Get '[JSON] [SearchResult]))))))
apiSearch ServersAPI (AsClientT ClientM)
serversClient

-- | Flushes a domain from the cache. See [Cache API Documentation](https://doc.powerdns.com/authoritative/http-api/cache.html#put--servers-server_id-cache-flush)
flushCache :: T.Text -- ^ Server ID
           -> T.Text -- ^ Domain
           -> ClientM CacheFlushResult
flushCache :: Text -> Text -> ClientM CacheFlushResult
flushCache = ServersAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> (QueryParamReq "domain" Text :> Put '[JSON] CacheFlushResult)))
forall f.
ServersAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> (QueryParamReq "domain" Text :> Put '[JSON] CacheFlushResult)))
apiFlushCache ServersAPI (AsClientT ClientM)
serversClient

-- | Get server wide statistics. See [Cache API Documentation](https://doc.powerdns.com/authoritative/http-api/statistics.html)
statistics :: T.Text       -- ^ Server ID
           -> Maybe T.Text -- ^ Only return statistic items with this name.
           -> Maybe Bool   -- ^ Whether or not to return ring items.
           -> ClientM [AnyStatisticItem]
statistics :: Text -> Maybe Text -> Maybe Bool -> ClientM [AnyStatisticItem]
statistics = ServersAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("statistics"
               :> (QueryParam "statistic" Text
                   :> (QueryParam "includerings" Bool
                       :> Get '[JSON] [AnyStatisticItem])))))
forall f.
ServersAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("statistics"
               :> (QueryParam "statistic" Text
                   :> (QueryParam "includerings" Bool
                       :> Get '[JSON] [AnyStatisticItem])))))
apiStatistics ServersAPI (AsClientT ClientM)
serversClient

----------------------------------------------------------------------------------------
metadataClient :: MetadataAPI (AsClientT ClientM)
metadataClient :: MetadataAPI (AsClientT ClientM)
metadataClient = ToServant MetadataAPI (AsClientT ClientM)
-> MetadataAPI (AsClientT ClientM)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (PowerDNS (AsClientT ClientM)
-> AsClientT ClientM :- ToServantApi MetadataAPI
forall f. PowerDNS f -> f :- ToServantApi MetadataAPI
metadata PowerDNS (AsClientT ClientM)
pdnsClient)

-- | List metadata for existing zone. See [Metadata API Documentation](https://doc.powerdns.com/authoritative/http-api/metadata.html#get--servers-server_id-zones-zone_id-metadata)
listMetadata :: T.Text -- ^ Server ID
             -> T.Text -- ^ Zone ID
             -> ClientM [Metadata]
listMetadata :: Text -> Text -> ClientM [Metadata]
listMetadata = MetadataAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata" :> Get '[JSON] [Metadata])))))
forall f.
MetadataAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata" :> Get '[JSON] [Metadata])))))
apiListMetadata MetadataAPI (AsClientT ClientM)
metadataClient

-- | Create metadata for zone. See [Metadata API Documentation](https://doc.powerdns.com/authoritative/http-api/metadata.html#post--servers-server_id-zones-zone_id-metadata)
createMetadata :: T.Text -- ^ Server ID
               -> T.Text -- ^ Zone ID
               -> Metadata
               -> ClientM NoContent
createMetadata :: Text -> Text -> Metadata -> ClientM NoContent
createMetadata = MetadataAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata" :> (ReqBody '[JSON] Metadata :> PostNoContent))))))
forall f.
MetadataAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata" :> (ReqBody '[JSON] Metadata :> PostNoContent))))))
apiCreateMetadata MetadataAPI (AsClientT ClientM)
metadataClient

-- | Get metadata for zone by kind. See [Metadata API Documentation](https://doc.powerdns.com/authoritative/http-api/metadata.html#get--servers-server_id-zones-zone_id-metadata-metadata_kind)
getMetadata :: T.Text -- ^ Server ID
            -> T.Text -- ^ Zone ID
            -> T.Text -- ^ Kind
            -> ClientM Metadata
getMetadata :: Text -> Text -> Text -> ClientM Metadata
getMetadata = MetadataAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata"
                       :> (Capture "kind" Text :> Get '[JSON] Metadata))))))
forall f.
MetadataAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata"
                       :> (Capture "kind" Text :> Get '[JSON] Metadata))))))
apiGetMetadata MetadataAPI (AsClientT ClientM)
metadataClient

-- | Update metadata for zone by kind. See [Metadata API Documentation](https://doc.powerdns.com/authoritative/http-api/metadata.html#put--servers-server_id-zones-zone_id-metadata-metadata_kind)
updateMetadata :: T.Text -- ^ Server ID
               -> T.Text -- ^ Zone ID
               -> T.Text -- ^ Kind
               -> Metadata
               -> ClientM Metadata
updateMetadata :: Text -> Text -> Text -> Metadata -> ClientM Metadata
updateMetadata = MetadataAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata"
                       :> (Capture "kind" Text
                           :> (ReqBody '[JSON] Metadata :> Put '[JSON] Metadata)))))))
forall f.
MetadataAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata"
                       :> (Capture "kind" Text
                           :> (ReqBody '[JSON] Metadata :> Put '[JSON] Metadata)))))))
apiUpdateMetadata MetadataAPI (AsClientT ClientM)
metadataClient

-- | Delete metadata for zone by kind. See [Metadata API Documentation](https://doc.powerdns.com/authoritative/http-api/metadata.html#delete--servers-server_id-zones-zone_id-metadata-metadata_kind)
deleteMetadata :: T.Text -- ^ Server ID
               -> T.Text -- ^ Zone ID
               -> T.Text -- ^ Kind
               -> ClientM NoContent
deleteMetadata :: Text -> Text -> Text -> ClientM NoContent
deleteMetadata = MetadataAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata" :> (Capture "kind" Text :> DeleteNoContent))))))
forall f.
MetadataAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("zones"
               :> (Capture "zone_id" Text
                   :> ("metadata" :> (Capture "kind" Text :> DeleteNoContent))))))
apiDeleteMetadata MetadataAPI (AsClientT ClientM)
metadataClient

----------------------------------------------------------------------------------------
tsigkeysClient :: TSIGKeysAPI (AsClientT ClientM)
tsigkeysClient :: TSIGKeysAPI (AsClientT ClientM)
tsigkeysClient = ToServant TSIGKeysAPI (AsClientT ClientM)
-> TSIGKeysAPI (AsClientT ClientM)
forall (routes :: * -> *) mode.
GenericServant routes mode =>
ToServant routes mode -> routes mode
fromServant (PowerDNS (AsClientT ClientM)
-> AsClientT ClientM :- ToServantApi TSIGKeysAPI
forall f. PowerDNS f -> f :- ToServantApi TSIGKeysAPI
tsigkeys PowerDNS (AsClientT ClientM)
pdnsClient)

-- | List all TSIG keys. See [TSIGKeys API Documentation](https://doc.powerdns.com/authoritative/http-api/tsigkey.html#get--servers-server_id-tsigkeys)
listTSIGKeys :: T.Text -> ClientM [TSIGKey]
listTSIGKeys :: Text -> ClientM [TSIGKey]
listTSIGKeys = TSIGKeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys" :> Get '[JSON] [TSIGKey])))
forall f.
TSIGKeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys" :> Get '[JSON] [TSIGKey])))
apiListTSIGKeys TSIGKeysAPI (AsClientT ClientM)
tsigkeysClient

-- | Create a new TSIG key. If the key is left empty, the server will generate one. See [TSIGKeys API Documentation](https://doc.powerdns.com/authoritative/http-api/tsigkey.html#post--servers-server_id-tsigkeys)
createTSIGKey :: T.Text -> TSIGKey -> ClientM TSIGKey
createTSIGKey :: Text -> TSIGKey -> ClientM TSIGKey
createTSIGKey = TSIGKeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys"
               :> (ReqBody '[JSON] TSIGKey :> PostCreated '[JSON] TSIGKey))))
forall f.
TSIGKeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys"
               :> (ReqBody '[JSON] TSIGKey :> PostCreated '[JSON] TSIGKey))))
apiCreateTSIGKey TSIGKeysAPI (AsClientT ClientM)
tsigkeysClient

-- | Get TSIG key by its id. See [TSIGKeys API Documentation](https://doc.powerdns.com/authoritative/http-api/tsigkey.html#get--servers-server_id-tsigkeys-tsigkey_id)
getTSIGKey :: T.Text -> T.Text -> ClientM TSIGKey
getTSIGKey :: Text -> Text -> ClientM TSIGKey
getTSIGKey = TSIGKeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys"
               :> (Capture "tsigkey_id" Text :> Get '[JSON] TSIGKey))))
forall f.
TSIGKeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys"
               :> (Capture "tsigkey_id" Text :> Get '[JSON] TSIGKey))))
apiGetTSIGKey TSIGKeysAPI (AsClientT ClientM)
tsigkeysClient

-- | Update existig TSIG key. See [TSIGKeys API Documentation](https://doc.powerdns.com/authoritative/http-api/tsigkey.html#put--servers-server_id-tsigkeys-tsigkey_id)
updateTSIGKey :: T.Text -> T.Text -> TSIGKey -> ClientM TSIGKey
updateTSIGKey :: Text -> Text -> TSIGKey -> ClientM TSIGKey
updateTSIGKey = TSIGKeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys"
               :> (Capture "tsigkey_id" Text
                   :> (ReqBody '[JSON] TSIGKey :> Put '[JSON] TSIGKey)))))
forall f.
TSIGKeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys"
               :> (Capture "tsigkey_id" Text
                   :> (ReqBody '[JSON] TSIGKey :> Put '[JSON] TSIGKey)))))
apiUpdateTSIGKey TSIGKeysAPI (AsClientT ClientM)
tsigkeysClient

-- | Delete existing TSIG key. See [TSIGKeys API Documentation](https://doc.powerdns.com/authoritative/http-api/tsigkey.html#delete--servers-server_id-tsigkeys-tsigkey_id)
deleteTSIGKey :: T.Text -> T.Text -> ClientM NoContent
deleteTSIGKey :: Text -> Text -> ClientM NoContent
deleteTSIGKey = TSIGKeysAPI (AsClientT ClientM)
-> AsClientT ClientM
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys" :> (Capture "tsigkey_id" Text :> DeleteNoContent))))
forall f.
TSIGKeysAPI f
-> f
   :- ("servers"
       :> (Capture "server_id" Text
           :> ("tsigkeys" :> (Capture "tsigkey_id" Text :> DeleteNoContent))))
apiDeleteTSIGKey TSIGKeysAPI (AsClientT ClientM)
tsigkeysClient

----------------------------------------------------------------------------------------