{-# 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 #-}
module Amazonka.SecurityHub.Types.DnsRequestAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DnsRequestAction = DnsRequestAction'
{
DnsRequestAction -> Maybe Text
domain :: Prelude.Maybe Prelude.Text,
DnsRequestAction -> Maybe Text
protocol :: Prelude.Maybe Prelude.Text,
DnsRequestAction -> Maybe Bool
blocked :: Prelude.Maybe Prelude.Bool
}
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)
newDnsRequestAction ::
DnsRequestAction
newDnsRequestAction :: DnsRequestAction
newDnsRequestAction =
DnsRequestAction' :: Maybe Text -> Maybe Text -> Maybe Bool -> DnsRequestAction
DnsRequestAction'
{ $sel:domain:DnsRequestAction' :: Maybe Text
domain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:protocol:DnsRequestAction' :: Maybe Text
protocol = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:blocked:DnsRequestAction' :: Maybe Bool
blocked = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
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)
dnsRequestAction_protocol :: Lens.Lens' DnsRequestAction (Prelude.Maybe Prelude.Text)
dnsRequestAction_protocol :: (Maybe Text -> f (Maybe Text))
-> DnsRequestAction -> f DnsRequestAction
dnsRequestAction_protocol = (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
protocol :: Maybe Text
$sel:protocol:DnsRequestAction' :: DnsRequestAction -> Maybe Text
protocol} -> Maybe Text
protocol) (\s :: DnsRequestAction
s@DnsRequestAction' {} Maybe Text
a -> DnsRequestAction
s {$sel:protocol:DnsRequestAction' :: Maybe Text
protocol = Maybe Text
a} :: DnsRequestAction)
dnsRequestAction_blocked :: Lens.Lens' DnsRequestAction (Prelude.Maybe Prelude.Bool)
dnsRequestAction_blocked :: (Maybe Bool -> f (Maybe Bool))
-> DnsRequestAction -> f DnsRequestAction
dnsRequestAction_blocked = (DnsRequestAction -> Maybe Bool)
-> (DnsRequestAction -> Maybe Bool -> DnsRequestAction)
-> Lens DnsRequestAction DnsRequestAction (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DnsRequestAction' {Maybe Bool
blocked :: Maybe Bool
$sel:blocked:DnsRequestAction' :: DnsRequestAction -> Maybe Bool
blocked} -> Maybe Bool
blocked) (\s :: DnsRequestAction
s@DnsRequestAction' {} Maybe Bool
a -> DnsRequestAction
s {$sel:blocked:DnsRequestAction' :: Maybe Bool
blocked = Maybe Bool
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 -> Maybe Text -> Maybe Bool -> DnsRequestAction
DnsRequestAction'
(Maybe Text -> Maybe Text -> Maybe Bool -> DnsRequestAction)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Bool -> 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")
Parser (Maybe Text -> Maybe Bool -> DnsRequestAction)
-> Parser (Maybe Text) -> Parser (Maybe Bool -> DnsRequestAction)
forall (f :: * -> *) a b. Applicative f => 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
"Protocol")
Parser (Maybe Bool -> DnsRequestAction)
-> Parser (Maybe Bool) -> Parser DnsRequestAction
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Blocked")
)
instance Prelude.Hashable DnsRequestAction
instance Prelude.NFData DnsRequestAction
instance Core.ToJSON DnsRequestAction where
toJSON :: DnsRequestAction -> Value
toJSON DnsRequestAction' {Maybe Bool
Maybe Text
blocked :: Maybe Bool
protocol :: Maybe Text
domain :: Maybe Text
$sel:blocked:DnsRequestAction' :: DnsRequestAction -> Maybe Bool
$sel:protocol:DnsRequestAction' :: DnsRequestAction -> Maybe Text
$sel:domain:DnsRequestAction' :: DnsRequestAction -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
domain,
(Text
"Protocol" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
protocol,
(Text
"Blocked" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
blocked
]
)