{-# 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.CompromisedCredentialsRiskConfigurationType
-- 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.CompromisedCredentialsRiskConfigurationType where

import Amazonka.CognitoIdentityProvider.Types.CompromisedCredentialsActionsType
import Amazonka.CognitoIdentityProvider.Types.EventFilterType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The compromised credentials risk configuration type.
--
-- /See:/ 'newCompromisedCredentialsRiskConfigurationType' smart constructor.
data CompromisedCredentialsRiskConfigurationType = CompromisedCredentialsRiskConfigurationType'
  { -- | Perform the action for these events. The default is to perform all
    -- events if no event filter is specified.
    CompromisedCredentialsRiskConfigurationType
-> Maybe [EventFilterType]
eventFilter :: Prelude.Maybe [EventFilterType],
    -- | The compromised credentials risk configuration actions.
    CompromisedCredentialsRiskConfigurationType
-> CompromisedCredentialsActionsType
actions :: CompromisedCredentialsActionsType
  }
  deriving (CompromisedCredentialsRiskConfigurationType
-> CompromisedCredentialsRiskConfigurationType -> Bool
(CompromisedCredentialsRiskConfigurationType
 -> CompromisedCredentialsRiskConfigurationType -> Bool)
-> (CompromisedCredentialsRiskConfigurationType
    -> CompromisedCredentialsRiskConfigurationType -> Bool)
-> Eq CompromisedCredentialsRiskConfigurationType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompromisedCredentialsRiskConfigurationType
-> CompromisedCredentialsRiskConfigurationType -> Bool
$c/= :: CompromisedCredentialsRiskConfigurationType
-> CompromisedCredentialsRiskConfigurationType -> Bool
== :: CompromisedCredentialsRiskConfigurationType
-> CompromisedCredentialsRiskConfigurationType -> Bool
$c== :: CompromisedCredentialsRiskConfigurationType
-> CompromisedCredentialsRiskConfigurationType -> Bool
Prelude.Eq, ReadPrec [CompromisedCredentialsRiskConfigurationType]
ReadPrec CompromisedCredentialsRiskConfigurationType
Int -> ReadS CompromisedCredentialsRiskConfigurationType
ReadS [CompromisedCredentialsRiskConfigurationType]
(Int -> ReadS CompromisedCredentialsRiskConfigurationType)
-> ReadS [CompromisedCredentialsRiskConfigurationType]
-> ReadPrec CompromisedCredentialsRiskConfigurationType
-> ReadPrec [CompromisedCredentialsRiskConfigurationType]
-> Read CompromisedCredentialsRiskConfigurationType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompromisedCredentialsRiskConfigurationType]
$creadListPrec :: ReadPrec [CompromisedCredentialsRiskConfigurationType]
readPrec :: ReadPrec CompromisedCredentialsRiskConfigurationType
$creadPrec :: ReadPrec CompromisedCredentialsRiskConfigurationType
readList :: ReadS [CompromisedCredentialsRiskConfigurationType]
$creadList :: ReadS [CompromisedCredentialsRiskConfigurationType]
readsPrec :: Int -> ReadS CompromisedCredentialsRiskConfigurationType
$creadsPrec :: Int -> ReadS CompromisedCredentialsRiskConfigurationType
Prelude.Read, Int -> CompromisedCredentialsRiskConfigurationType -> ShowS
[CompromisedCredentialsRiskConfigurationType] -> ShowS
CompromisedCredentialsRiskConfigurationType -> String
(Int -> CompromisedCredentialsRiskConfigurationType -> ShowS)
-> (CompromisedCredentialsRiskConfigurationType -> String)
-> ([CompromisedCredentialsRiskConfigurationType] -> ShowS)
-> Show CompromisedCredentialsRiskConfigurationType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompromisedCredentialsRiskConfigurationType] -> ShowS
$cshowList :: [CompromisedCredentialsRiskConfigurationType] -> ShowS
show :: CompromisedCredentialsRiskConfigurationType -> String
$cshow :: CompromisedCredentialsRiskConfigurationType -> String
showsPrec :: Int -> CompromisedCredentialsRiskConfigurationType -> ShowS
$cshowsPrec :: Int -> CompromisedCredentialsRiskConfigurationType -> ShowS
Prelude.Show, (forall x.
 CompromisedCredentialsRiskConfigurationType
 -> Rep CompromisedCredentialsRiskConfigurationType x)
-> (forall x.
    Rep CompromisedCredentialsRiskConfigurationType x
    -> CompromisedCredentialsRiskConfigurationType)
-> Generic CompromisedCredentialsRiskConfigurationType
forall x.
Rep CompromisedCredentialsRiskConfigurationType x
-> CompromisedCredentialsRiskConfigurationType
forall x.
CompromisedCredentialsRiskConfigurationType
-> Rep CompromisedCredentialsRiskConfigurationType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CompromisedCredentialsRiskConfigurationType x
-> CompromisedCredentialsRiskConfigurationType
$cfrom :: forall x.
CompromisedCredentialsRiskConfigurationType
-> Rep CompromisedCredentialsRiskConfigurationType x
Prelude.Generic)

-- |
-- Create a value of 'CompromisedCredentialsRiskConfigurationType' 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:
--
-- 'eventFilter', 'compromisedCredentialsRiskConfigurationType_eventFilter' - Perform the action for these events. The default is to perform all
-- events if no event filter is specified.
--
-- 'actions', 'compromisedCredentialsRiskConfigurationType_actions' - The compromised credentials risk configuration actions.
newCompromisedCredentialsRiskConfigurationType ::
  -- | 'actions'
  CompromisedCredentialsActionsType ->
  CompromisedCredentialsRiskConfigurationType
newCompromisedCredentialsRiskConfigurationType :: CompromisedCredentialsActionsType
-> CompromisedCredentialsRiskConfigurationType
newCompromisedCredentialsRiskConfigurationType
  CompromisedCredentialsActionsType
pActions_ =
    CompromisedCredentialsRiskConfigurationType' :: Maybe [EventFilterType]
-> CompromisedCredentialsActionsType
-> CompromisedCredentialsRiskConfigurationType
CompromisedCredentialsRiskConfigurationType'
      { $sel:eventFilter:CompromisedCredentialsRiskConfigurationType' :: Maybe [EventFilterType]
eventFilter =
          Maybe [EventFilterType]
forall a. Maybe a
Prelude.Nothing,
        $sel:actions:CompromisedCredentialsRiskConfigurationType' :: CompromisedCredentialsActionsType
actions = CompromisedCredentialsActionsType
pActions_
      }

-- | Perform the action for these events. The default is to perform all
-- events if no event filter is specified.
compromisedCredentialsRiskConfigurationType_eventFilter :: Lens.Lens' CompromisedCredentialsRiskConfigurationType (Prelude.Maybe [EventFilterType])
compromisedCredentialsRiskConfigurationType_eventFilter :: (Maybe [EventFilterType] -> f (Maybe [EventFilterType]))
-> CompromisedCredentialsRiskConfigurationType
-> f CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfigurationType_eventFilter = (CompromisedCredentialsRiskConfigurationType
 -> Maybe [EventFilterType])
-> (CompromisedCredentialsRiskConfigurationType
    -> Maybe [EventFilterType]
    -> CompromisedCredentialsRiskConfigurationType)
-> Lens
     CompromisedCredentialsRiskConfigurationType
     CompromisedCredentialsRiskConfigurationType
     (Maybe [EventFilterType])
     (Maybe [EventFilterType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompromisedCredentialsRiskConfigurationType' {Maybe [EventFilterType]
eventFilter :: Maybe [EventFilterType]
$sel:eventFilter:CompromisedCredentialsRiskConfigurationType' :: CompromisedCredentialsRiskConfigurationType
-> Maybe [EventFilterType]
eventFilter} -> Maybe [EventFilterType]
eventFilter) (\s :: CompromisedCredentialsRiskConfigurationType
s@CompromisedCredentialsRiskConfigurationType' {} Maybe [EventFilterType]
a -> CompromisedCredentialsRiskConfigurationType
s {$sel:eventFilter:CompromisedCredentialsRiskConfigurationType' :: Maybe [EventFilterType]
eventFilter = Maybe [EventFilterType]
a} :: CompromisedCredentialsRiskConfigurationType) ((Maybe [EventFilterType] -> f (Maybe [EventFilterType]))
 -> CompromisedCredentialsRiskConfigurationType
 -> f CompromisedCredentialsRiskConfigurationType)
-> ((Maybe [EventFilterType] -> f (Maybe [EventFilterType]))
    -> Maybe [EventFilterType] -> f (Maybe [EventFilterType]))
-> (Maybe [EventFilterType] -> f (Maybe [EventFilterType]))
-> CompromisedCredentialsRiskConfigurationType
-> f CompromisedCredentialsRiskConfigurationType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EventFilterType]
  [EventFilterType]
  [EventFilterType]
  [EventFilterType]
-> Iso
     (Maybe [EventFilterType])
     (Maybe [EventFilterType])
     (Maybe [EventFilterType])
     (Maybe [EventFilterType])
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
  [EventFilterType]
  [EventFilterType]
  [EventFilterType]
  [EventFilterType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The compromised credentials risk configuration actions.
compromisedCredentialsRiskConfigurationType_actions :: Lens.Lens' CompromisedCredentialsRiskConfigurationType CompromisedCredentialsActionsType
compromisedCredentialsRiskConfigurationType_actions :: (CompromisedCredentialsActionsType
 -> f CompromisedCredentialsActionsType)
-> CompromisedCredentialsRiskConfigurationType
-> f CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfigurationType_actions = (CompromisedCredentialsRiskConfigurationType
 -> CompromisedCredentialsActionsType)
-> (CompromisedCredentialsRiskConfigurationType
    -> CompromisedCredentialsActionsType
    -> CompromisedCredentialsRiskConfigurationType)
-> Lens
     CompromisedCredentialsRiskConfigurationType
     CompromisedCredentialsRiskConfigurationType
     CompromisedCredentialsActionsType
     CompromisedCredentialsActionsType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompromisedCredentialsRiskConfigurationType' {CompromisedCredentialsActionsType
actions :: CompromisedCredentialsActionsType
$sel:actions:CompromisedCredentialsRiskConfigurationType' :: CompromisedCredentialsRiskConfigurationType
-> CompromisedCredentialsActionsType
actions} -> CompromisedCredentialsActionsType
actions) (\s :: CompromisedCredentialsRiskConfigurationType
s@CompromisedCredentialsRiskConfigurationType' {} CompromisedCredentialsActionsType
a -> CompromisedCredentialsRiskConfigurationType
s {$sel:actions:CompromisedCredentialsRiskConfigurationType' :: CompromisedCredentialsActionsType
actions = CompromisedCredentialsActionsType
a} :: CompromisedCredentialsRiskConfigurationType)

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

instance
  Prelude.Hashable
    CompromisedCredentialsRiskConfigurationType

instance
  Prelude.NFData
    CompromisedCredentialsRiskConfigurationType

instance
  Core.ToJSON
    CompromisedCredentialsRiskConfigurationType
  where
  toJSON :: CompromisedCredentialsRiskConfigurationType -> Value
toJSON
    CompromisedCredentialsRiskConfigurationType' {Maybe [EventFilterType]
CompromisedCredentialsActionsType
actions :: CompromisedCredentialsActionsType
eventFilter :: Maybe [EventFilterType]
$sel:actions:CompromisedCredentialsRiskConfigurationType' :: CompromisedCredentialsRiskConfigurationType
-> CompromisedCredentialsActionsType
$sel:eventFilter:CompromisedCredentialsRiskConfigurationType' :: CompromisedCredentialsRiskConfigurationType
-> Maybe [EventFilterType]
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"EventFilter" Text -> [EventFilterType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([EventFilterType] -> Pair)
-> Maybe [EventFilterType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EventFilterType]
eventFilter,
              Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Actions" Text -> CompromisedCredentialsActionsType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CompromisedCredentialsActionsType
actions)
            ]
        )