{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.QLDBSession.Types.StartSessionResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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,
    -- | Contains server-side performance information for the command.
    StartSessionResult -> Maybe TimingInformation
timingInformation :: Prelude.Maybe TimingInformation
  }
  deriving (StartSessionResult -> StartSessionResult -> Bool
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]
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
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. 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:
--
-- 'sessionToken', 'startSessionResult_sessionToken' - Session token of the started session. This @SessionToken@ is required
-- for every subsequent command that is issued during the current session.
--
-- 'timingInformation', 'startSessionResult_timingInformation' - Contains server-side performance information for the command.
newStartSessionResult ::
  StartSessionResult
newStartSessionResult :: StartSessionResult
newStartSessionResult =
  StartSessionResult'
    { $sel:sessionToken:StartSessionResult' :: Maybe Text
sessionToken = forall a. Maybe a
Prelude.Nothing,
      $sel:timingInformation:StartSessionResult' :: Maybe TimingInformation
timingInformation = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' StartSessionResult (Maybe Text)
startSessionResult_sessionToken = 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)

-- | Contains server-side performance information for the command.
startSessionResult_timingInformation :: Lens.Lens' StartSessionResult (Prelude.Maybe TimingInformation)
startSessionResult_timingInformation :: Lens' StartSessionResult (Maybe TimingInformation)
startSessionResult_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)

instance Data.FromJSON StartSessionResult where
  parseJSON :: Value -> Parser StartSessionResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"StartSessionResult"
      ( \Object
x ->
          Maybe Text -> Maybe TimingInformation -> StartSessionResult
StartSessionResult'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SessionToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TimingInformation")
      )

instance Prelude.Hashable StartSessionResult where
  hashWithSalt :: Int -> StartSessionResult -> Int
hashWithSalt Int
_salt StartSessionResult' {Maybe Text
Maybe TimingInformation
timingInformation :: Maybe TimingInformation
sessionToken :: Maybe Text
$sel:timingInformation:StartSessionResult' :: StartSessionResult -> Maybe TimingInformation
$sel:sessionToken:StartSessionResult' :: StartSessionResult -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sessionToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimingInformation
timingInformation

instance Prelude.NFData StartSessionResult where
  rnf :: StartSessionResult -> ()
rnf StartSessionResult' {Maybe Text
Maybe TimingInformation
timingInformation :: Maybe TimingInformation
sessionToken :: Maybe Text
$sel:timingInformation:StartSessionResult' :: StartSessionResult -> Maybe TimingInformation
$sel:sessionToken:StartSessionResult' :: StartSessionResult -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sessionToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TimingInformation
timingInformation