{-# 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.EC2.Types.DnsServersOptionsModifyStructure
-- 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.EC2.Types.DnsServersOptionsModifyStructure where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import qualified Amazonka.Prelude as Prelude

-- | Information about the DNS server to be used.
--
-- /See:/ 'newDnsServersOptionsModifyStructure' smart constructor.
data DnsServersOptionsModifyStructure = DnsServersOptionsModifyStructure'
  { -- | The IPv4 address range, in CIDR notation, of the DNS servers to be used.
    -- You can specify up to two DNS servers. Ensure that the DNS servers can
    -- be reached by the clients. The specified values overwrite the existing
    -- values.
    DnsServersOptionsModifyStructure -> Maybe [Text]
customDnsServers :: Prelude.Maybe [Prelude.Text],
    -- | Indicates whether DNS servers should be used. Specify @False@ to delete
    -- the existing DNS servers.
    DnsServersOptionsModifyStructure -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (DnsServersOptionsModifyStructure
-> DnsServersOptionsModifyStructure -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DnsServersOptionsModifyStructure
-> DnsServersOptionsModifyStructure -> Bool
$c/= :: DnsServersOptionsModifyStructure
-> DnsServersOptionsModifyStructure -> Bool
== :: DnsServersOptionsModifyStructure
-> DnsServersOptionsModifyStructure -> Bool
$c== :: DnsServersOptionsModifyStructure
-> DnsServersOptionsModifyStructure -> Bool
Prelude.Eq, ReadPrec [DnsServersOptionsModifyStructure]
ReadPrec DnsServersOptionsModifyStructure
Int -> ReadS DnsServersOptionsModifyStructure
ReadS [DnsServersOptionsModifyStructure]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DnsServersOptionsModifyStructure]
$creadListPrec :: ReadPrec [DnsServersOptionsModifyStructure]
readPrec :: ReadPrec DnsServersOptionsModifyStructure
$creadPrec :: ReadPrec DnsServersOptionsModifyStructure
readList :: ReadS [DnsServersOptionsModifyStructure]
$creadList :: ReadS [DnsServersOptionsModifyStructure]
readsPrec :: Int -> ReadS DnsServersOptionsModifyStructure
$creadsPrec :: Int -> ReadS DnsServersOptionsModifyStructure
Prelude.Read, Int -> DnsServersOptionsModifyStructure -> ShowS
[DnsServersOptionsModifyStructure] -> ShowS
DnsServersOptionsModifyStructure -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DnsServersOptionsModifyStructure] -> ShowS
$cshowList :: [DnsServersOptionsModifyStructure] -> ShowS
show :: DnsServersOptionsModifyStructure -> String
$cshow :: DnsServersOptionsModifyStructure -> String
showsPrec :: Int -> DnsServersOptionsModifyStructure -> ShowS
$cshowsPrec :: Int -> DnsServersOptionsModifyStructure -> ShowS
Prelude.Show, forall x.
Rep DnsServersOptionsModifyStructure x
-> DnsServersOptionsModifyStructure
forall x.
DnsServersOptionsModifyStructure
-> Rep DnsServersOptionsModifyStructure x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DnsServersOptionsModifyStructure x
-> DnsServersOptionsModifyStructure
$cfrom :: forall x.
DnsServersOptionsModifyStructure
-> Rep DnsServersOptionsModifyStructure x
Prelude.Generic)

-- |
-- Create a value of 'DnsServersOptionsModifyStructure' 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:
--
-- 'customDnsServers', 'dnsServersOptionsModifyStructure_customDnsServers' - The IPv4 address range, in CIDR notation, of the DNS servers to be used.
-- You can specify up to two DNS servers. Ensure that the DNS servers can
-- be reached by the clients. The specified values overwrite the existing
-- values.
--
-- 'enabled', 'dnsServersOptionsModifyStructure_enabled' - Indicates whether DNS servers should be used. Specify @False@ to delete
-- the existing DNS servers.
newDnsServersOptionsModifyStructure ::
  DnsServersOptionsModifyStructure
newDnsServersOptionsModifyStructure :: DnsServersOptionsModifyStructure
newDnsServersOptionsModifyStructure =
  DnsServersOptionsModifyStructure'
    { $sel:customDnsServers:DnsServersOptionsModifyStructure' :: Maybe [Text]
customDnsServers =
        forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:DnsServersOptionsModifyStructure' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing
    }

-- | The IPv4 address range, in CIDR notation, of the DNS servers to be used.
-- You can specify up to two DNS servers. Ensure that the DNS servers can
-- be reached by the clients. The specified values overwrite the existing
-- values.
dnsServersOptionsModifyStructure_customDnsServers :: Lens.Lens' DnsServersOptionsModifyStructure (Prelude.Maybe [Prelude.Text])
dnsServersOptionsModifyStructure_customDnsServers :: Lens' DnsServersOptionsModifyStructure (Maybe [Text])
dnsServersOptionsModifyStructure_customDnsServers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsServersOptionsModifyStructure' {Maybe [Text]
customDnsServers :: Maybe [Text]
$sel:customDnsServers:DnsServersOptionsModifyStructure' :: DnsServersOptionsModifyStructure -> Maybe [Text]
customDnsServers} -> Maybe [Text]
customDnsServers) (\s :: DnsServersOptionsModifyStructure
s@DnsServersOptionsModifyStructure' {} Maybe [Text]
a -> DnsServersOptionsModifyStructure
s {$sel:customDnsServers:DnsServersOptionsModifyStructure' :: Maybe [Text]
customDnsServers = Maybe [Text]
a} :: DnsServersOptionsModifyStructure) 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

-- | Indicates whether DNS servers should be used. Specify @False@ to delete
-- the existing DNS servers.
dnsServersOptionsModifyStructure_enabled :: Lens.Lens' DnsServersOptionsModifyStructure (Prelude.Maybe Prelude.Bool)
dnsServersOptionsModifyStructure_enabled :: Lens' DnsServersOptionsModifyStructure (Maybe Bool)
dnsServersOptionsModifyStructure_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsServersOptionsModifyStructure' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:DnsServersOptionsModifyStructure' :: DnsServersOptionsModifyStructure -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: DnsServersOptionsModifyStructure
s@DnsServersOptionsModifyStructure' {} Maybe Bool
a -> DnsServersOptionsModifyStructure
s {$sel:enabled:DnsServersOptionsModifyStructure' :: Maybe Bool
enabled = Maybe Bool
a} :: DnsServersOptionsModifyStructure)

instance
  Prelude.Hashable
    DnsServersOptionsModifyStructure
  where
  hashWithSalt :: Int -> DnsServersOptionsModifyStructure -> Int
hashWithSalt
    Int
_salt
    DnsServersOptionsModifyStructure' {Maybe Bool
Maybe [Text]
enabled :: Maybe Bool
customDnsServers :: Maybe [Text]
$sel:enabled:DnsServersOptionsModifyStructure' :: DnsServersOptionsModifyStructure -> Maybe Bool
$sel:customDnsServers:DnsServersOptionsModifyStructure' :: DnsServersOptionsModifyStructure -> Maybe [Text]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
customDnsServers
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled

instance
  Prelude.NFData
    DnsServersOptionsModifyStructure
  where
  rnf :: DnsServersOptionsModifyStructure -> ()
rnf DnsServersOptionsModifyStructure' {Maybe Bool
Maybe [Text]
enabled :: Maybe Bool
customDnsServers :: Maybe [Text]
$sel:enabled:DnsServersOptionsModifyStructure' :: DnsServersOptionsModifyStructure -> Maybe Bool
$sel:customDnsServers:DnsServersOptionsModifyStructure' :: DnsServersOptionsModifyStructure -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
customDnsServers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled

instance
  Data.ToQuery
    DnsServersOptionsModifyStructure
  where
  toQuery :: DnsServersOptionsModifyStructure -> QueryString
toQuery DnsServersOptionsModifyStructure' {Maybe Bool
Maybe [Text]
enabled :: Maybe Bool
customDnsServers :: Maybe [Text]
$sel:enabled:DnsServersOptionsModifyStructure' :: DnsServersOptionsModifyStructure -> Maybe Bool
$sel:customDnsServers:DnsServersOptionsModifyStructure' :: DnsServersOptionsModifyStructure -> Maybe [Text]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"CustomDnsServers"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
customDnsServers
          ),
        ByteString
"Enabled" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
enabled
      ]