{-# 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.CognitoIdentityProvider.Types.CompromisedCredentialsActionsType
-- 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.CognitoIdentityProvider.Types.CompromisedCredentialsActionsType where

import Amazonka.CognitoIdentityProvider.Types.CompromisedCredentialsEventActionType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The compromised credentials actions type
--
-- /See:/ 'newCompromisedCredentialsActionsType' smart constructor.
data CompromisedCredentialsActionsType = CompromisedCredentialsActionsType'
  { -- | The event action.
    CompromisedCredentialsActionsType
-> CompromisedCredentialsEventActionType
eventAction :: CompromisedCredentialsEventActionType
  }
  deriving (CompromisedCredentialsActionsType
-> CompromisedCredentialsActionsType -> Bool
(CompromisedCredentialsActionsType
 -> CompromisedCredentialsActionsType -> Bool)
-> (CompromisedCredentialsActionsType
    -> CompromisedCredentialsActionsType -> Bool)
-> Eq CompromisedCredentialsActionsType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompromisedCredentialsActionsType
-> CompromisedCredentialsActionsType -> Bool
$c/= :: CompromisedCredentialsActionsType
-> CompromisedCredentialsActionsType -> Bool
== :: CompromisedCredentialsActionsType
-> CompromisedCredentialsActionsType -> Bool
$c== :: CompromisedCredentialsActionsType
-> CompromisedCredentialsActionsType -> Bool
Prelude.Eq, ReadPrec [CompromisedCredentialsActionsType]
ReadPrec CompromisedCredentialsActionsType
Int -> ReadS CompromisedCredentialsActionsType
ReadS [CompromisedCredentialsActionsType]
(Int -> ReadS CompromisedCredentialsActionsType)
-> ReadS [CompromisedCredentialsActionsType]
-> ReadPrec CompromisedCredentialsActionsType
-> ReadPrec [CompromisedCredentialsActionsType]
-> Read CompromisedCredentialsActionsType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompromisedCredentialsActionsType]
$creadListPrec :: ReadPrec [CompromisedCredentialsActionsType]
readPrec :: ReadPrec CompromisedCredentialsActionsType
$creadPrec :: ReadPrec CompromisedCredentialsActionsType
readList :: ReadS [CompromisedCredentialsActionsType]
$creadList :: ReadS [CompromisedCredentialsActionsType]
readsPrec :: Int -> ReadS CompromisedCredentialsActionsType
$creadsPrec :: Int -> ReadS CompromisedCredentialsActionsType
Prelude.Read, Int -> CompromisedCredentialsActionsType -> ShowS
[CompromisedCredentialsActionsType] -> ShowS
CompromisedCredentialsActionsType -> String
(Int -> CompromisedCredentialsActionsType -> ShowS)
-> (CompromisedCredentialsActionsType -> String)
-> ([CompromisedCredentialsActionsType] -> ShowS)
-> Show CompromisedCredentialsActionsType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompromisedCredentialsActionsType] -> ShowS
$cshowList :: [CompromisedCredentialsActionsType] -> ShowS
show :: CompromisedCredentialsActionsType -> String
$cshow :: CompromisedCredentialsActionsType -> String
showsPrec :: Int -> CompromisedCredentialsActionsType -> ShowS
$cshowsPrec :: Int -> CompromisedCredentialsActionsType -> ShowS
Prelude.Show, (forall x.
 CompromisedCredentialsActionsType
 -> Rep CompromisedCredentialsActionsType x)
-> (forall x.
    Rep CompromisedCredentialsActionsType x
    -> CompromisedCredentialsActionsType)
-> Generic CompromisedCredentialsActionsType
forall x.
Rep CompromisedCredentialsActionsType x
-> CompromisedCredentialsActionsType
forall x.
CompromisedCredentialsActionsType
-> Rep CompromisedCredentialsActionsType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CompromisedCredentialsActionsType x
-> CompromisedCredentialsActionsType
$cfrom :: forall x.
CompromisedCredentialsActionsType
-> Rep CompromisedCredentialsActionsType x
Prelude.Generic)

-- |
-- Create a value of 'CompromisedCredentialsActionsType' 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:
--
-- 'eventAction', 'compromisedCredentialsActionsType_eventAction' - The event action.
newCompromisedCredentialsActionsType ::
  -- | 'eventAction'
  CompromisedCredentialsEventActionType ->
  CompromisedCredentialsActionsType
newCompromisedCredentialsActionsType :: CompromisedCredentialsEventActionType
-> CompromisedCredentialsActionsType
newCompromisedCredentialsActionsType CompromisedCredentialsEventActionType
pEventAction_ =
  CompromisedCredentialsActionsType' :: CompromisedCredentialsEventActionType
-> CompromisedCredentialsActionsType
CompromisedCredentialsActionsType'
    { $sel:eventAction:CompromisedCredentialsActionsType' :: CompromisedCredentialsEventActionType
eventAction =
        CompromisedCredentialsEventActionType
pEventAction_
    }

-- | The event action.
compromisedCredentialsActionsType_eventAction :: Lens.Lens' CompromisedCredentialsActionsType CompromisedCredentialsEventActionType
compromisedCredentialsActionsType_eventAction :: (CompromisedCredentialsEventActionType
 -> f CompromisedCredentialsEventActionType)
-> CompromisedCredentialsActionsType
-> f CompromisedCredentialsActionsType
compromisedCredentialsActionsType_eventAction = (CompromisedCredentialsActionsType
 -> CompromisedCredentialsEventActionType)
-> (CompromisedCredentialsActionsType
    -> CompromisedCredentialsEventActionType
    -> CompromisedCredentialsActionsType)
-> Lens
     CompromisedCredentialsActionsType
     CompromisedCredentialsActionsType
     CompromisedCredentialsEventActionType
     CompromisedCredentialsEventActionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompromisedCredentialsActionsType' {CompromisedCredentialsEventActionType
eventAction :: CompromisedCredentialsEventActionType
$sel:eventAction:CompromisedCredentialsActionsType' :: CompromisedCredentialsActionsType
-> CompromisedCredentialsEventActionType
eventAction} -> CompromisedCredentialsEventActionType
eventAction) (\s :: CompromisedCredentialsActionsType
s@CompromisedCredentialsActionsType' {} CompromisedCredentialsEventActionType
a -> CompromisedCredentialsActionsType
s {$sel:eventAction:CompromisedCredentialsActionsType' :: CompromisedCredentialsEventActionType
eventAction = CompromisedCredentialsEventActionType
a} :: CompromisedCredentialsActionsType)

instance
  Core.FromJSON
    CompromisedCredentialsActionsType
  where
  parseJSON :: Value -> Parser CompromisedCredentialsActionsType
parseJSON =
    String
-> (Object -> Parser CompromisedCredentialsActionsType)
-> Value
-> Parser CompromisedCredentialsActionsType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CompromisedCredentialsActionsType"
      ( \Object
x ->
          CompromisedCredentialsEventActionType
-> CompromisedCredentialsActionsType
CompromisedCredentialsActionsType'
            (CompromisedCredentialsEventActionType
 -> CompromisedCredentialsActionsType)
-> Parser CompromisedCredentialsEventActionType
-> Parser CompromisedCredentialsActionsType
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser CompromisedCredentialsEventActionType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"EventAction")
      )

instance
  Prelude.Hashable
    CompromisedCredentialsActionsType

instance
  Prelude.NFData
    CompromisedCredentialsActionsType

instance
  Core.ToJSON
    CompromisedCredentialsActionsType
  where
  toJSON :: CompromisedCredentialsActionsType -> Value
toJSON CompromisedCredentialsActionsType' {CompromisedCredentialsEventActionType
eventAction :: CompromisedCredentialsEventActionType
$sel:eventAction:CompromisedCredentialsActionsType' :: CompromisedCredentialsActionsType
-> CompromisedCredentialsEventActionType
..} =
    [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
"EventAction" Text -> CompromisedCredentialsEventActionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CompromisedCredentialsEventActionType
eventAction)]
      )