{-# 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.EndSessionResult
-- 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.EndSessionResult 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 ended session.
--
-- /See:/ 'newEndSessionResult' smart constructor.
data EndSessionResult = EndSessionResult'
  { -- | Contains server-side performance information for the command.
    EndSessionResult -> Maybe TimingInformation
timingInformation :: Prelude.Maybe TimingInformation
  }
  deriving (EndSessionResult -> EndSessionResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndSessionResult -> EndSessionResult -> Bool
$c/= :: EndSessionResult -> EndSessionResult -> Bool
== :: EndSessionResult -> EndSessionResult -> Bool
$c== :: EndSessionResult -> EndSessionResult -> Bool
Prelude.Eq, ReadPrec [EndSessionResult]
ReadPrec EndSessionResult
Int -> ReadS EndSessionResult
ReadS [EndSessionResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndSessionResult]
$creadListPrec :: ReadPrec [EndSessionResult]
readPrec :: ReadPrec EndSessionResult
$creadPrec :: ReadPrec EndSessionResult
readList :: ReadS [EndSessionResult]
$creadList :: ReadS [EndSessionResult]
readsPrec :: Int -> ReadS EndSessionResult
$creadsPrec :: Int -> ReadS EndSessionResult
Prelude.Read, Int -> EndSessionResult -> ShowS
[EndSessionResult] -> ShowS
EndSessionResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndSessionResult] -> ShowS
$cshowList :: [EndSessionResult] -> ShowS
show :: EndSessionResult -> String
$cshow :: EndSessionResult -> String
showsPrec :: Int -> EndSessionResult -> ShowS
$cshowsPrec :: Int -> EndSessionResult -> ShowS
Prelude.Show, forall x. Rep EndSessionResult x -> EndSessionResult
forall x. EndSessionResult -> Rep EndSessionResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndSessionResult x -> EndSessionResult
$cfrom :: forall x. EndSessionResult -> Rep EndSessionResult x
Prelude.Generic)

-- |
-- Create a value of 'EndSessionResult' 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', 'endSessionResult_timingInformation' - Contains server-side performance information for the command.
newEndSessionResult ::
  EndSessionResult
newEndSessionResult :: EndSessionResult
newEndSessionResult =
  EndSessionResult'
    { $sel:timingInformation:EndSessionResult' :: Maybe TimingInformation
timingInformation =
        forall a. Maybe a
Prelude.Nothing
    }

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

instance Data.FromJSON EndSessionResult where
  parseJSON :: Value -> Parser EndSessionResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EndSessionResult"
      ( \Object
x ->
          Maybe TimingInformation -> EndSessionResult
EndSessionResult'
            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
"TimingInformation")
      )

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

instance Prelude.NFData EndSessionResult where
  rnf :: EndSessionResult -> ()
rnf EndSessionResult' {Maybe TimingInformation
timingInformation :: Maybe TimingInformation
$sel:timingInformation:EndSessionResult' :: EndSessionResult -> Maybe TimingInformation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TimingInformation
timingInformation