{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53AutoNaming.Types.DnsProperties where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DnsProperties -> DnsProperties -> Bool)
-> (DnsProperties -> DnsProperties -> Bool) -> Eq DnsProperties
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]
(Int -> ReadS DnsProperties)
-> ReadS [DnsProperties]
-> ReadPrec DnsProperties
-> ReadPrec [DnsProperties]
-> Read 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
(Int -> DnsProperties -> ShowS)
-> (DnsProperties -> String)
-> ([DnsProperties] -> ShowS)
-> Show DnsProperties
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. DnsProperties -> Rep DnsProperties x)
-> (forall x. Rep DnsProperties x -> DnsProperties)
-> Generic DnsProperties
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' :: Maybe Text -> Maybe SOA -> DnsProperties
DnsProperties'
    { $sel:hostedZoneId:DnsProperties' :: Maybe Text
hostedZoneId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:soa:DnsProperties' :: Maybe SOA
soa = Maybe 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 :: (Maybe Text -> f (Maybe Text)) -> DnsProperties -> f DnsProperties
dnsProperties_hostedZoneId = (DnsProperties -> Maybe Text)
-> (DnsProperties -> Maybe Text -> DnsProperties)
-> Lens DnsProperties DnsProperties (Maybe Text) (Maybe Text)
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 :: (Maybe SOA -> f (Maybe SOA)) -> DnsProperties -> f DnsProperties
dnsProperties_soa = (DnsProperties -> Maybe SOA)
-> (DnsProperties -> Maybe SOA -> DnsProperties)
-> Lens DnsProperties DnsProperties (Maybe SOA) (Maybe 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 Core.FromJSON DnsProperties where
  parseJSON :: Value -> Parser DnsProperties
parseJSON =
    String
-> (Object -> Parser DnsProperties)
-> Value
-> Parser DnsProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DnsProperties"
      ( \Object
x ->
          Maybe Text -> Maybe SOA -> DnsProperties
DnsProperties'
            (Maybe Text -> Maybe SOA -> DnsProperties)
-> Parser (Maybe Text) -> Parser (Maybe SOA -> DnsProperties)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HostedZoneId")
            Parser (Maybe SOA -> DnsProperties)
-> Parser (Maybe SOA) -> Parser DnsProperties
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SOA)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SOA")
      )

instance Prelude.Hashable DnsProperties

instance Prelude.NFData DnsProperties