{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.SetRiskConfiguration
-- 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)
--
-- Configures actions on detected risks. To delete the risk configuration
-- for @UserPoolId@ or @ClientId@, pass null values for all four
-- configuration types.
--
-- To enable Amazon Cognito advanced security features, update the user
-- pool to include the @UserPoolAddOns@ key@AdvancedSecurityMode@.
module Amazonka.CognitoIdentityProvider.SetRiskConfiguration
  ( -- * Creating a Request
    SetRiskConfiguration (..),
    newSetRiskConfiguration,

    -- * Request Lenses
    setRiskConfiguration_riskExceptionConfiguration,
    setRiskConfiguration_clientId,
    setRiskConfiguration_accountTakeoverRiskConfiguration,
    setRiskConfiguration_compromisedCredentialsRiskConfiguration,
    setRiskConfiguration_userPoolId,

    -- * Destructuring the Response
    SetRiskConfigurationResponse (..),
    newSetRiskConfigurationResponse,

    -- * Response Lenses
    setRiskConfigurationResponse_httpStatus,
    setRiskConfigurationResponse_riskConfiguration,
  )
where

import Amazonka.CognitoIdentityProvider.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newSetRiskConfiguration' smart constructor.
data SetRiskConfiguration = SetRiskConfiguration'
  { -- | The configuration to override the risk decision.
    SetRiskConfiguration -> Maybe RiskExceptionConfigurationType
riskExceptionConfiguration :: Prelude.Maybe RiskExceptionConfigurationType,
    -- | The app client ID. If @ClientId@ is null, then the risk configuration is
    -- mapped to @userPoolId@. When the client ID is null, the same risk
    -- configuration is applied to all the clients in the userPool.
    --
    -- Otherwise, @ClientId@ is mapped to the client. When the client ID is not
    -- null, the user pool configuration is overridden and the risk
    -- configuration for the client is used instead.
    SetRiskConfiguration -> Maybe (Sensitive Text)
clientId :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The account takeover risk configuration.
    SetRiskConfiguration -> Maybe AccountTakeoverRiskConfigurationType
accountTakeoverRiskConfiguration :: Prelude.Maybe AccountTakeoverRiskConfigurationType,
    -- | The compromised credentials risk configuration.
    SetRiskConfiguration
-> Maybe CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfiguration :: Prelude.Maybe CompromisedCredentialsRiskConfigurationType,
    -- | The user pool ID.
    SetRiskConfiguration -> Text
userPoolId :: Prelude.Text
  }
  deriving (SetRiskConfiguration -> SetRiskConfiguration -> Bool
(SetRiskConfiguration -> SetRiskConfiguration -> Bool)
-> (SetRiskConfiguration -> SetRiskConfiguration -> Bool)
-> Eq SetRiskConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetRiskConfiguration -> SetRiskConfiguration -> Bool
$c/= :: SetRiskConfiguration -> SetRiskConfiguration -> Bool
== :: SetRiskConfiguration -> SetRiskConfiguration -> Bool
$c== :: SetRiskConfiguration -> SetRiskConfiguration -> Bool
Prelude.Eq, Int -> SetRiskConfiguration -> ShowS
[SetRiskConfiguration] -> ShowS
SetRiskConfiguration -> String
(Int -> SetRiskConfiguration -> ShowS)
-> (SetRiskConfiguration -> String)
-> ([SetRiskConfiguration] -> ShowS)
-> Show SetRiskConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetRiskConfiguration] -> ShowS
$cshowList :: [SetRiskConfiguration] -> ShowS
show :: SetRiskConfiguration -> String
$cshow :: SetRiskConfiguration -> String
showsPrec :: Int -> SetRiskConfiguration -> ShowS
$cshowsPrec :: Int -> SetRiskConfiguration -> ShowS
Prelude.Show, (forall x. SetRiskConfiguration -> Rep SetRiskConfiguration x)
-> (forall x. Rep SetRiskConfiguration x -> SetRiskConfiguration)
-> Generic SetRiskConfiguration
forall x. Rep SetRiskConfiguration x -> SetRiskConfiguration
forall x. SetRiskConfiguration -> Rep SetRiskConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetRiskConfiguration x -> SetRiskConfiguration
$cfrom :: forall x. SetRiskConfiguration -> Rep SetRiskConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'SetRiskConfiguration' 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:
--
-- 'riskExceptionConfiguration', 'setRiskConfiguration_riskExceptionConfiguration' - The configuration to override the risk decision.
--
-- 'clientId', 'setRiskConfiguration_clientId' - The app client ID. If @ClientId@ is null, then the risk configuration is
-- mapped to @userPoolId@. When the client ID is null, the same risk
-- configuration is applied to all the clients in the userPool.
--
-- Otherwise, @ClientId@ is mapped to the client. When the client ID is not
-- null, the user pool configuration is overridden and the risk
-- configuration for the client is used instead.
--
-- 'accountTakeoverRiskConfiguration', 'setRiskConfiguration_accountTakeoverRiskConfiguration' - The account takeover risk configuration.
--
-- 'compromisedCredentialsRiskConfiguration', 'setRiskConfiguration_compromisedCredentialsRiskConfiguration' - The compromised credentials risk configuration.
--
-- 'userPoolId', 'setRiskConfiguration_userPoolId' - The user pool ID.
newSetRiskConfiguration ::
  -- | 'userPoolId'
  Prelude.Text ->
  SetRiskConfiguration
newSetRiskConfiguration :: Text -> SetRiskConfiguration
newSetRiskConfiguration Text
pUserPoolId_ =
  SetRiskConfiguration' :: Maybe RiskExceptionConfigurationType
-> Maybe (Sensitive Text)
-> Maybe AccountTakeoverRiskConfigurationType
-> Maybe CompromisedCredentialsRiskConfigurationType
-> Text
-> SetRiskConfiguration
SetRiskConfiguration'
    { $sel:riskExceptionConfiguration:SetRiskConfiguration' :: Maybe RiskExceptionConfigurationType
riskExceptionConfiguration =
        Maybe RiskExceptionConfigurationType
forall a. Maybe a
Prelude.Nothing,
      $sel:clientId:SetRiskConfiguration' :: Maybe (Sensitive Text)
clientId = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:accountTakeoverRiskConfiguration:SetRiskConfiguration' :: Maybe AccountTakeoverRiskConfigurationType
accountTakeoverRiskConfiguration = Maybe AccountTakeoverRiskConfigurationType
forall a. Maybe a
Prelude.Nothing,
      $sel:compromisedCredentialsRiskConfiguration:SetRiskConfiguration' :: Maybe CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfiguration =
        Maybe CompromisedCredentialsRiskConfigurationType
forall a. Maybe a
Prelude.Nothing,
      $sel:userPoolId:SetRiskConfiguration' :: Text
userPoolId = Text
pUserPoolId_
    }

-- | The configuration to override the risk decision.
setRiskConfiguration_riskExceptionConfiguration :: Lens.Lens' SetRiskConfiguration (Prelude.Maybe RiskExceptionConfigurationType)
setRiskConfiguration_riskExceptionConfiguration :: (Maybe RiskExceptionConfigurationType
 -> f (Maybe RiskExceptionConfigurationType))
-> SetRiskConfiguration -> f SetRiskConfiguration
setRiskConfiguration_riskExceptionConfiguration = (SetRiskConfiguration -> Maybe RiskExceptionConfigurationType)
-> (SetRiskConfiguration
    -> Maybe RiskExceptionConfigurationType -> SetRiskConfiguration)
-> Lens
     SetRiskConfiguration
     SetRiskConfiguration
     (Maybe RiskExceptionConfigurationType)
     (Maybe RiskExceptionConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRiskConfiguration' {Maybe RiskExceptionConfigurationType
riskExceptionConfiguration :: Maybe RiskExceptionConfigurationType
$sel:riskExceptionConfiguration:SetRiskConfiguration' :: SetRiskConfiguration -> Maybe RiskExceptionConfigurationType
riskExceptionConfiguration} -> Maybe RiskExceptionConfigurationType
riskExceptionConfiguration) (\s :: SetRiskConfiguration
s@SetRiskConfiguration' {} Maybe RiskExceptionConfigurationType
a -> SetRiskConfiguration
s {$sel:riskExceptionConfiguration:SetRiskConfiguration' :: Maybe RiskExceptionConfigurationType
riskExceptionConfiguration = Maybe RiskExceptionConfigurationType
a} :: SetRiskConfiguration)

-- | The app client ID. If @ClientId@ is null, then the risk configuration is
-- mapped to @userPoolId@. When the client ID is null, the same risk
-- configuration is applied to all the clients in the userPool.
--
-- Otherwise, @ClientId@ is mapped to the client. When the client ID is not
-- null, the user pool configuration is overridden and the risk
-- configuration for the client is used instead.
setRiskConfiguration_clientId :: Lens.Lens' SetRiskConfiguration (Prelude.Maybe Prelude.Text)
setRiskConfiguration_clientId :: (Maybe Text -> f (Maybe Text))
-> SetRiskConfiguration -> f SetRiskConfiguration
setRiskConfiguration_clientId = (SetRiskConfiguration -> Maybe (Sensitive Text))
-> (SetRiskConfiguration
    -> Maybe (Sensitive Text) -> SetRiskConfiguration)
-> Lens
     SetRiskConfiguration
     SetRiskConfiguration
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRiskConfiguration' {Maybe (Sensitive Text)
clientId :: Maybe (Sensitive Text)
$sel:clientId:SetRiskConfiguration' :: SetRiskConfiguration -> Maybe (Sensitive Text)
clientId} -> Maybe (Sensitive Text)
clientId) (\s :: SetRiskConfiguration
s@SetRiskConfiguration' {} Maybe (Sensitive Text)
a -> SetRiskConfiguration
s {$sel:clientId:SetRiskConfiguration' :: Maybe (Sensitive Text)
clientId = Maybe (Sensitive Text)
a} :: SetRiskConfiguration) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> SetRiskConfiguration -> f SetRiskConfiguration)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> SetRiskConfiguration
-> f SetRiskConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The account takeover risk configuration.
setRiskConfiguration_accountTakeoverRiskConfiguration :: Lens.Lens' SetRiskConfiguration (Prelude.Maybe AccountTakeoverRiskConfigurationType)
setRiskConfiguration_accountTakeoverRiskConfiguration :: (Maybe AccountTakeoverRiskConfigurationType
 -> f (Maybe AccountTakeoverRiskConfigurationType))
-> SetRiskConfiguration -> f SetRiskConfiguration
setRiskConfiguration_accountTakeoverRiskConfiguration = (SetRiskConfiguration
 -> Maybe AccountTakeoverRiskConfigurationType)
-> (SetRiskConfiguration
    -> Maybe AccountTakeoverRiskConfigurationType
    -> SetRiskConfiguration)
-> Lens
     SetRiskConfiguration
     SetRiskConfiguration
     (Maybe AccountTakeoverRiskConfigurationType)
     (Maybe AccountTakeoverRiskConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRiskConfiguration' {Maybe AccountTakeoverRiskConfigurationType
accountTakeoverRiskConfiguration :: Maybe AccountTakeoverRiskConfigurationType
$sel:accountTakeoverRiskConfiguration:SetRiskConfiguration' :: SetRiskConfiguration -> Maybe AccountTakeoverRiskConfigurationType
accountTakeoverRiskConfiguration} -> Maybe AccountTakeoverRiskConfigurationType
accountTakeoverRiskConfiguration) (\s :: SetRiskConfiguration
s@SetRiskConfiguration' {} Maybe AccountTakeoverRiskConfigurationType
a -> SetRiskConfiguration
s {$sel:accountTakeoverRiskConfiguration:SetRiskConfiguration' :: Maybe AccountTakeoverRiskConfigurationType
accountTakeoverRiskConfiguration = Maybe AccountTakeoverRiskConfigurationType
a} :: SetRiskConfiguration)

-- | The compromised credentials risk configuration.
setRiskConfiguration_compromisedCredentialsRiskConfiguration :: Lens.Lens' SetRiskConfiguration (Prelude.Maybe CompromisedCredentialsRiskConfigurationType)
setRiskConfiguration_compromisedCredentialsRiskConfiguration :: (Maybe CompromisedCredentialsRiskConfigurationType
 -> f (Maybe CompromisedCredentialsRiskConfigurationType))
-> SetRiskConfiguration -> f SetRiskConfiguration
setRiskConfiguration_compromisedCredentialsRiskConfiguration = (SetRiskConfiguration
 -> Maybe CompromisedCredentialsRiskConfigurationType)
-> (SetRiskConfiguration
    -> Maybe CompromisedCredentialsRiskConfigurationType
    -> SetRiskConfiguration)
-> Lens
     SetRiskConfiguration
     SetRiskConfiguration
     (Maybe CompromisedCredentialsRiskConfigurationType)
     (Maybe CompromisedCredentialsRiskConfigurationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRiskConfiguration' {Maybe CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfiguration :: Maybe CompromisedCredentialsRiskConfigurationType
$sel:compromisedCredentialsRiskConfiguration:SetRiskConfiguration' :: SetRiskConfiguration
-> Maybe CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfiguration} -> Maybe CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfiguration) (\s :: SetRiskConfiguration
s@SetRiskConfiguration' {} Maybe CompromisedCredentialsRiskConfigurationType
a -> SetRiskConfiguration
s {$sel:compromisedCredentialsRiskConfiguration:SetRiskConfiguration' :: Maybe CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfiguration = Maybe CompromisedCredentialsRiskConfigurationType
a} :: SetRiskConfiguration)

-- | The user pool ID.
setRiskConfiguration_userPoolId :: Lens.Lens' SetRiskConfiguration Prelude.Text
setRiskConfiguration_userPoolId :: (Text -> f Text) -> SetRiskConfiguration -> f SetRiskConfiguration
setRiskConfiguration_userPoolId = (SetRiskConfiguration -> Text)
-> (SetRiskConfiguration -> Text -> SetRiskConfiguration)
-> Lens SetRiskConfiguration SetRiskConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRiskConfiguration' {Text
userPoolId :: Text
$sel:userPoolId:SetRiskConfiguration' :: SetRiskConfiguration -> Text
userPoolId} -> Text
userPoolId) (\s :: SetRiskConfiguration
s@SetRiskConfiguration' {} Text
a -> SetRiskConfiguration
s {$sel:userPoolId:SetRiskConfiguration' :: Text
userPoolId = Text
a} :: SetRiskConfiguration)

instance Core.AWSRequest SetRiskConfiguration where
  type
    AWSResponse SetRiskConfiguration =
      SetRiskConfigurationResponse
  request :: SetRiskConfiguration -> Request SetRiskConfiguration
request = Service -> SetRiskConfiguration -> Request SetRiskConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SetRiskConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetRiskConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SetRiskConfiguration))
-> Logger
-> Service
-> Proxy SetRiskConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SetRiskConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> RiskConfigurationType -> SetRiskConfigurationResponse
SetRiskConfigurationResponse'
            (Int -> RiskConfigurationType -> SetRiskConfigurationResponse)
-> Either String Int
-> Either
     String (RiskConfigurationType -> SetRiskConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String (RiskConfigurationType -> SetRiskConfigurationResponse)
-> Either String RiskConfigurationType
-> Either String SetRiskConfigurationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String RiskConfigurationType
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"RiskConfiguration")
      )

instance Prelude.Hashable SetRiskConfiguration

instance Prelude.NFData SetRiskConfiguration

instance Core.ToHeaders SetRiskConfiguration where
  toHeaders :: SetRiskConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SetRiskConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCognitoIdentityProviderService.SetRiskConfiguration" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON SetRiskConfiguration where
  toJSON :: SetRiskConfiguration -> Value
toJSON SetRiskConfiguration' {Maybe (Sensitive Text)
Maybe CompromisedCredentialsRiskConfigurationType
Maybe AccountTakeoverRiskConfigurationType
Maybe RiskExceptionConfigurationType
Text
userPoolId :: Text
compromisedCredentialsRiskConfiguration :: Maybe CompromisedCredentialsRiskConfigurationType
accountTakeoverRiskConfiguration :: Maybe AccountTakeoverRiskConfigurationType
clientId :: Maybe (Sensitive Text)
riskExceptionConfiguration :: Maybe RiskExceptionConfigurationType
$sel:userPoolId:SetRiskConfiguration' :: SetRiskConfiguration -> Text
$sel:compromisedCredentialsRiskConfiguration:SetRiskConfiguration' :: SetRiskConfiguration
-> Maybe CompromisedCredentialsRiskConfigurationType
$sel:accountTakeoverRiskConfiguration:SetRiskConfiguration' :: SetRiskConfiguration -> Maybe AccountTakeoverRiskConfigurationType
$sel:clientId:SetRiskConfiguration' :: SetRiskConfiguration -> Maybe (Sensitive Text)
$sel:riskExceptionConfiguration:SetRiskConfiguration' :: SetRiskConfiguration -> Maybe RiskExceptionConfigurationType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RiskExceptionConfiguration" Text -> RiskExceptionConfigurationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RiskExceptionConfigurationType -> Pair)
-> Maybe RiskExceptionConfigurationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RiskExceptionConfigurationType
riskExceptionConfiguration,
            (Text
"ClientId" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
clientId,
            (Text
"AccountTakeoverRiskConfiguration" Text -> AccountTakeoverRiskConfigurationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AccountTakeoverRiskConfigurationType -> Pair)
-> Maybe AccountTakeoverRiskConfigurationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AccountTakeoverRiskConfigurationType
accountTakeoverRiskConfiguration,
            (Text
"CompromisedCredentialsRiskConfiguration" Text -> CompromisedCredentialsRiskConfigurationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CompromisedCredentialsRiskConfigurationType -> Pair)
-> Maybe CompromisedCredentialsRiskConfigurationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CompromisedCredentialsRiskConfigurationType
compromisedCredentialsRiskConfiguration,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId)
          ]
      )

instance Core.ToPath SetRiskConfiguration where
  toPath :: SetRiskConfiguration -> ByteString
toPath = ByteString -> SetRiskConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery SetRiskConfiguration where
  toQuery :: SetRiskConfiguration -> QueryString
toQuery = QueryString -> SetRiskConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newSetRiskConfigurationResponse' smart constructor.
data SetRiskConfigurationResponse = SetRiskConfigurationResponse'
  { -- | The response's http status code.
    SetRiskConfigurationResponse -> Int
httpStatus :: Prelude.Int,
    -- | The risk configuration.
    SetRiskConfigurationResponse -> RiskConfigurationType
riskConfiguration :: RiskConfigurationType
  }
  deriving (SetRiskConfigurationResponse
-> SetRiskConfigurationResponse -> Bool
(SetRiskConfigurationResponse
 -> SetRiskConfigurationResponse -> Bool)
-> (SetRiskConfigurationResponse
    -> SetRiskConfigurationResponse -> Bool)
-> Eq SetRiskConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetRiskConfigurationResponse
-> SetRiskConfigurationResponse -> Bool
$c/= :: SetRiskConfigurationResponse
-> SetRiskConfigurationResponse -> Bool
== :: SetRiskConfigurationResponse
-> SetRiskConfigurationResponse -> Bool
$c== :: SetRiskConfigurationResponse
-> SetRiskConfigurationResponse -> Bool
Prelude.Eq, Int -> SetRiskConfigurationResponse -> ShowS
[SetRiskConfigurationResponse] -> ShowS
SetRiskConfigurationResponse -> String
(Int -> SetRiskConfigurationResponse -> ShowS)
-> (SetRiskConfigurationResponse -> String)
-> ([SetRiskConfigurationResponse] -> ShowS)
-> Show SetRiskConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetRiskConfigurationResponse] -> ShowS
$cshowList :: [SetRiskConfigurationResponse] -> ShowS
show :: SetRiskConfigurationResponse -> String
$cshow :: SetRiskConfigurationResponse -> String
showsPrec :: Int -> SetRiskConfigurationResponse -> ShowS
$cshowsPrec :: Int -> SetRiskConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 SetRiskConfigurationResponse -> Rep SetRiskConfigurationResponse x)
-> (forall x.
    Rep SetRiskConfigurationResponse x -> SetRiskConfigurationResponse)
-> Generic SetRiskConfigurationResponse
forall x.
Rep SetRiskConfigurationResponse x -> SetRiskConfigurationResponse
forall x.
SetRiskConfigurationResponse -> Rep SetRiskConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SetRiskConfigurationResponse x -> SetRiskConfigurationResponse
$cfrom :: forall x.
SetRiskConfigurationResponse -> Rep SetRiskConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'SetRiskConfigurationResponse' 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:
--
-- 'httpStatus', 'setRiskConfigurationResponse_httpStatus' - The response's http status code.
--
-- 'riskConfiguration', 'setRiskConfigurationResponse_riskConfiguration' - The risk configuration.
newSetRiskConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'riskConfiguration'
  RiskConfigurationType ->
  SetRiskConfigurationResponse
newSetRiskConfigurationResponse :: Int -> RiskConfigurationType -> SetRiskConfigurationResponse
newSetRiskConfigurationResponse
  Int
pHttpStatus_
  RiskConfigurationType
pRiskConfiguration_ =
    SetRiskConfigurationResponse' :: Int -> RiskConfigurationType -> SetRiskConfigurationResponse
SetRiskConfigurationResponse'
      { $sel:httpStatus:SetRiskConfigurationResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:riskConfiguration:SetRiskConfigurationResponse' :: RiskConfigurationType
riskConfiguration = RiskConfigurationType
pRiskConfiguration_
      }

-- | The response's http status code.
setRiskConfigurationResponse_httpStatus :: Lens.Lens' SetRiskConfigurationResponse Prelude.Int
setRiskConfigurationResponse_httpStatus :: (Int -> f Int)
-> SetRiskConfigurationResponse -> f SetRiskConfigurationResponse
setRiskConfigurationResponse_httpStatus = (SetRiskConfigurationResponse -> Int)
-> (SetRiskConfigurationResponse
    -> Int -> SetRiskConfigurationResponse)
-> Lens
     SetRiskConfigurationResponse SetRiskConfigurationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRiskConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:SetRiskConfigurationResponse' :: SetRiskConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SetRiskConfigurationResponse
s@SetRiskConfigurationResponse' {} Int
a -> SetRiskConfigurationResponse
s {$sel:httpStatus:SetRiskConfigurationResponse' :: Int
httpStatus = Int
a} :: SetRiskConfigurationResponse)

-- | The risk configuration.
setRiskConfigurationResponse_riskConfiguration :: Lens.Lens' SetRiskConfigurationResponse RiskConfigurationType
setRiskConfigurationResponse_riskConfiguration :: (RiskConfigurationType -> f RiskConfigurationType)
-> SetRiskConfigurationResponse -> f SetRiskConfigurationResponse
setRiskConfigurationResponse_riskConfiguration = (SetRiskConfigurationResponse -> RiskConfigurationType)
-> (SetRiskConfigurationResponse
    -> RiskConfigurationType -> SetRiskConfigurationResponse)
-> Lens
     SetRiskConfigurationResponse
     SetRiskConfigurationResponse
     RiskConfigurationType
     RiskConfigurationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SetRiskConfigurationResponse' {RiskConfigurationType
riskConfiguration :: RiskConfigurationType
$sel:riskConfiguration:SetRiskConfigurationResponse' :: SetRiskConfigurationResponse -> RiskConfigurationType
riskConfiguration} -> RiskConfigurationType
riskConfiguration) (\s :: SetRiskConfigurationResponse
s@SetRiskConfigurationResponse' {} RiskConfigurationType
a -> SetRiskConfigurationResponse
s {$sel:riskConfiguration:SetRiskConfigurationResponse' :: RiskConfigurationType
riskConfiguration = RiskConfigurationType
a} :: SetRiskConfigurationResponse)

instance Prelude.NFData SetRiskConfigurationResponse