{-# 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.TimingInformation
-- 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.TimingInformation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains server-side performance information for a command. Amazon QLDB
-- captures timing information between the times when it receives the
-- request and when it sends the corresponding response.
--
-- /See:/ 'newTimingInformation' smart constructor.
data TimingInformation = TimingInformation'
  { -- | The amount of time that QLDB spent on processing the command, measured
    -- in milliseconds.
    TimingInformation -> Maybe Integer
processingTimeMilliseconds :: Prelude.Maybe Prelude.Integer
  }
  deriving (TimingInformation -> TimingInformation -> Bool
(TimingInformation -> TimingInformation -> Bool)
-> (TimingInformation -> TimingInformation -> Bool)
-> Eq TimingInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimingInformation -> TimingInformation -> Bool
$c/= :: TimingInformation -> TimingInformation -> Bool
== :: TimingInformation -> TimingInformation -> Bool
$c== :: TimingInformation -> TimingInformation -> Bool
Prelude.Eq, ReadPrec [TimingInformation]
ReadPrec TimingInformation
Int -> ReadS TimingInformation
ReadS [TimingInformation]
(Int -> ReadS TimingInformation)
-> ReadS [TimingInformation]
-> ReadPrec TimingInformation
-> ReadPrec [TimingInformation]
-> Read TimingInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimingInformation]
$creadListPrec :: ReadPrec [TimingInformation]
readPrec :: ReadPrec TimingInformation
$creadPrec :: ReadPrec TimingInformation
readList :: ReadS [TimingInformation]
$creadList :: ReadS [TimingInformation]
readsPrec :: Int -> ReadS TimingInformation
$creadsPrec :: Int -> ReadS TimingInformation
Prelude.Read, Int -> TimingInformation -> ShowS
[TimingInformation] -> ShowS
TimingInformation -> String
(Int -> TimingInformation -> ShowS)
-> (TimingInformation -> String)
-> ([TimingInformation] -> ShowS)
-> Show TimingInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimingInformation] -> ShowS
$cshowList :: [TimingInformation] -> ShowS
show :: TimingInformation -> String
$cshow :: TimingInformation -> String
showsPrec :: Int -> TimingInformation -> ShowS
$cshowsPrec :: Int -> TimingInformation -> ShowS
Prelude.Show, (forall x. TimingInformation -> Rep TimingInformation x)
-> (forall x. Rep TimingInformation x -> TimingInformation)
-> Generic TimingInformation
forall x. Rep TimingInformation x -> TimingInformation
forall x. TimingInformation -> Rep TimingInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimingInformation x -> TimingInformation
$cfrom :: forall x. TimingInformation -> Rep TimingInformation x
Prelude.Generic)

-- |
-- Create a value of 'TimingInformation' 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:
--
-- 'processingTimeMilliseconds', 'timingInformation_processingTimeMilliseconds' - The amount of time that QLDB spent on processing the command, measured
-- in milliseconds.
newTimingInformation ::
  TimingInformation
newTimingInformation :: TimingInformation
newTimingInformation =
  TimingInformation' :: Maybe Integer -> TimingInformation
TimingInformation'
    { $sel:processingTimeMilliseconds:TimingInformation' :: Maybe Integer
processingTimeMilliseconds =
        Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The amount of time that QLDB spent on processing the command, measured
-- in milliseconds.
timingInformation_processingTimeMilliseconds :: Lens.Lens' TimingInformation (Prelude.Maybe Prelude.Integer)
timingInformation_processingTimeMilliseconds :: (Maybe Integer -> f (Maybe Integer))
-> TimingInformation -> f TimingInformation
timingInformation_processingTimeMilliseconds = (TimingInformation -> Maybe Integer)
-> (TimingInformation -> Maybe Integer -> TimingInformation)
-> Lens
     TimingInformation TimingInformation (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimingInformation' {Maybe Integer
processingTimeMilliseconds :: Maybe Integer
$sel:processingTimeMilliseconds:TimingInformation' :: TimingInformation -> Maybe Integer
processingTimeMilliseconds} -> Maybe Integer
processingTimeMilliseconds) (\s :: TimingInformation
s@TimingInformation' {} Maybe Integer
a -> TimingInformation
s {$sel:processingTimeMilliseconds:TimingInformation' :: Maybe Integer
processingTimeMilliseconds = Maybe Integer
a} :: TimingInformation)

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

instance Prelude.Hashable TimingInformation

instance Prelude.NFData TimingInformation