{-# 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.DirectoryService.DisableRadius
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disables multi-factor authentication (MFA) with the Remote
-- Authentication Dial In User Service (RADIUS) server for an AD Connector
-- or Microsoft AD directory.
module Amazonka.DirectoryService.DisableRadius
  ( -- * Creating a Request
    DisableRadius (..),
    newDisableRadius,

    -- * Request Lenses
    disableRadius_directoryId,

    -- * Destructuring the Response
    DisableRadiusResponse (..),
    newDisableRadiusResponse,

    -- * Response Lenses
    disableRadiusResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectoryService.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Contains the inputs for the DisableRadius operation.
--
-- /See:/ 'newDisableRadius' smart constructor.
data DisableRadius = DisableRadius'
  { -- | The identifier of the directory for which to disable MFA.
    DisableRadius -> Text
directoryId :: Prelude.Text
  }
  deriving (DisableRadius -> DisableRadius -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableRadius -> DisableRadius -> Bool
$c/= :: DisableRadius -> DisableRadius -> Bool
== :: DisableRadius -> DisableRadius -> Bool
$c== :: DisableRadius -> DisableRadius -> Bool
Prelude.Eq, ReadPrec [DisableRadius]
ReadPrec DisableRadius
Int -> ReadS DisableRadius
ReadS [DisableRadius]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableRadius]
$creadListPrec :: ReadPrec [DisableRadius]
readPrec :: ReadPrec DisableRadius
$creadPrec :: ReadPrec DisableRadius
readList :: ReadS [DisableRadius]
$creadList :: ReadS [DisableRadius]
readsPrec :: Int -> ReadS DisableRadius
$creadsPrec :: Int -> ReadS DisableRadius
Prelude.Read, Int -> DisableRadius -> ShowS
[DisableRadius] -> ShowS
DisableRadius -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableRadius] -> ShowS
$cshowList :: [DisableRadius] -> ShowS
show :: DisableRadius -> String
$cshow :: DisableRadius -> String
showsPrec :: Int -> DisableRadius -> ShowS
$cshowsPrec :: Int -> DisableRadius -> ShowS
Prelude.Show, forall x. Rep DisableRadius x -> DisableRadius
forall x. DisableRadius -> Rep DisableRadius x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableRadius x -> DisableRadius
$cfrom :: forall x. DisableRadius -> Rep DisableRadius x
Prelude.Generic)

-- |
-- Create a value of 'DisableRadius' 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:
--
-- 'directoryId', 'disableRadius_directoryId' - The identifier of the directory for which to disable MFA.
newDisableRadius ::
  -- | 'directoryId'
  Prelude.Text ->
  DisableRadius
newDisableRadius :: Text -> DisableRadius
newDisableRadius Text
pDirectoryId_ =
  DisableRadius' {$sel:directoryId:DisableRadius' :: Text
directoryId = Text
pDirectoryId_}

-- | The identifier of the directory for which to disable MFA.
disableRadius_directoryId :: Lens.Lens' DisableRadius Prelude.Text
disableRadius_directoryId :: Lens' DisableRadius Text
disableRadius_directoryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableRadius' {Text
directoryId :: Text
$sel:directoryId:DisableRadius' :: DisableRadius -> Text
directoryId} -> Text
directoryId) (\s :: DisableRadius
s@DisableRadius' {} Text
a -> DisableRadius
s {$sel:directoryId:DisableRadius' :: Text
directoryId = Text
a} :: DisableRadius)

instance Core.AWSRequest DisableRadius where
  type
    AWSResponse DisableRadius =
      DisableRadiusResponse
  request :: (Service -> Service) -> DisableRadius -> Request DisableRadius
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisableRadius
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableRadius)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisableRadiusResponse
DisableRadiusResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DisableRadius where
  hashWithSalt :: Int -> DisableRadius -> Int
hashWithSalt Int
_salt DisableRadius' {Text
directoryId :: Text
$sel:directoryId:DisableRadius' :: DisableRadius -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryId

instance Prelude.NFData DisableRadius where
  rnf :: DisableRadius -> ()
rnf DisableRadius' {Text
directoryId :: Text
$sel:directoryId:DisableRadius' :: DisableRadius -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
directoryId

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

instance Data.ToJSON DisableRadius where
  toJSON :: DisableRadius -> Value
toJSON DisableRadius' {Text
directoryId :: Text
$sel:directoryId:DisableRadius' :: DisableRadius -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"DirectoryId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
directoryId)]
      )

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

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

-- | Contains the results of the DisableRadius operation.
--
-- /See:/ 'newDisableRadiusResponse' smart constructor.
data DisableRadiusResponse = DisableRadiusResponse'
  { -- | The response's http status code.
    DisableRadiusResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DisableRadiusResponse -> DisableRadiusResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableRadiusResponse -> DisableRadiusResponse -> Bool
$c/= :: DisableRadiusResponse -> DisableRadiusResponse -> Bool
== :: DisableRadiusResponse -> DisableRadiusResponse -> Bool
$c== :: DisableRadiusResponse -> DisableRadiusResponse -> Bool
Prelude.Eq, ReadPrec [DisableRadiusResponse]
ReadPrec DisableRadiusResponse
Int -> ReadS DisableRadiusResponse
ReadS [DisableRadiusResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableRadiusResponse]
$creadListPrec :: ReadPrec [DisableRadiusResponse]
readPrec :: ReadPrec DisableRadiusResponse
$creadPrec :: ReadPrec DisableRadiusResponse
readList :: ReadS [DisableRadiusResponse]
$creadList :: ReadS [DisableRadiusResponse]
readsPrec :: Int -> ReadS DisableRadiusResponse
$creadsPrec :: Int -> ReadS DisableRadiusResponse
Prelude.Read, Int -> DisableRadiusResponse -> ShowS
[DisableRadiusResponse] -> ShowS
DisableRadiusResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableRadiusResponse] -> ShowS
$cshowList :: [DisableRadiusResponse] -> ShowS
show :: DisableRadiusResponse -> String
$cshow :: DisableRadiusResponse -> String
showsPrec :: Int -> DisableRadiusResponse -> ShowS
$cshowsPrec :: Int -> DisableRadiusResponse -> ShowS
Prelude.Show, forall x. Rep DisableRadiusResponse x -> DisableRadiusResponse
forall x. DisableRadiusResponse -> Rep DisableRadiusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableRadiusResponse x -> DisableRadiusResponse
$cfrom :: forall x. DisableRadiusResponse -> Rep DisableRadiusResponse x
Prelude.Generic)

-- |
-- Create a value of 'DisableRadiusResponse' 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', 'disableRadiusResponse_httpStatus' - The response's http status code.
newDisableRadiusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisableRadiusResponse
newDisableRadiusResponse :: Int -> DisableRadiusResponse
newDisableRadiusResponse Int
pHttpStatus_ =
  DisableRadiusResponse' {$sel:httpStatus:DisableRadiusResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DisableRadiusResponse where
  rnf :: DisableRadiusResponse -> ()
rnf DisableRadiusResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisableRadiusResponse' :: DisableRadiusResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus