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