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