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