{-# 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.GuardDuty.Types.DnsRequestAction
-- 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.GuardDuty.Types.DnsRequestAction where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the DNS_REQUEST action described in this
-- finding.
--
-- /See:/ 'newDnsRequestAction' smart constructor.
data DnsRequestAction = DnsRequestAction'
  { -- | The domain information for the API request.
    DnsRequestAction -> Maybe Text
domain :: Prelude.Maybe Prelude.Text
  }
  deriving (DnsRequestAction -> DnsRequestAction -> Bool
(DnsRequestAction -> DnsRequestAction -> Bool)
-> (DnsRequestAction -> DnsRequestAction -> Bool)
-> Eq DnsRequestAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DnsRequestAction -> DnsRequestAction -> Bool
$c/= :: DnsRequestAction -> DnsRequestAction -> Bool
== :: DnsRequestAction -> DnsRequestAction -> Bool
$c== :: DnsRequestAction -> DnsRequestAction -> Bool
Prelude.Eq, ReadPrec [DnsRequestAction]
ReadPrec DnsRequestAction
Int -> ReadS DnsRequestAction
ReadS [DnsRequestAction]
(Int -> ReadS DnsRequestAction)
-> ReadS [DnsRequestAction]
-> ReadPrec DnsRequestAction
-> ReadPrec [DnsRequestAction]
-> Read DnsRequestAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DnsRequestAction]
$creadListPrec :: ReadPrec [DnsRequestAction]
readPrec :: ReadPrec DnsRequestAction
$creadPrec :: ReadPrec DnsRequestAction
readList :: ReadS [DnsRequestAction]
$creadList :: ReadS [DnsRequestAction]
readsPrec :: Int -> ReadS DnsRequestAction
$creadsPrec :: Int -> ReadS DnsRequestAction
Prelude.Read, Int -> DnsRequestAction -> ShowS
[DnsRequestAction] -> ShowS
DnsRequestAction -> String
(Int -> DnsRequestAction -> ShowS)
-> (DnsRequestAction -> String)
-> ([DnsRequestAction] -> ShowS)
-> Show DnsRequestAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DnsRequestAction] -> ShowS
$cshowList :: [DnsRequestAction] -> ShowS
show :: DnsRequestAction -> String
$cshow :: DnsRequestAction -> String
showsPrec :: Int -> DnsRequestAction -> ShowS
$cshowsPrec :: Int -> DnsRequestAction -> ShowS
Prelude.Show, (forall x. DnsRequestAction -> Rep DnsRequestAction x)
-> (forall x. Rep DnsRequestAction x -> DnsRequestAction)
-> Generic DnsRequestAction
forall x. Rep DnsRequestAction x -> DnsRequestAction
forall x. DnsRequestAction -> Rep DnsRequestAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DnsRequestAction x -> DnsRequestAction
$cfrom :: forall x. DnsRequestAction -> Rep DnsRequestAction x
Prelude.Generic)

-- |
-- Create a value of 'DnsRequestAction' 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:
--
-- 'domain', 'dnsRequestAction_domain' - The domain information for the API request.
newDnsRequestAction ::
  DnsRequestAction
newDnsRequestAction :: DnsRequestAction
newDnsRequestAction =
  DnsRequestAction' :: Maybe Text -> DnsRequestAction
DnsRequestAction' {$sel:domain:DnsRequestAction' :: Maybe Text
domain = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The domain information for the API request.
dnsRequestAction_domain :: Lens.Lens' DnsRequestAction (Prelude.Maybe Prelude.Text)
dnsRequestAction_domain :: (Maybe Text -> f (Maybe Text))
-> DnsRequestAction -> f DnsRequestAction
dnsRequestAction_domain = (DnsRequestAction -> Maybe Text)
-> (DnsRequestAction -> Maybe Text -> DnsRequestAction)
-> Lens DnsRequestAction DnsRequestAction (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsRequestAction' {Maybe Text
domain :: Maybe Text
$sel:domain:DnsRequestAction' :: DnsRequestAction -> Maybe Text
domain} -> Maybe Text
domain) (\s :: DnsRequestAction
s@DnsRequestAction' {} Maybe Text
a -> DnsRequestAction
s {$sel:domain:DnsRequestAction' :: Maybe Text
domain = Maybe Text
a} :: DnsRequestAction)

instance Core.FromJSON DnsRequestAction where
  parseJSON :: Value -> Parser DnsRequestAction
parseJSON =
    String
-> (Object -> Parser DnsRequestAction)
-> Value
-> Parser DnsRequestAction
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DnsRequestAction"
      ( \Object
x ->
          Maybe Text -> DnsRequestAction
DnsRequestAction' (Maybe Text -> DnsRequestAction)
-> Parser (Maybe Text) -> Parser DnsRequestAction
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
"domain")
      )

instance Prelude.Hashable DnsRequestAction

instance Prelude.NFData DnsRequestAction