{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.QLDBSession.Types.StartSessionResult
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QLDBSession.Types.StartSessionResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QLDBSession.Types.TimingInformation

-- | Contains the details of the started session.
--
-- /See:/ 'newStartSessionResult' smart constructor.
data StartSessionResult = StartSessionResult'
  { -- | Contains server-side performance information for the command.
    StartSessionResult -> Maybe TimingInformation
timingInformation :: Prelude.Maybe TimingInformation,
    -- | Session token of the started session. This @SessionToken@ is required
    -- for every subsequent command that is issued during the current session.
    StartSessionResult -> Maybe Text
sessionToken :: Prelude.Maybe Prelude.Text
  }
  deriving (StartSessionResult -> StartSessionResult -> Bool
(StartSessionResult -> StartSessionResult -> Bool)
-> (StartSessionResult -> StartSessionResult -> Bool)
-> Eq StartSessionResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSessionResult -> StartSessionResult -> Bool
$c/= :: StartSessionResult -> StartSessionResult -> Bool
== :: StartSessionResult -> StartSessionResult -> Bool
$c== :: StartSessionResult -> StartSessionResult -> Bool
Prelude.Eq, ReadPrec [StartSessionResult]
ReadPrec StartSessionResult
Int -> ReadS StartSessionResult
ReadS [StartSessionResult]
(Int -> ReadS StartSessionResult)
-> ReadS [StartSessionResult]
-> ReadPrec StartSessionResult
-> ReadPrec [StartSessionResult]
-> Read StartSessionResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSessionResult]
$creadListPrec :: ReadPrec [StartSessionResult]
readPrec :: ReadPrec StartSessionResult
$creadPrec :: ReadPrec StartSessionResult
readList :: ReadS [StartSessionResult]
$creadList :: ReadS [StartSessionResult]
readsPrec :: Int -> ReadS StartSessionResult
$creadsPrec :: Int -> ReadS StartSessionResult
Prelude.Read, Int -> StartSessionResult -> ShowS
[StartSessionResult] -> ShowS
StartSessionResult -> String
(Int -> StartSessionResult -> ShowS)
-> (StartSessionResult -> String)
-> ([StartSessionResult] -> ShowS)
-> Show StartSessionResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSessionResult] -> ShowS
$cshowList :: [StartSessionResult] -> ShowS
show :: StartSessionResult -> String
$cshow :: StartSessionResult -> String
showsPrec :: Int -> StartSessionResult -> ShowS
$cshowsPrec :: Int -> StartSessionResult -> ShowS
Prelude.Show, (forall x. StartSessionResult -> Rep StartSessionResult x)
-> (forall x. Rep StartSessionResult x -> StartSessionResult)
-> Generic StartSessionResult
forall x. Rep StartSessionResult x -> StartSessionResult
forall x. StartSessionResult -> Rep StartSessionResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartSessionResult x -> StartSessionResult
$cfrom :: forall x. StartSessionResult -> Rep StartSessionResult x
Prelude.Generic)

-- |
-- Create a value of 'StartSessionResult' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'timingInformation', 'startSessionResult_timingInformation' - Contains server-side performance information for the command.
--
-- 'sessionToken', 'startSessionResult_sessionToken' - Session token of the started session. This @SessionToken@ is required
-- for every subsequent command that is issued during the current session.
newStartSessionResult ::
  StartSessionResult
newStartSessionResult :: StartSessionResult
newStartSessionResult =
  StartSessionResult' :: Maybe TimingInformation -> Maybe Text -> StartSessionResult
StartSessionResult'
    { $sel:timingInformation:StartSessionResult' :: Maybe TimingInformation
timingInformation =
        Maybe TimingInformation
forall a. Maybe a
Prelude.Nothing,
      $sel:sessionToken:StartSessionResult' :: Maybe Text
sessionToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Contains server-side performance information for the command.
startSessionResult_timingInformation :: Lens.Lens' StartSessionResult (Prelude.Maybe TimingInformation)
startSessionResult_timingInformation :: (Maybe TimingInformation -> f (Maybe TimingInformation))
-> StartSessionResult -> f StartSessionResult
startSessionResult_timingInformation = (StartSessionResult -> Maybe TimingInformation)
-> (StartSessionResult
    -> Maybe TimingInformation -> StartSessionResult)
-> Lens
     StartSessionResult
     StartSessionResult
     (Maybe TimingInformation)
     (Maybe TimingInformation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSessionResult' {Maybe TimingInformation
timingInformation :: Maybe TimingInformation
$sel:timingInformation:StartSessionResult' :: StartSessionResult -> Maybe TimingInformation
timingInformation} -> Maybe TimingInformation
timingInformation) (\s :: StartSessionResult
s@StartSessionResult' {} Maybe TimingInformation
a -> StartSessionResult
s {$sel:timingInformation:StartSessionResult' :: Maybe TimingInformation
timingInformation = Maybe TimingInformation
a} :: StartSessionResult)

-- | Session token of the started session. This @SessionToken@ is required
-- for every subsequent command that is issued during the current session.
startSessionResult_sessionToken :: Lens.Lens' StartSessionResult (Prelude.Maybe Prelude.Text)
startSessionResult_sessionToken :: (Maybe Text -> f (Maybe Text))
-> StartSessionResult -> f StartSessionResult
startSessionResult_sessionToken = (StartSessionResult -> Maybe Text)
-> (StartSessionResult -> Maybe Text -> StartSessionResult)
-> Lens
     StartSessionResult StartSessionResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSessionResult' {Maybe Text
sessionToken :: Maybe Text
$sel:sessionToken:StartSessionResult' :: StartSessionResult -> Maybe Text
sessionToken} -> Maybe Text
sessionToken) (\s :: StartSessionResult
s@StartSessionResult' {} Maybe Text
a -> StartSessionResult
s {$sel:sessionToken:StartSessionResult' :: Maybe Text
sessionToken = Maybe Text
a} :: StartSessionResult)

instance Core.FromJSON StartSessionResult where
  parseJSON :: Value -> Parser StartSessionResult
parseJSON =
    String
-> (Object -> Parser StartSessionResult)
-> Value
-> Parser StartSessionResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StartSessionResult"
      ( \Object
x ->
          Maybe TimingInformation -> Maybe Text -> StartSessionResult
StartSessionResult'
            (Maybe TimingInformation -> Maybe Text -> StartSessionResult)
-> Parser (Maybe TimingInformation)
-> Parser (Maybe Text -> StartSessionResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TimingInformation)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TimingInformation")
            Parser (Maybe Text -> StartSessionResult)
-> Parser (Maybe Text) -> Parser StartSessionResult
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
"SessionToken")
      )

instance Prelude.Hashable StartSessionResult

instance Prelude.NFData StartSessionResult