{-# 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.DirectoryService.Types.ConditionalForwarder
-- 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.DirectoryService.Types.ConditionalForwarder where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectoryService.Types.ReplicationScope
import qualified Amazonka.Prelude as Prelude

-- | Points to a remote domain with which you are setting up a trust
-- relationship. Conditional forwarders are required in order to set up a
-- trust relationship with another domain.
--
-- /See:/ 'newConditionalForwarder' smart constructor.
data ConditionalForwarder = ConditionalForwarder'
  { -- | The IP addresses of the remote DNS server associated with
    -- RemoteDomainName. This is the IP address of the DNS server that your
    -- conditional forwarder points to.
    ConditionalForwarder -> Maybe [Text]
dnsIpAddrs :: Prelude.Maybe [Prelude.Text],
    -- | The fully qualified domain name (FQDN) of the remote domains pointed to
    -- by the conditional forwarder.
    ConditionalForwarder -> Maybe Text
remoteDomainName :: Prelude.Maybe Prelude.Text,
    -- | The replication scope of the conditional forwarder. The only allowed
    -- value is @Domain@, which will replicate the conditional forwarder to all
    -- of the domain controllers for your Amazon Web Services directory.
    ConditionalForwarder -> Maybe ReplicationScope
replicationScope :: Prelude.Maybe ReplicationScope
  }
  deriving (ConditionalForwarder -> ConditionalForwarder -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConditionalForwarder -> ConditionalForwarder -> Bool
$c/= :: ConditionalForwarder -> ConditionalForwarder -> Bool
== :: ConditionalForwarder -> ConditionalForwarder -> Bool
$c== :: ConditionalForwarder -> ConditionalForwarder -> Bool
Prelude.Eq, ReadPrec [ConditionalForwarder]
ReadPrec ConditionalForwarder
Int -> ReadS ConditionalForwarder
ReadS [ConditionalForwarder]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConditionalForwarder]
$creadListPrec :: ReadPrec [ConditionalForwarder]
readPrec :: ReadPrec ConditionalForwarder
$creadPrec :: ReadPrec ConditionalForwarder
readList :: ReadS [ConditionalForwarder]
$creadList :: ReadS [ConditionalForwarder]
readsPrec :: Int -> ReadS ConditionalForwarder
$creadsPrec :: Int -> ReadS ConditionalForwarder
Prelude.Read, Int -> ConditionalForwarder -> ShowS
[ConditionalForwarder] -> ShowS
ConditionalForwarder -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConditionalForwarder] -> ShowS
$cshowList :: [ConditionalForwarder] -> ShowS
show :: ConditionalForwarder -> String
$cshow :: ConditionalForwarder -> String
showsPrec :: Int -> ConditionalForwarder -> ShowS
$cshowsPrec :: Int -> ConditionalForwarder -> ShowS
Prelude.Show, forall x. Rep ConditionalForwarder x -> ConditionalForwarder
forall x. ConditionalForwarder -> Rep ConditionalForwarder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConditionalForwarder x -> ConditionalForwarder
$cfrom :: forall x. ConditionalForwarder -> Rep ConditionalForwarder x
Prelude.Generic)

-- |
-- Create a value of 'ConditionalForwarder' 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:
--
-- 'dnsIpAddrs', 'conditionalForwarder_dnsIpAddrs' - The IP addresses of the remote DNS server associated with
-- RemoteDomainName. This is the IP address of the DNS server that your
-- conditional forwarder points to.
--
-- 'remoteDomainName', 'conditionalForwarder_remoteDomainName' - The fully qualified domain name (FQDN) of the remote domains pointed to
-- by the conditional forwarder.
--
-- 'replicationScope', 'conditionalForwarder_replicationScope' - The replication scope of the conditional forwarder. The only allowed
-- value is @Domain@, which will replicate the conditional forwarder to all
-- of the domain controllers for your Amazon Web Services directory.
newConditionalForwarder ::
  ConditionalForwarder
newConditionalForwarder :: ConditionalForwarder
newConditionalForwarder =
  ConditionalForwarder'
    { $sel:dnsIpAddrs:ConditionalForwarder' :: Maybe [Text]
dnsIpAddrs = forall a. Maybe a
Prelude.Nothing,
      $sel:remoteDomainName:ConditionalForwarder' :: Maybe Text
remoteDomainName = forall a. Maybe a
Prelude.Nothing,
      $sel:replicationScope:ConditionalForwarder' :: Maybe ReplicationScope
replicationScope = forall a. Maybe a
Prelude.Nothing
    }

-- | The IP addresses of the remote DNS server associated with
-- RemoteDomainName. This is the IP address of the DNS server that your
-- conditional forwarder points to.
conditionalForwarder_dnsIpAddrs :: Lens.Lens' ConditionalForwarder (Prelude.Maybe [Prelude.Text])
conditionalForwarder_dnsIpAddrs :: Lens' ConditionalForwarder (Maybe [Text])
conditionalForwarder_dnsIpAddrs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionalForwarder' {Maybe [Text]
dnsIpAddrs :: Maybe [Text]
$sel:dnsIpAddrs:ConditionalForwarder' :: ConditionalForwarder -> Maybe [Text]
dnsIpAddrs} -> Maybe [Text]
dnsIpAddrs) (\s :: ConditionalForwarder
s@ConditionalForwarder' {} Maybe [Text]
a -> ConditionalForwarder
s {$sel:dnsIpAddrs:ConditionalForwarder' :: Maybe [Text]
dnsIpAddrs = Maybe [Text]
a} :: ConditionalForwarder) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The fully qualified domain name (FQDN) of the remote domains pointed to
-- by the conditional forwarder.
conditionalForwarder_remoteDomainName :: Lens.Lens' ConditionalForwarder (Prelude.Maybe Prelude.Text)
conditionalForwarder_remoteDomainName :: Lens' ConditionalForwarder (Maybe Text)
conditionalForwarder_remoteDomainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionalForwarder' {Maybe Text
remoteDomainName :: Maybe Text
$sel:remoteDomainName:ConditionalForwarder' :: ConditionalForwarder -> Maybe Text
remoteDomainName} -> Maybe Text
remoteDomainName) (\s :: ConditionalForwarder
s@ConditionalForwarder' {} Maybe Text
a -> ConditionalForwarder
s {$sel:remoteDomainName:ConditionalForwarder' :: Maybe Text
remoteDomainName = Maybe Text
a} :: ConditionalForwarder)

-- | The replication scope of the conditional forwarder. The only allowed
-- value is @Domain@, which will replicate the conditional forwarder to all
-- of the domain controllers for your Amazon Web Services directory.
conditionalForwarder_replicationScope :: Lens.Lens' ConditionalForwarder (Prelude.Maybe ReplicationScope)
conditionalForwarder_replicationScope :: Lens' ConditionalForwarder (Maybe ReplicationScope)
conditionalForwarder_replicationScope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConditionalForwarder' {Maybe ReplicationScope
replicationScope :: Maybe ReplicationScope
$sel:replicationScope:ConditionalForwarder' :: ConditionalForwarder -> Maybe ReplicationScope
replicationScope} -> Maybe ReplicationScope
replicationScope) (\s :: ConditionalForwarder
s@ConditionalForwarder' {} Maybe ReplicationScope
a -> ConditionalForwarder
s {$sel:replicationScope:ConditionalForwarder' :: Maybe ReplicationScope
replicationScope = Maybe ReplicationScope
a} :: ConditionalForwarder)

instance Data.FromJSON ConditionalForwarder where
  parseJSON :: Value -> Parser ConditionalForwarder
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConditionalForwarder"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text -> Maybe ReplicationScope -> ConditionalForwarder
ConditionalForwarder'
            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
"DnsIpAddrs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"RemoteDomainName")
            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
"ReplicationScope")
      )

instance Prelude.Hashable ConditionalForwarder where
  hashWithSalt :: Int -> ConditionalForwarder -> Int
hashWithSalt Int
_salt ConditionalForwarder' {Maybe [Text]
Maybe Text
Maybe ReplicationScope
replicationScope :: Maybe ReplicationScope
remoteDomainName :: Maybe Text
dnsIpAddrs :: Maybe [Text]
$sel:replicationScope:ConditionalForwarder' :: ConditionalForwarder -> Maybe ReplicationScope
$sel:remoteDomainName:ConditionalForwarder' :: ConditionalForwarder -> Maybe Text
$sel:dnsIpAddrs:ConditionalForwarder' :: ConditionalForwarder -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
dnsIpAddrs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
remoteDomainName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReplicationScope
replicationScope

instance Prelude.NFData ConditionalForwarder where
  rnf :: ConditionalForwarder -> ()
rnf ConditionalForwarder' {Maybe [Text]
Maybe Text
Maybe ReplicationScope
replicationScope :: Maybe ReplicationScope
remoteDomainName :: Maybe Text
dnsIpAddrs :: Maybe [Text]
$sel:replicationScope:ConditionalForwarder' :: ConditionalForwarder -> Maybe ReplicationScope
$sel:remoteDomainName:ConditionalForwarder' :: ConditionalForwarder -> Maybe Text
$sel:dnsIpAddrs:ConditionalForwarder' :: ConditionalForwarder -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
dnsIpAddrs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
remoteDomainName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReplicationScope
replicationScope