{-# 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-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.EndSessionResult 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 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
(EndSessionResult -> EndSessionResult -> Bool)
-> (EndSessionResult -> EndSessionResult -> Bool)
-> Eq EndSessionResult
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]
(Int -> ReadS EndSessionResult)
-> ReadS [EndSessionResult]
-> ReadPrec EndSessionResult
-> ReadPrec [EndSessionResult]
-> Read 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
(Int -> EndSessionResult -> ShowS)
-> (EndSessionResult -> String)
-> ([EndSessionResult] -> ShowS)
-> Show EndSessionResult
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. EndSessionResult -> Rep EndSessionResult x)
-> (forall x. Rep EndSessionResult x -> EndSessionResult)
-> Generic EndSessionResult
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' :: Maybe TimingInformation -> EndSessionResult
EndSessionResult'
    { $sel:timingInformation:EndSessionResult' :: Maybe TimingInformation
timingInformation =
        Maybe 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 :: (Maybe TimingInformation -> f (Maybe TimingInformation))
-> EndSessionResult -> f EndSessionResult
endSessionResult_timingInformation = (EndSessionResult -> Maybe TimingInformation)
-> (EndSessionResult
    -> Maybe TimingInformation -> EndSessionResult)
-> Lens
     EndSessionResult
     EndSessionResult
     (Maybe TimingInformation)
     (Maybe 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 Core.FromJSON EndSessionResult where
  parseJSON :: Value -> Parser EndSessionResult
parseJSON =
    String
-> (Object -> Parser EndSessionResult)
-> Value
-> Parser EndSessionResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EndSessionResult"
      ( \Object
x ->
          Maybe TimingInformation -> EndSessionResult
EndSessionResult'
            (Maybe TimingInformation -> EndSessionResult)
-> Parser (Maybe TimingInformation) -> Parser EndSessionResult
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")
      )

instance Prelude.Hashable EndSessionResult

instance Prelude.NFData EndSessionResult