DNSZone now relates to the actual DNSZone on dnsmanagerd.

This commit is contained in:
Philippe Pittoli 2023-07-10 03:58:26 +02:00
parent 1870c5df50
commit b89eae5a82

View File

@ -1,18 +1,30 @@
module App.DNSZone where
import Prelude
import Data.Maybe (Maybe)
import Data.Codec.Argonaut (JsonCodec)
import Data.Codec.Argonaut as CA
import Data.Newtype (class Newtype)
import Data.Profunctor (wrapIso)
import Data.Codec.Argonaut.Record as CAR
import App.ResourceRecord as RR
newtype DNSZone = DNSZone String
type DNSZone
= { domain :: String
derive instance newtypeDNSZone :: Newtype DNSZone _
derive instance eqDNSZone :: Eq DNSZone
derive instance ordDNSZone :: Ord DNSZone
-- List of all the zone's resource records.
, resources :: Array RR.ResourceRecord
-- Each resource record has a number, this is the ID to give to a new RR.
, current_rrid :: Int
-- Minimum TTL accepted for a resource record.
, ttl_limit_min :: Int
}
-- | DNSZone.codec can be used to parse and encode email addresses.
codec :: JsonCodec DNSZone
codec = wrapIso DNSZone CA.string
codec = CA.object "DNSZone"
(CAR.record
{ domain: CA.string
, resources: CA.array RR.codec
, current_rrid: CA.int
, ttl_limit_min: CA.int
})