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