{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53AutoNaming.Types.DnsProperties
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53AutoNaming.Types.DnsProperties where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53AutoNaming.Types.SOA

-- | A complex type that contains the ID for the Route 53 hosted zone that
-- Cloud Map creates when you create a namespace.
--
-- /See:/ 'newDnsProperties' smart constructor.
data DnsProperties = DnsProperties'
  { -- | The ID for the Route 53 hosted zone that Cloud Map creates when you
    -- create a namespace.
    DnsProperties -> Maybe Text
hostedZoneId :: Prelude.Maybe Prelude.Text,
    -- | Start of Authority (SOA) record for the hosted zone.
    DnsProperties -> Maybe SOA
soa :: Prelude.Maybe SOA
  }
  deriving (DnsProperties -> DnsProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DnsProperties -> DnsProperties -> Bool
$c/= :: DnsProperties -> DnsProperties -> Bool
== :: DnsProperties -> DnsProperties -> Bool
$c== :: DnsProperties -> DnsProperties -> Bool
Prelude.Eq, ReadPrec [DnsProperties]
ReadPrec DnsProperties
Int -> ReadS DnsProperties
ReadS [DnsProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DnsProperties]
$creadListPrec :: ReadPrec [DnsProperties]
readPrec :: ReadPrec DnsProperties
$creadPrec :: ReadPrec DnsProperties
readList :: ReadS [DnsProperties]
$creadList :: ReadS [DnsProperties]
readsPrec :: Int -> ReadS DnsProperties
$creadsPrec :: Int -> ReadS DnsProperties
Prelude.Read, Int -> DnsProperties -> ShowS
[DnsProperties] -> ShowS
DnsProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DnsProperties] -> ShowS
$cshowList :: [DnsProperties] -> ShowS
show :: DnsProperties -> String
$cshow :: DnsProperties -> String
showsPrec :: Int -> DnsProperties -> ShowS
$cshowsPrec :: Int -> DnsProperties -> ShowS
Prelude.Show, forall x. Rep DnsProperties x -> DnsProperties
forall x. DnsProperties -> Rep DnsProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DnsProperties x -> DnsProperties
$cfrom :: forall x. DnsProperties -> Rep DnsProperties x
Prelude.Generic)

-- |
-- Create a value of 'DnsProperties' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'hostedZoneId', 'dnsProperties_hostedZoneId' - The ID for the Route 53 hosted zone that Cloud Map creates when you
-- create a namespace.
--
-- 'soa', 'dnsProperties_soa' - Start of Authority (SOA) record for the hosted zone.
newDnsProperties ::
  DnsProperties
newDnsProperties :: DnsProperties
newDnsProperties =
  DnsProperties'
    { $sel:hostedZoneId:DnsProperties' :: Maybe Text
hostedZoneId = forall a. Maybe a
Prelude.Nothing,
      $sel:soa:DnsProperties' :: Maybe SOA
soa = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID for the Route 53 hosted zone that Cloud Map creates when you
-- create a namespace.
dnsProperties_hostedZoneId :: Lens.Lens' DnsProperties (Prelude.Maybe Prelude.Text)
dnsProperties_hostedZoneId :: Lens' DnsProperties (Maybe Text)
dnsProperties_hostedZoneId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsProperties' {Maybe Text
hostedZoneId :: Maybe Text
$sel:hostedZoneId:DnsProperties' :: DnsProperties -> Maybe Text
hostedZoneId} -> Maybe Text
hostedZoneId) (\s :: DnsProperties
s@DnsProperties' {} Maybe Text
a -> DnsProperties
s {$sel:hostedZoneId:DnsProperties' :: Maybe Text
hostedZoneId = Maybe Text
a} :: DnsProperties)

-- | Start of Authority (SOA) record for the hosted zone.
dnsProperties_soa :: Lens.Lens' DnsProperties (Prelude.Maybe SOA)
dnsProperties_soa :: Lens' DnsProperties (Maybe SOA)
dnsProperties_soa = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsProperties' {Maybe SOA
soa :: Maybe SOA
$sel:soa:DnsProperties' :: DnsProperties -> Maybe SOA
soa} -> Maybe SOA
soa) (\s :: DnsProperties
s@DnsProperties' {} Maybe SOA
a -> DnsProperties
s {$sel:soa:DnsProperties' :: Maybe SOA
soa = Maybe SOA
a} :: DnsProperties)

instance Data.FromJSON DnsProperties where
  parseJSON :: Value -> Parser DnsProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DnsProperties"
      ( \Object
x ->
          Maybe Text -> Maybe SOA -> DnsProperties
DnsProperties'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"HostedZoneId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SOA")
      )

instance Prelude.Hashable DnsProperties where
  hashWithSalt :: Int -> DnsProperties -> Int
hashWithSalt Int
_salt DnsProperties' {Maybe Text
Maybe SOA
soa :: Maybe SOA
hostedZoneId :: Maybe Text
$sel:soa:DnsProperties' :: DnsProperties -> Maybe SOA
$sel:hostedZoneId:DnsProperties' :: DnsProperties -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hostedZoneId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SOA
soa

instance Prelude.NFData DnsProperties where
  rnf :: DnsProperties -> ()
rnf DnsProperties' {Maybe Text
Maybe SOA
soa :: Maybe SOA
hostedZoneId :: Maybe Text
$sel:soa:DnsProperties' :: DnsProperties -> Maybe SOA
$sel:hostedZoneId:DnsProperties' :: DnsProperties -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hostedZoneId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SOA
soa