{-# 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.IcmpTypeCode where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data IcmpTypeCode = IcmpTypeCode'
{
IcmpTypeCode -> Maybe Int
code :: Prelude.Maybe Prelude.Int,
IcmpTypeCode -> Maybe Int
type' :: Prelude.Maybe Prelude.Int
}
deriving (IcmpTypeCode -> IcmpTypeCode -> Bool
(IcmpTypeCode -> IcmpTypeCode -> Bool)
-> (IcmpTypeCode -> IcmpTypeCode -> Bool) -> Eq IcmpTypeCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IcmpTypeCode -> IcmpTypeCode -> Bool
$c/= :: IcmpTypeCode -> IcmpTypeCode -> Bool
== :: IcmpTypeCode -> IcmpTypeCode -> Bool
$c== :: IcmpTypeCode -> IcmpTypeCode -> Bool
Prelude.Eq, ReadPrec [IcmpTypeCode]
ReadPrec IcmpTypeCode
Int -> ReadS IcmpTypeCode
ReadS [IcmpTypeCode]
(Int -> ReadS IcmpTypeCode)
-> ReadS [IcmpTypeCode]
-> ReadPrec IcmpTypeCode
-> ReadPrec [IcmpTypeCode]
-> Read IcmpTypeCode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IcmpTypeCode]
$creadListPrec :: ReadPrec [IcmpTypeCode]
readPrec :: ReadPrec IcmpTypeCode
$creadPrec :: ReadPrec IcmpTypeCode
readList :: ReadS [IcmpTypeCode]
$creadList :: ReadS [IcmpTypeCode]
readsPrec :: Int -> ReadS IcmpTypeCode
$creadsPrec :: Int -> ReadS IcmpTypeCode
Prelude.Read, Int -> IcmpTypeCode -> ShowS
[IcmpTypeCode] -> ShowS
IcmpTypeCode -> String
(Int -> IcmpTypeCode -> ShowS)
-> (IcmpTypeCode -> String)
-> ([IcmpTypeCode] -> ShowS)
-> Show IcmpTypeCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IcmpTypeCode] -> ShowS
$cshowList :: [IcmpTypeCode] -> ShowS
show :: IcmpTypeCode -> String
$cshow :: IcmpTypeCode -> String
showsPrec :: Int -> IcmpTypeCode -> ShowS
$cshowsPrec :: Int -> IcmpTypeCode -> ShowS
Prelude.Show, (forall x. IcmpTypeCode -> Rep IcmpTypeCode x)
-> (forall x. Rep IcmpTypeCode x -> IcmpTypeCode)
-> Generic IcmpTypeCode
forall x. Rep IcmpTypeCode x -> IcmpTypeCode
forall x. IcmpTypeCode -> Rep IcmpTypeCode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IcmpTypeCode x -> IcmpTypeCode
$cfrom :: forall x. IcmpTypeCode -> Rep IcmpTypeCode x
Prelude.Generic)
newIcmpTypeCode ::
IcmpTypeCode
newIcmpTypeCode :: IcmpTypeCode
newIcmpTypeCode =
IcmpTypeCode' :: Maybe Int -> Maybe Int -> IcmpTypeCode
IcmpTypeCode'
{ $sel:code:IcmpTypeCode' :: Maybe Int
code = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:type':IcmpTypeCode' :: Maybe Int
type' = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
icmpTypeCode_code :: Lens.Lens' IcmpTypeCode (Prelude.Maybe Prelude.Int)
icmpTypeCode_code :: (Maybe Int -> f (Maybe Int)) -> IcmpTypeCode -> f IcmpTypeCode
icmpTypeCode_code = (IcmpTypeCode -> Maybe Int)
-> (IcmpTypeCode -> Maybe Int -> IcmpTypeCode)
-> Lens IcmpTypeCode IcmpTypeCode (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IcmpTypeCode' {Maybe Int
code :: Maybe Int
$sel:code:IcmpTypeCode' :: IcmpTypeCode -> Maybe Int
code} -> Maybe Int
code) (\s :: IcmpTypeCode
s@IcmpTypeCode' {} Maybe Int
a -> IcmpTypeCode
s {$sel:code:IcmpTypeCode' :: Maybe Int
code = Maybe Int
a} :: IcmpTypeCode)
icmpTypeCode_type :: Lens.Lens' IcmpTypeCode (Prelude.Maybe Prelude.Int)
icmpTypeCode_type :: (Maybe Int -> f (Maybe Int)) -> IcmpTypeCode -> f IcmpTypeCode
icmpTypeCode_type = (IcmpTypeCode -> Maybe Int)
-> (IcmpTypeCode -> Maybe Int -> IcmpTypeCode)
-> Lens IcmpTypeCode IcmpTypeCode (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IcmpTypeCode' {Maybe Int
type' :: Maybe Int
$sel:type':IcmpTypeCode' :: IcmpTypeCode -> Maybe Int
type'} -> Maybe Int
type') (\s :: IcmpTypeCode
s@IcmpTypeCode' {} Maybe Int
a -> IcmpTypeCode
s {$sel:type':IcmpTypeCode' :: Maybe Int
type' = Maybe Int
a} :: IcmpTypeCode)
instance Core.FromJSON IcmpTypeCode where
parseJSON :: Value -> Parser IcmpTypeCode
parseJSON =
String
-> (Object -> Parser IcmpTypeCode) -> Value -> Parser IcmpTypeCode
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"IcmpTypeCode"
( \Object
x ->
Maybe Int -> Maybe Int -> IcmpTypeCode
IcmpTypeCode'
(Maybe Int -> Maybe Int -> IcmpTypeCode)
-> Parser (Maybe Int) -> Parser (Maybe Int -> IcmpTypeCode)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Code") Parser (Maybe Int -> IcmpTypeCode)
-> Parser (Maybe Int) -> Parser IcmpTypeCode
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
)
instance Prelude.Hashable IcmpTypeCode
instance Prelude.NFData IcmpTypeCode
instance Core.ToJSON IcmpTypeCode where
toJSON :: IcmpTypeCode -> Value
toJSON IcmpTypeCode' {Maybe Int
type' :: Maybe Int
code :: Maybe Int
$sel:type':IcmpTypeCode' :: IcmpTypeCode -> Maybe Int
$sel:code:IcmpTypeCode' :: IcmpTypeCode -> Maybe Int
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Code" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
code,
(Text
"Type" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
type'
]
)