{-# 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.AppStream.Types.Session where
import Amazonka.AppStream.Types.AuthenticationType
import Amazonka.AppStream.Types.NetworkAccessConfiguration
import Amazonka.AppStream.Types.SessionConnectionState
import Amazonka.AppStream.Types.SessionState
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Session = Session'
{
Session -> Maybe NetworkAccessConfiguration
networkAccessConfiguration :: Prelude.Maybe NetworkAccessConfiguration,
Session -> Maybe POSIX
maxExpirationTime :: Prelude.Maybe Core.POSIX,
Session -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
Session -> Maybe AuthenticationType
authenticationType :: Prelude.Maybe AuthenticationType,
Session -> Maybe SessionConnectionState
connectionState :: Prelude.Maybe SessionConnectionState,
Session -> Text
id :: Prelude.Text,
Session -> Text
userId :: Prelude.Text,
Session -> Text
stackName :: Prelude.Text,
Session -> Text
fleetName :: Prelude.Text,
Session -> SessionState
state :: SessionState
}
deriving (Session -> Session -> Bool
(Session -> Session -> Bool)
-> (Session -> Session -> Bool) -> Eq Session
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Session -> Session -> Bool
$c/= :: Session -> Session -> Bool
== :: Session -> Session -> Bool
$c== :: Session -> Session -> Bool
Prelude.Eq, ReadPrec [Session]
ReadPrec Session
Int -> ReadS Session
ReadS [Session]
(Int -> ReadS Session)
-> ReadS [Session]
-> ReadPrec Session
-> ReadPrec [Session]
-> Read Session
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Session]
$creadListPrec :: ReadPrec [Session]
readPrec :: ReadPrec Session
$creadPrec :: ReadPrec Session
readList :: ReadS [Session]
$creadList :: ReadS [Session]
readsPrec :: Int -> ReadS Session
$creadsPrec :: Int -> ReadS Session
Prelude.Read, Int -> Session -> ShowS
[Session] -> ShowS
Session -> String
(Int -> Session -> ShowS)
-> (Session -> String) -> ([Session] -> ShowS) -> Show Session
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Session] -> ShowS
$cshowList :: [Session] -> ShowS
show :: Session -> String
$cshow :: Session -> String
showsPrec :: Int -> Session -> ShowS
$cshowsPrec :: Int -> Session -> ShowS
Prelude.Show, (forall x. Session -> Rep Session x)
-> (forall x. Rep Session x -> Session) -> Generic Session
forall x. Rep Session x -> Session
forall x. Session -> Rep Session x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Session x -> Session
$cfrom :: forall x. Session -> Rep Session x
Prelude.Generic)
newSession ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
SessionState ->
Session
newSession :: Text -> Text -> Text -> Text -> SessionState -> Session
newSession
Text
pId_
Text
pUserId_
Text
pStackName_
Text
pFleetName_
SessionState
pState_ =
Session' :: Maybe NetworkAccessConfiguration
-> Maybe POSIX
-> Maybe POSIX
-> Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session
Session'
{ $sel:networkAccessConfiguration:Session' :: Maybe NetworkAccessConfiguration
networkAccessConfiguration =
Maybe NetworkAccessConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:maxExpirationTime:Session' :: Maybe POSIX
maxExpirationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:startTime:Session' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:authenticationType:Session' :: Maybe AuthenticationType
authenticationType = Maybe AuthenticationType
forall a. Maybe a
Prelude.Nothing,
$sel:connectionState:Session' :: Maybe SessionConnectionState
connectionState = Maybe SessionConnectionState
forall a. Maybe a
Prelude.Nothing,
$sel:id:Session' :: Text
id = Text
pId_,
$sel:userId:Session' :: Text
userId = Text
pUserId_,
$sel:stackName:Session' :: Text
stackName = Text
pStackName_,
$sel:fleetName:Session' :: Text
fleetName = Text
pFleetName_,
$sel:state:Session' :: SessionState
state = SessionState
pState_
}
session_networkAccessConfiguration :: Lens.Lens' Session (Prelude.Maybe NetworkAccessConfiguration)
session_networkAccessConfiguration :: (Maybe NetworkAccessConfiguration
-> f (Maybe NetworkAccessConfiguration))
-> Session -> f Session
session_networkAccessConfiguration = (Session -> Maybe NetworkAccessConfiguration)
-> (Session -> Maybe NetworkAccessConfiguration -> Session)
-> Lens
Session
Session
(Maybe NetworkAccessConfiguration)
(Maybe NetworkAccessConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Maybe NetworkAccessConfiguration
networkAccessConfiguration :: Maybe NetworkAccessConfiguration
$sel:networkAccessConfiguration:Session' :: Session -> Maybe NetworkAccessConfiguration
networkAccessConfiguration} -> Maybe NetworkAccessConfiguration
networkAccessConfiguration) (\s :: Session
s@Session' {} Maybe NetworkAccessConfiguration
a -> Session
s {$sel:networkAccessConfiguration:Session' :: Maybe NetworkAccessConfiguration
networkAccessConfiguration = Maybe NetworkAccessConfiguration
a} :: Session)
session_maxExpirationTime :: Lens.Lens' Session (Prelude.Maybe Prelude.UTCTime)
session_maxExpirationTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Session -> f Session
session_maxExpirationTime = (Session -> Maybe POSIX)
-> (Session -> Maybe POSIX -> Session)
-> Lens Session Session (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Maybe POSIX
maxExpirationTime :: Maybe POSIX
$sel:maxExpirationTime:Session' :: Session -> Maybe POSIX
maxExpirationTime} -> Maybe POSIX
maxExpirationTime) (\s :: Session
s@Session' {} Maybe POSIX
a -> Session
s {$sel:maxExpirationTime:Session' :: Maybe POSIX
maxExpirationTime = Maybe POSIX
a} :: Session) ((Maybe POSIX -> f (Maybe POSIX)) -> Session -> f Session)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Session
-> f Session
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
session_startTime :: Lens.Lens' Session (Prelude.Maybe Prelude.UTCTime)
session_startTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Session -> f Session
session_startTime = (Session -> Maybe POSIX)
-> (Session -> Maybe POSIX -> Session)
-> Lens Session Session (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:Session' :: Session -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: Session
s@Session' {} Maybe POSIX
a -> Session
s {$sel:startTime:Session' :: Maybe POSIX
startTime = Maybe POSIX
a} :: Session) ((Maybe POSIX -> f (Maybe POSIX)) -> Session -> f Session)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Session
-> f Session
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
session_authenticationType :: Lens.Lens' Session (Prelude.Maybe AuthenticationType)
session_authenticationType :: (Maybe AuthenticationType -> f (Maybe AuthenticationType))
-> Session -> f Session
session_authenticationType = (Session -> Maybe AuthenticationType)
-> (Session -> Maybe AuthenticationType -> Session)
-> Lens
Session
Session
(Maybe AuthenticationType)
(Maybe AuthenticationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Maybe AuthenticationType
authenticationType :: Maybe AuthenticationType
$sel:authenticationType:Session' :: Session -> Maybe AuthenticationType
authenticationType} -> Maybe AuthenticationType
authenticationType) (\s :: Session
s@Session' {} Maybe AuthenticationType
a -> Session
s {$sel:authenticationType:Session' :: Maybe AuthenticationType
authenticationType = Maybe AuthenticationType
a} :: Session)
session_connectionState :: Lens.Lens' Session (Prelude.Maybe SessionConnectionState)
session_connectionState :: (Maybe SessionConnectionState -> f (Maybe SessionConnectionState))
-> Session -> f Session
session_connectionState = (Session -> Maybe SessionConnectionState)
-> (Session -> Maybe SessionConnectionState -> Session)
-> Lens
Session
Session
(Maybe SessionConnectionState)
(Maybe SessionConnectionState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Maybe SessionConnectionState
connectionState :: Maybe SessionConnectionState
$sel:connectionState:Session' :: Session -> Maybe SessionConnectionState
connectionState} -> Maybe SessionConnectionState
connectionState) (\s :: Session
s@Session' {} Maybe SessionConnectionState
a -> Session
s {$sel:connectionState:Session' :: Maybe SessionConnectionState
connectionState = Maybe SessionConnectionState
a} :: Session)
session_id :: Lens.Lens' Session Prelude.Text
session_id :: (Text -> f Text) -> Session -> f Session
session_id = (Session -> Text)
-> (Session -> Text -> Session) -> Lens Session Session Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Text
id :: Text
$sel:id:Session' :: Session -> Text
id} -> Text
id) (\s :: Session
s@Session' {} Text
a -> Session
s {$sel:id:Session' :: Text
id = Text
a} :: Session)
session_userId :: Lens.Lens' Session Prelude.Text
session_userId :: (Text -> f Text) -> Session -> f Session
session_userId = (Session -> Text)
-> (Session -> Text -> Session) -> Lens Session Session Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Text
userId :: Text
$sel:userId:Session' :: Session -> Text
userId} -> Text
userId) (\s :: Session
s@Session' {} Text
a -> Session
s {$sel:userId:Session' :: Text
userId = Text
a} :: Session)
session_stackName :: Lens.Lens' Session Prelude.Text
session_stackName :: (Text -> f Text) -> Session -> f Session
session_stackName = (Session -> Text)
-> (Session -> Text -> Session) -> Lens Session Session Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Text
stackName :: Text
$sel:stackName:Session' :: Session -> Text
stackName} -> Text
stackName) (\s :: Session
s@Session' {} Text
a -> Session
s {$sel:stackName:Session' :: Text
stackName = Text
a} :: Session)
session_fleetName :: Lens.Lens' Session Prelude.Text
session_fleetName :: (Text -> f Text) -> Session -> f Session
session_fleetName = (Session -> Text)
-> (Session -> Text -> Session) -> Lens Session Session Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {Text
fleetName :: Text
$sel:fleetName:Session' :: Session -> Text
fleetName} -> Text
fleetName) (\s :: Session
s@Session' {} Text
a -> Session
s {$sel:fleetName:Session' :: Text
fleetName = Text
a} :: Session)
session_state :: Lens.Lens' Session SessionState
session_state :: (SessionState -> f SessionState) -> Session -> f Session
session_state = (Session -> SessionState)
-> (Session -> SessionState -> Session)
-> Lens Session Session SessionState SessionState
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Session' {SessionState
state :: SessionState
$sel:state:Session' :: Session -> SessionState
state} -> SessionState
state) (\s :: Session
s@Session' {} SessionState
a -> Session
s {$sel:state:Session' :: SessionState
state = SessionState
a} :: Session)
instance Core.FromJSON Session where
parseJSON :: Value -> Parser Session
parseJSON =
String -> (Object -> Parser Session) -> Value -> Parser Session
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Session"
( \Object
x ->
Maybe NetworkAccessConfiguration
-> Maybe POSIX
-> Maybe POSIX
-> Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session
Session'
(Maybe NetworkAccessConfiguration
-> Maybe POSIX
-> Maybe POSIX
-> Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session)
-> Parser (Maybe NetworkAccessConfiguration)
-> Parser
(Maybe POSIX
-> Maybe POSIX
-> Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe NetworkAccessConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NetworkAccessConfiguration")
Parser
(Maybe POSIX
-> Maybe POSIX
-> Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session)
-> Parser (Maybe POSIX)
-> Parser
(Maybe POSIX
-> Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaxExpirationTime")
Parser
(Maybe POSIX
-> Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session)
-> Parser (Maybe POSIX)
-> Parser
(Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StartTime")
Parser
(Maybe AuthenticationType
-> Maybe SessionConnectionState
-> Text
-> Text
-> Text
-> Text
-> SessionState
-> Session)
-> Parser (Maybe AuthenticationType)
-> Parser
(Maybe SessionConnectionState
-> Text -> Text -> Text -> Text -> SessionState -> Session)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AuthenticationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AuthenticationType")
Parser
(Maybe SessionConnectionState
-> Text -> Text -> Text -> Text -> SessionState -> Session)
-> Parser (Maybe SessionConnectionState)
-> Parser (Text -> Text -> Text -> Text -> SessionState -> Session)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SessionConnectionState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ConnectionState")
Parser (Text -> Text -> Text -> Text -> SessionState -> Session)
-> Parser Text
-> Parser (Text -> Text -> Text -> SessionState -> Session)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id")
Parser (Text -> Text -> Text -> SessionState -> Session)
-> Parser Text -> Parser (Text -> Text -> SessionState -> Session)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UserId")
Parser (Text -> Text -> SessionState -> Session)
-> Parser Text -> Parser (Text -> SessionState -> Session)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StackName")
Parser (Text -> SessionState -> Session)
-> Parser Text -> Parser (SessionState -> Session)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"FleetName")
Parser (SessionState -> Session)
-> Parser SessionState -> Parser Session
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser SessionState
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"State")
)
instance Prelude.Hashable Session
instance Prelude.NFData Session