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

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

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

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

instance Prelude.NFData AbortTransactionResult