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

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

-- | The user pool add-ons type.
--
-- /See:/ 'newUserPoolAddOnsType' smart constructor.
data UserPoolAddOnsType = UserPoolAddOnsType'
  { -- | The advanced security mode.
    UserPoolAddOnsType -> AdvancedSecurityModeType
advancedSecurityMode :: AdvancedSecurityModeType
  }
  deriving (UserPoolAddOnsType -> UserPoolAddOnsType -> Bool
(UserPoolAddOnsType -> UserPoolAddOnsType -> Bool)
-> (UserPoolAddOnsType -> UserPoolAddOnsType -> Bool)
-> Eq UserPoolAddOnsType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserPoolAddOnsType -> UserPoolAddOnsType -> Bool
$c/= :: UserPoolAddOnsType -> UserPoolAddOnsType -> Bool
== :: UserPoolAddOnsType -> UserPoolAddOnsType -> Bool
$c== :: UserPoolAddOnsType -> UserPoolAddOnsType -> Bool
Prelude.Eq, ReadPrec [UserPoolAddOnsType]
ReadPrec UserPoolAddOnsType
Int -> ReadS UserPoolAddOnsType
ReadS [UserPoolAddOnsType]
(Int -> ReadS UserPoolAddOnsType)
-> ReadS [UserPoolAddOnsType]
-> ReadPrec UserPoolAddOnsType
-> ReadPrec [UserPoolAddOnsType]
-> Read UserPoolAddOnsType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserPoolAddOnsType]
$creadListPrec :: ReadPrec [UserPoolAddOnsType]
readPrec :: ReadPrec UserPoolAddOnsType
$creadPrec :: ReadPrec UserPoolAddOnsType
readList :: ReadS [UserPoolAddOnsType]
$creadList :: ReadS [UserPoolAddOnsType]
readsPrec :: Int -> ReadS UserPoolAddOnsType
$creadsPrec :: Int -> ReadS UserPoolAddOnsType
Prelude.Read, Int -> UserPoolAddOnsType -> ShowS
[UserPoolAddOnsType] -> ShowS
UserPoolAddOnsType -> String
(Int -> UserPoolAddOnsType -> ShowS)
-> (UserPoolAddOnsType -> String)
-> ([UserPoolAddOnsType] -> ShowS)
-> Show UserPoolAddOnsType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserPoolAddOnsType] -> ShowS
$cshowList :: [UserPoolAddOnsType] -> ShowS
show :: UserPoolAddOnsType -> String
$cshow :: UserPoolAddOnsType -> String
showsPrec :: Int -> UserPoolAddOnsType -> ShowS
$cshowsPrec :: Int -> UserPoolAddOnsType -> ShowS
Prelude.Show, (forall x. UserPoolAddOnsType -> Rep UserPoolAddOnsType x)
-> (forall x. Rep UserPoolAddOnsType x -> UserPoolAddOnsType)
-> Generic UserPoolAddOnsType
forall x. Rep UserPoolAddOnsType x -> UserPoolAddOnsType
forall x. UserPoolAddOnsType -> Rep UserPoolAddOnsType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserPoolAddOnsType x -> UserPoolAddOnsType
$cfrom :: forall x. UserPoolAddOnsType -> Rep UserPoolAddOnsType x
Prelude.Generic)

-- |
-- Create a value of 'UserPoolAddOnsType' 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:
--
-- 'advancedSecurityMode', 'userPoolAddOnsType_advancedSecurityMode' - The advanced security mode.
newUserPoolAddOnsType ::
  -- | 'advancedSecurityMode'
  AdvancedSecurityModeType ->
  UserPoolAddOnsType
newUserPoolAddOnsType :: AdvancedSecurityModeType -> UserPoolAddOnsType
newUserPoolAddOnsType AdvancedSecurityModeType
pAdvancedSecurityMode_ =
  UserPoolAddOnsType' :: AdvancedSecurityModeType -> UserPoolAddOnsType
UserPoolAddOnsType'
    { $sel:advancedSecurityMode:UserPoolAddOnsType' :: AdvancedSecurityModeType
advancedSecurityMode =
        AdvancedSecurityModeType
pAdvancedSecurityMode_
    }

-- | The advanced security mode.
userPoolAddOnsType_advancedSecurityMode :: Lens.Lens' UserPoolAddOnsType AdvancedSecurityModeType
userPoolAddOnsType_advancedSecurityMode :: (AdvancedSecurityModeType -> f AdvancedSecurityModeType)
-> UserPoolAddOnsType -> f UserPoolAddOnsType
userPoolAddOnsType_advancedSecurityMode = (UserPoolAddOnsType -> AdvancedSecurityModeType)
-> (UserPoolAddOnsType
    -> AdvancedSecurityModeType -> UserPoolAddOnsType)
-> Lens
     UserPoolAddOnsType
     UserPoolAddOnsType
     AdvancedSecurityModeType
     AdvancedSecurityModeType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPoolAddOnsType' {AdvancedSecurityModeType
advancedSecurityMode :: AdvancedSecurityModeType
$sel:advancedSecurityMode:UserPoolAddOnsType' :: UserPoolAddOnsType -> AdvancedSecurityModeType
advancedSecurityMode} -> AdvancedSecurityModeType
advancedSecurityMode) (\s :: UserPoolAddOnsType
s@UserPoolAddOnsType' {} AdvancedSecurityModeType
a -> UserPoolAddOnsType
s {$sel:advancedSecurityMode:UserPoolAddOnsType' :: AdvancedSecurityModeType
advancedSecurityMode = AdvancedSecurityModeType
a} :: UserPoolAddOnsType)

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

instance Prelude.Hashable UserPoolAddOnsType

instance Prelude.NFData UserPoolAddOnsType

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