{-# 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.RDSData.Types.UpdateResult
-- 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.RDSData.Types.UpdateResult 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.RDSData.Types.Field

-- | The response elements represent the results of an update.
--
-- /See:/ 'newUpdateResult' smart constructor.
data UpdateResult = UpdateResult'
  { -- | Values for fields generated during the request.
    UpdateResult -> Maybe [Field]
generatedFields :: Prelude.Maybe [Field]
  }
  deriving (UpdateResult -> UpdateResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResult -> UpdateResult -> Bool
$c/= :: UpdateResult -> UpdateResult -> Bool
== :: UpdateResult -> UpdateResult -> Bool
$c== :: UpdateResult -> UpdateResult -> Bool
Prelude.Eq, ReadPrec [UpdateResult]
ReadPrec UpdateResult
Int -> ReadS UpdateResult
ReadS [UpdateResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResult]
$creadListPrec :: ReadPrec [UpdateResult]
readPrec :: ReadPrec UpdateResult
$creadPrec :: ReadPrec UpdateResult
readList :: ReadS [UpdateResult]
$creadList :: ReadS [UpdateResult]
readsPrec :: Int -> ReadS UpdateResult
$creadsPrec :: Int -> ReadS UpdateResult
Prelude.Read, Int -> UpdateResult -> ShowS
[UpdateResult] -> ShowS
UpdateResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResult] -> ShowS
$cshowList :: [UpdateResult] -> ShowS
show :: UpdateResult -> String
$cshow :: UpdateResult -> String
showsPrec :: Int -> UpdateResult -> ShowS
$cshowsPrec :: Int -> UpdateResult -> ShowS
Prelude.Show, forall x. Rep UpdateResult x -> UpdateResult
forall x. UpdateResult -> Rep UpdateResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResult x -> UpdateResult
$cfrom :: forall x. UpdateResult -> Rep UpdateResult x
Prelude.Generic)

-- |
-- Create a value of 'UpdateResult' 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:
--
-- 'generatedFields', 'updateResult_generatedFields' - Values for fields generated during the request.
newUpdateResult ::
  UpdateResult
newUpdateResult :: UpdateResult
newUpdateResult =
  UpdateResult' {$sel:generatedFields:UpdateResult' :: Maybe [Field]
generatedFields = forall a. Maybe a
Prelude.Nothing}

-- | Values for fields generated during the request.
updateResult_generatedFields :: Lens.Lens' UpdateResult (Prelude.Maybe [Field])
updateResult_generatedFields :: Lens' UpdateResult (Maybe [Field])
updateResult_generatedFields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResult' {Maybe [Field]
generatedFields :: Maybe [Field]
$sel:generatedFields:UpdateResult' :: UpdateResult -> Maybe [Field]
generatedFields} -> Maybe [Field]
generatedFields) (\s :: UpdateResult
s@UpdateResult' {} Maybe [Field]
a -> UpdateResult
s {$sel:generatedFields:UpdateResult' :: Maybe [Field]
generatedFields = Maybe [Field]
a} :: UpdateResult) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON UpdateResult where
  parseJSON :: Value -> Parser UpdateResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpdateResult"
      ( \Object
x ->
          Maybe [Field] -> UpdateResult
UpdateResult'
            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
"generatedFields"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable UpdateResult where
  hashWithSalt :: Int -> UpdateResult -> Int
hashWithSalt Int
_salt UpdateResult' {Maybe [Field]
generatedFields :: Maybe [Field]
$sel:generatedFields:UpdateResult' :: UpdateResult -> Maybe [Field]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Field]
generatedFields

instance Prelude.NFData UpdateResult where
  rnf :: UpdateResult -> ()
rnf UpdateResult' {Maybe [Field]
generatedFields :: Maybe [Field]
$sel:generatedFields:UpdateResult' :: UpdateResult -> Maybe [Field]
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe [Field]
generatedFields