{-# 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.MacieV2.Types.SessionContext where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.SessionContextAttributes
import Amazonka.MacieV2.Types.SessionIssuer
import qualified Amazonka.Prelude as Prelude
data SessionContext = SessionContext'
{
SessionContext -> Maybe SessionContextAttributes
attributes :: Prelude.Maybe SessionContextAttributes,
SessionContext -> Maybe SessionIssuer
sessionIssuer :: Prelude.Maybe SessionIssuer
}
deriving (SessionContext -> SessionContext -> Bool
(SessionContext -> SessionContext -> Bool)
-> (SessionContext -> SessionContext -> Bool) -> Eq SessionContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SessionContext -> SessionContext -> Bool
$c/= :: SessionContext -> SessionContext -> Bool
== :: SessionContext -> SessionContext -> Bool
$c== :: SessionContext -> SessionContext -> Bool
Prelude.Eq, ReadPrec [SessionContext]
ReadPrec SessionContext
Int -> ReadS SessionContext
ReadS [SessionContext]
(Int -> ReadS SessionContext)
-> ReadS [SessionContext]
-> ReadPrec SessionContext
-> ReadPrec [SessionContext]
-> Read SessionContext
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SessionContext]
$creadListPrec :: ReadPrec [SessionContext]
readPrec :: ReadPrec SessionContext
$creadPrec :: ReadPrec SessionContext
readList :: ReadS [SessionContext]
$creadList :: ReadS [SessionContext]
readsPrec :: Int -> ReadS SessionContext
$creadsPrec :: Int -> ReadS SessionContext
Prelude.Read, Int -> SessionContext -> ShowS
[SessionContext] -> ShowS
SessionContext -> String
(Int -> SessionContext -> ShowS)
-> (SessionContext -> String)
-> ([SessionContext] -> ShowS)
-> Show SessionContext
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SessionContext] -> ShowS
$cshowList :: [SessionContext] -> ShowS
show :: SessionContext -> String
$cshow :: SessionContext -> String
showsPrec :: Int -> SessionContext -> ShowS
$cshowsPrec :: Int -> SessionContext -> ShowS
Prelude.Show, (forall x. SessionContext -> Rep SessionContext x)
-> (forall x. Rep SessionContext x -> SessionContext)
-> Generic SessionContext
forall x. Rep SessionContext x -> SessionContext
forall x. SessionContext -> Rep SessionContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SessionContext x -> SessionContext
$cfrom :: forall x. SessionContext -> Rep SessionContext x
Prelude.Generic)
newSessionContext ::
SessionContext
newSessionContext :: SessionContext
newSessionContext =
SessionContext' :: Maybe SessionContextAttributes
-> Maybe SessionIssuer -> SessionContext
SessionContext'
{ $sel:attributes:SessionContext' :: Maybe SessionContextAttributes
attributes = Maybe SessionContextAttributes
forall a. Maybe a
Prelude.Nothing,
$sel:sessionIssuer:SessionContext' :: Maybe SessionIssuer
sessionIssuer = Maybe SessionIssuer
forall a. Maybe a
Prelude.Nothing
}
sessionContext_attributes :: Lens.Lens' SessionContext (Prelude.Maybe SessionContextAttributes)
sessionContext_attributes :: (Maybe SessionContextAttributes
-> f (Maybe SessionContextAttributes))
-> SessionContext -> f SessionContext
sessionContext_attributes = (SessionContext -> Maybe SessionContextAttributes)
-> (SessionContext
-> Maybe SessionContextAttributes -> SessionContext)
-> Lens
SessionContext
SessionContext
(Maybe SessionContextAttributes)
(Maybe SessionContextAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionContext' {Maybe SessionContextAttributes
attributes :: Maybe SessionContextAttributes
$sel:attributes:SessionContext' :: SessionContext -> Maybe SessionContextAttributes
attributes} -> Maybe SessionContextAttributes
attributes) (\s :: SessionContext
s@SessionContext' {} Maybe SessionContextAttributes
a -> SessionContext
s {$sel:attributes:SessionContext' :: Maybe SessionContextAttributes
attributes = Maybe SessionContextAttributes
a} :: SessionContext)
sessionContext_sessionIssuer :: Lens.Lens' SessionContext (Prelude.Maybe SessionIssuer)
sessionContext_sessionIssuer :: (Maybe SessionIssuer -> f (Maybe SessionIssuer))
-> SessionContext -> f SessionContext
sessionContext_sessionIssuer = (SessionContext -> Maybe SessionIssuer)
-> (SessionContext -> Maybe SessionIssuer -> SessionContext)
-> Lens
SessionContext
SessionContext
(Maybe SessionIssuer)
(Maybe SessionIssuer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SessionContext' {Maybe SessionIssuer
sessionIssuer :: Maybe SessionIssuer
$sel:sessionIssuer:SessionContext' :: SessionContext -> Maybe SessionIssuer
sessionIssuer} -> Maybe SessionIssuer
sessionIssuer) (\s :: SessionContext
s@SessionContext' {} Maybe SessionIssuer
a -> SessionContext
s {$sel:sessionIssuer:SessionContext' :: Maybe SessionIssuer
sessionIssuer = Maybe SessionIssuer
a} :: SessionContext)
instance Core.FromJSON SessionContext where
parseJSON :: Value -> Parser SessionContext
parseJSON =
String
-> (Object -> Parser SessionContext)
-> Value
-> Parser SessionContext
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SessionContext"
( \Object
x ->
Maybe SessionContextAttributes
-> Maybe SessionIssuer -> SessionContext
SessionContext'
(Maybe SessionContextAttributes
-> Maybe SessionIssuer -> SessionContext)
-> Parser (Maybe SessionContextAttributes)
-> Parser (Maybe SessionIssuer -> SessionContext)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SessionContextAttributes)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"attributes")
Parser (Maybe SessionIssuer -> SessionContext)
-> Parser (Maybe SessionIssuer) -> Parser SessionContext
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SessionIssuer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sessionIssuer")
)
instance Prelude.Hashable SessionContext
instance Prelude.NFData SessionContext