{-# 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.NetworkFirewall.Types.TCPFlagField where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.NetworkFirewall.Types.TCPFlag
import qualified Amazonka.Prelude as Prelude
data TCPFlagField = TCPFlagField'
{
TCPFlagField -> Maybe [TCPFlag]
masks :: Prelude.Maybe [TCPFlag],
TCPFlagField -> [TCPFlag]
flags :: [TCPFlag]
}
deriving (TCPFlagField -> TCPFlagField -> Bool
(TCPFlagField -> TCPFlagField -> Bool)
-> (TCPFlagField -> TCPFlagField -> Bool) -> Eq TCPFlagField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TCPFlagField -> TCPFlagField -> Bool
$c/= :: TCPFlagField -> TCPFlagField -> Bool
== :: TCPFlagField -> TCPFlagField -> Bool
$c== :: TCPFlagField -> TCPFlagField -> Bool
Prelude.Eq, ReadPrec [TCPFlagField]
ReadPrec TCPFlagField
Int -> ReadS TCPFlagField
ReadS [TCPFlagField]
(Int -> ReadS TCPFlagField)
-> ReadS [TCPFlagField]
-> ReadPrec TCPFlagField
-> ReadPrec [TCPFlagField]
-> Read TCPFlagField
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TCPFlagField]
$creadListPrec :: ReadPrec [TCPFlagField]
readPrec :: ReadPrec TCPFlagField
$creadPrec :: ReadPrec TCPFlagField
readList :: ReadS [TCPFlagField]
$creadList :: ReadS [TCPFlagField]
readsPrec :: Int -> ReadS TCPFlagField
$creadsPrec :: Int -> ReadS TCPFlagField
Prelude.Read, Int -> TCPFlagField -> ShowS
[TCPFlagField] -> ShowS
TCPFlagField -> String
(Int -> TCPFlagField -> ShowS)
-> (TCPFlagField -> String)
-> ([TCPFlagField] -> ShowS)
-> Show TCPFlagField
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TCPFlagField] -> ShowS
$cshowList :: [TCPFlagField] -> ShowS
show :: TCPFlagField -> String
$cshow :: TCPFlagField -> String
showsPrec :: Int -> TCPFlagField -> ShowS
$cshowsPrec :: Int -> TCPFlagField -> ShowS
Prelude.Show, (forall x. TCPFlagField -> Rep TCPFlagField x)
-> (forall x. Rep TCPFlagField x -> TCPFlagField)
-> Generic TCPFlagField
forall x. Rep TCPFlagField x -> TCPFlagField
forall x. TCPFlagField -> Rep TCPFlagField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TCPFlagField x -> TCPFlagField
$cfrom :: forall x. TCPFlagField -> Rep TCPFlagField x
Prelude.Generic)
newTCPFlagField ::
TCPFlagField
newTCPFlagField :: TCPFlagField
newTCPFlagField =
TCPFlagField' :: Maybe [TCPFlag] -> [TCPFlag] -> TCPFlagField
TCPFlagField'
{ $sel:masks:TCPFlagField' :: Maybe [TCPFlag]
masks = Maybe [TCPFlag]
forall a. Maybe a
Prelude.Nothing,
$sel:flags:TCPFlagField' :: [TCPFlag]
flags = [TCPFlag]
forall a. Monoid a => a
Prelude.mempty
}
tCPFlagField_masks :: Lens.Lens' TCPFlagField (Prelude.Maybe [TCPFlag])
tCPFlagField_masks :: (Maybe [TCPFlag] -> f (Maybe [TCPFlag]))
-> TCPFlagField -> f TCPFlagField
tCPFlagField_masks = (TCPFlagField -> Maybe [TCPFlag])
-> (TCPFlagField -> Maybe [TCPFlag] -> TCPFlagField)
-> Lens
TCPFlagField TCPFlagField (Maybe [TCPFlag]) (Maybe [TCPFlag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TCPFlagField' {Maybe [TCPFlag]
masks :: Maybe [TCPFlag]
$sel:masks:TCPFlagField' :: TCPFlagField -> Maybe [TCPFlag]
masks} -> Maybe [TCPFlag]
masks) (\s :: TCPFlagField
s@TCPFlagField' {} Maybe [TCPFlag]
a -> TCPFlagField
s {$sel:masks:TCPFlagField' :: Maybe [TCPFlag]
masks = Maybe [TCPFlag]
a} :: TCPFlagField) ((Maybe [TCPFlag] -> f (Maybe [TCPFlag]))
-> TCPFlagField -> f TCPFlagField)
-> ((Maybe [TCPFlag] -> f (Maybe [TCPFlag]))
-> Maybe [TCPFlag] -> f (Maybe [TCPFlag]))
-> (Maybe [TCPFlag] -> f (Maybe [TCPFlag]))
-> TCPFlagField
-> f TCPFlagField
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TCPFlag] [TCPFlag] [TCPFlag] [TCPFlag]
-> Iso
(Maybe [TCPFlag])
(Maybe [TCPFlag])
(Maybe [TCPFlag])
(Maybe [TCPFlag])
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 AnIso [TCPFlag] [TCPFlag] [TCPFlag] [TCPFlag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
tCPFlagField_flags :: Lens.Lens' TCPFlagField [TCPFlag]
tCPFlagField_flags :: ([TCPFlag] -> f [TCPFlag]) -> TCPFlagField -> f TCPFlagField
tCPFlagField_flags = (TCPFlagField -> [TCPFlag])
-> (TCPFlagField -> [TCPFlag] -> TCPFlagField)
-> Lens TCPFlagField TCPFlagField [TCPFlag] [TCPFlag]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TCPFlagField' {[TCPFlag]
flags :: [TCPFlag]
$sel:flags:TCPFlagField' :: TCPFlagField -> [TCPFlag]
flags} -> [TCPFlag]
flags) (\s :: TCPFlagField
s@TCPFlagField' {} [TCPFlag]
a -> TCPFlagField
s {$sel:flags:TCPFlagField' :: [TCPFlag]
flags = [TCPFlag]
a} :: TCPFlagField) (([TCPFlag] -> f [TCPFlag]) -> TCPFlagField -> f TCPFlagField)
-> (([TCPFlag] -> f [TCPFlag]) -> [TCPFlag] -> f [TCPFlag])
-> ([TCPFlag] -> f [TCPFlag])
-> TCPFlagField
-> f TCPFlagField
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TCPFlag] -> f [TCPFlag]) -> [TCPFlag] -> f [TCPFlag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON TCPFlagField where
parseJSON :: Value -> Parser TCPFlagField
parseJSON =
String
-> (Object -> Parser TCPFlagField) -> Value -> Parser TCPFlagField
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"TCPFlagField"
( \Object
x ->
Maybe [TCPFlag] -> [TCPFlag] -> TCPFlagField
TCPFlagField'
(Maybe [TCPFlag] -> [TCPFlag] -> TCPFlagField)
-> Parser (Maybe [TCPFlag]) -> Parser ([TCPFlag] -> TCPFlagField)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [TCPFlag]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Masks" Parser (Maybe (Maybe [TCPFlag]))
-> Maybe [TCPFlag] -> Parser (Maybe [TCPFlag])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [TCPFlag]
forall a. Monoid a => a
Prelude.mempty)
Parser ([TCPFlag] -> TCPFlagField)
-> Parser [TCPFlag] -> Parser TCPFlagField
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [TCPFlag])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Flags" Parser (Maybe [TCPFlag]) -> [TCPFlag] -> Parser [TCPFlag]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [TCPFlag]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable TCPFlagField
instance Prelude.NFData TCPFlagField
instance Core.ToJSON TCPFlagField where
toJSON :: TCPFlagField -> Value
toJSON TCPFlagField' {[TCPFlag]
Maybe [TCPFlag]
flags :: [TCPFlag]
masks :: Maybe [TCPFlag]
$sel:flags:TCPFlagField' :: TCPFlagField -> [TCPFlag]
$sel:masks:TCPFlagField' :: TCPFlagField -> Maybe [TCPFlag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Masks" Text -> [TCPFlag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([TCPFlag] -> Pair) -> Maybe [TCPFlag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TCPFlag]
masks,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Flags" Text -> [TCPFlag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [TCPFlag]
flags)
]
)