{-# 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-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)
--
-- 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 Amazonka.DirectoryService.Types
import qualified Amazonka.Lens as Lens
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
(DisableRadius -> DisableRadius -> Bool)
-> (DisableRadius -> DisableRadius -> Bool) -> Eq DisableRadius
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]
(Int -> ReadS DisableRadius)
-> ReadS [DisableRadius]
-> ReadPrec DisableRadius
-> ReadPrec [DisableRadius]
-> Read 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
(Int -> DisableRadius -> ShowS)
-> (DisableRadius -> String)
-> ([DisableRadius] -> ShowS)
-> Show DisableRadius
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. DisableRadius -> Rep DisableRadius x)
-> (forall x. Rep DisableRadius x -> DisableRadius)
-> Generic DisableRadius
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' :: Text -> DisableRadius
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 :: (Text -> f Text) -> DisableRadius -> f DisableRadius
disableRadius_directoryId = (DisableRadius -> Text)
-> (DisableRadius -> Text -> DisableRadius)
-> Lens DisableRadius DisableRadius Text Text
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 :: DisableRadius -> Request DisableRadius
request = Service -> DisableRadius -> Request DisableRadius
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisableRadius
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableRadius)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisableRadius))
-> Logger
-> Service
-> Proxy DisableRadius
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableRadius)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisableRadiusResponse
DisableRadiusResponse'
            (Int -> DisableRadiusResponse)
-> Either String Int -> Either String DisableRadiusResponse
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))
      )

instance Prelude.Hashable DisableRadius

instance Prelude.NFData DisableRadius

instance Core.ToHeaders DisableRadius where
  toHeaders :: DisableRadius -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisableRadius -> 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
"DirectoryService_20150416.DisableRadius" ::
                          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 DisableRadius where
  toJSON :: DisableRadius -> Value
toJSON DisableRadius' {Text
directoryId :: Text
$sel:directoryId:DisableRadius' :: DisableRadius -> Text
..} =
    [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
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId)]
      )

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

instance Core.ToQuery DisableRadius where
  toQuery :: DisableRadius -> QueryString
toQuery = QueryString -> DisableRadius -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DisableRadiusResponse -> DisableRadiusResponse -> Bool)
-> (DisableRadiusResponse -> DisableRadiusResponse -> Bool)
-> Eq DisableRadiusResponse
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]
(Int -> ReadS DisableRadiusResponse)
-> ReadS [DisableRadiusResponse]
-> ReadPrec DisableRadiusResponse
-> ReadPrec [DisableRadiusResponse]
-> Read 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
(Int -> DisableRadiusResponse -> ShowS)
-> (DisableRadiusResponse -> String)
-> ([DisableRadiusResponse] -> ShowS)
-> Show DisableRadiusResponse
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. DisableRadiusResponse -> Rep DisableRadiusResponse x)
-> (forall x. Rep DisableRadiusResponse x -> DisableRadiusResponse)
-> Generic DisableRadiusResponse
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' :: Int -> DisableRadiusResponse
DisableRadiusResponse' {$sel:httpStatus:DisableRadiusResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
disableRadiusResponse_httpStatus :: Lens.Lens' DisableRadiusResponse Prelude.Int
disableRadiusResponse_httpStatus :: (Int -> f Int) -> DisableRadiusResponse -> f DisableRadiusResponse
disableRadiusResponse_httpStatus = (DisableRadiusResponse -> Int)
-> (DisableRadiusResponse -> Int -> DisableRadiusResponse)
-> Lens DisableRadiusResponse DisableRadiusResponse Int Int
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