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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(UpdateResult -> UpdateResult -> Bool)
-> (UpdateResult -> UpdateResult -> Bool) -> Eq UpdateResult
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]
(Int -> ReadS UpdateResult)
-> ReadS [UpdateResult]
-> ReadPrec UpdateResult
-> ReadPrec [UpdateResult]
-> Read 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
(Int -> UpdateResult -> ShowS)
-> (UpdateResult -> String)
-> ([UpdateResult] -> ShowS)
-> Show UpdateResult
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. UpdateResult -> Rep UpdateResult x)
-> (forall x. Rep UpdateResult x -> UpdateResult)
-> Generic UpdateResult
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' :: Maybe [Field] -> UpdateResult
UpdateResult' {$sel:generatedFields:UpdateResult' :: Maybe [Field]
generatedFields = Maybe [Field]
forall a. Maybe a
Prelude.Nothing}

-- | Values for fields generated during the request.
updateResult_generatedFields :: Lens.Lens' UpdateResult (Prelude.Maybe [Field])
updateResult_generatedFields :: (Maybe [Field] -> f (Maybe [Field]))
-> UpdateResult -> f UpdateResult
updateResult_generatedFields = (UpdateResult -> Maybe [Field])
-> (UpdateResult -> Maybe [Field] -> UpdateResult)
-> Lens UpdateResult UpdateResult (Maybe [Field]) (Maybe [Field])
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) ((Maybe [Field] -> f (Maybe [Field]))
 -> UpdateResult -> f UpdateResult)
-> ((Maybe [Field] -> f (Maybe [Field]))
    -> Maybe [Field] -> f (Maybe [Field]))
-> (Maybe [Field] -> f (Maybe [Field]))
-> UpdateResult
-> f UpdateResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Field] [Field] [Field] [Field]
-> Iso
     (Maybe [Field]) (Maybe [Field]) (Maybe [Field]) (Maybe [Field])
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 AnIso [Field] [Field] [Field] [Field]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON UpdateResult where
  parseJSON :: Value -> Parser UpdateResult
parseJSON =
    String
-> (Object -> Parser UpdateResult) -> Value -> Parser UpdateResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UpdateResult"
      ( \Object
x ->
          Maybe [Field] -> UpdateResult
UpdateResult'
            (Maybe [Field] -> UpdateResult)
-> Parser (Maybe [Field]) -> Parser UpdateResult
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Field]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"generatedFields"
                            Parser (Maybe (Maybe [Field]))
-> Maybe [Field] -> Parser (Maybe [Field])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Field]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable UpdateResult

instance Prelude.NFData UpdateResult