{-# 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.SecurityHub.Types.NoteUpdate
-- 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.SecurityHub.Types.NoteUpdate where

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

-- | The updated note.
--
-- /See:/ 'newNoteUpdate' smart constructor.
data NoteUpdate = NoteUpdate'
  { -- | The updated note text.
    NoteUpdate -> Text
text :: Prelude.Text,
    -- | The principal that updated the note.
    NoteUpdate -> Text
updatedBy :: Prelude.Text
  }
  deriving (NoteUpdate -> NoteUpdate -> Bool
(NoteUpdate -> NoteUpdate -> Bool)
-> (NoteUpdate -> NoteUpdate -> Bool) -> Eq NoteUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NoteUpdate -> NoteUpdate -> Bool
$c/= :: NoteUpdate -> NoteUpdate -> Bool
== :: NoteUpdate -> NoteUpdate -> Bool
$c== :: NoteUpdate -> NoteUpdate -> Bool
Prelude.Eq, ReadPrec [NoteUpdate]
ReadPrec NoteUpdate
Int -> ReadS NoteUpdate
ReadS [NoteUpdate]
(Int -> ReadS NoteUpdate)
-> ReadS [NoteUpdate]
-> ReadPrec NoteUpdate
-> ReadPrec [NoteUpdate]
-> Read NoteUpdate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NoteUpdate]
$creadListPrec :: ReadPrec [NoteUpdate]
readPrec :: ReadPrec NoteUpdate
$creadPrec :: ReadPrec NoteUpdate
readList :: ReadS [NoteUpdate]
$creadList :: ReadS [NoteUpdate]
readsPrec :: Int -> ReadS NoteUpdate
$creadsPrec :: Int -> ReadS NoteUpdate
Prelude.Read, Int -> NoteUpdate -> ShowS
[NoteUpdate] -> ShowS
NoteUpdate -> String
(Int -> NoteUpdate -> ShowS)
-> (NoteUpdate -> String)
-> ([NoteUpdate] -> ShowS)
-> Show NoteUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NoteUpdate] -> ShowS
$cshowList :: [NoteUpdate] -> ShowS
show :: NoteUpdate -> String
$cshow :: NoteUpdate -> String
showsPrec :: Int -> NoteUpdate -> ShowS
$cshowsPrec :: Int -> NoteUpdate -> ShowS
Prelude.Show, (forall x. NoteUpdate -> Rep NoteUpdate x)
-> (forall x. Rep NoteUpdate x -> NoteUpdate) -> Generic NoteUpdate
forall x. Rep NoteUpdate x -> NoteUpdate
forall x. NoteUpdate -> Rep NoteUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NoteUpdate x -> NoteUpdate
$cfrom :: forall x. NoteUpdate -> Rep NoteUpdate x
Prelude.Generic)

-- |
-- Create a value of 'NoteUpdate' 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:
--
-- 'text', 'noteUpdate_text' - The updated note text.
--
-- 'updatedBy', 'noteUpdate_updatedBy' - The principal that updated the note.
newNoteUpdate ::
  -- | 'text'
  Prelude.Text ->
  -- | 'updatedBy'
  Prelude.Text ->
  NoteUpdate
newNoteUpdate :: Text -> Text -> NoteUpdate
newNoteUpdate Text
pText_ Text
pUpdatedBy_ =
  NoteUpdate' :: Text -> Text -> NoteUpdate
NoteUpdate' {$sel:text:NoteUpdate' :: Text
text = Text
pText_, $sel:updatedBy:NoteUpdate' :: Text
updatedBy = Text
pUpdatedBy_}

-- | The updated note text.
noteUpdate_text :: Lens.Lens' NoteUpdate Prelude.Text
noteUpdate_text :: (Text -> f Text) -> NoteUpdate -> f NoteUpdate
noteUpdate_text = (NoteUpdate -> Text)
-> (NoteUpdate -> Text -> NoteUpdate)
-> Lens NoteUpdate NoteUpdate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NoteUpdate' {Text
text :: Text
$sel:text:NoteUpdate' :: NoteUpdate -> Text
text} -> Text
text) (\s :: NoteUpdate
s@NoteUpdate' {} Text
a -> NoteUpdate
s {$sel:text:NoteUpdate' :: Text
text = Text
a} :: NoteUpdate)

-- | The principal that updated the note.
noteUpdate_updatedBy :: Lens.Lens' NoteUpdate Prelude.Text
noteUpdate_updatedBy :: (Text -> f Text) -> NoteUpdate -> f NoteUpdate
noteUpdate_updatedBy = (NoteUpdate -> Text)
-> (NoteUpdate -> Text -> NoteUpdate)
-> Lens NoteUpdate NoteUpdate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NoteUpdate' {Text
updatedBy :: Text
$sel:updatedBy:NoteUpdate' :: NoteUpdate -> Text
updatedBy} -> Text
updatedBy) (\s :: NoteUpdate
s@NoteUpdate' {} Text
a -> NoteUpdate
s {$sel:updatedBy:NoteUpdate' :: Text
updatedBy = Text
a} :: NoteUpdate)

instance Prelude.Hashable NoteUpdate

instance Prelude.NFData NoteUpdate

instance Core.ToJSON NoteUpdate where
  toJSON :: NoteUpdate -> Value
toJSON NoteUpdate' {Text
updatedBy :: Text
text :: Text
$sel:updatedBy:NoteUpdate' :: NoteUpdate -> Text
$sel:text:NoteUpdate' :: NoteUpdate -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Text" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
text),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UpdatedBy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
updatedBy)
          ]
      )