{-# 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.IoT.DeleteAuthorizer
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an authorizer.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteAuthorizer>
-- action.
module Amazonka.IoT.DeleteAuthorizer
  ( -- * Creating a Request
    DeleteAuthorizer (..),
    newDeleteAuthorizer,

    -- * Request Lenses
    deleteAuthorizer_authorizerName,

    -- * Destructuring the Response
    DeleteAuthorizerResponse (..),
    newDeleteAuthorizerResponse,

    -- * Response Lenses
    deleteAuthorizerResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteAuthorizer' smart constructor.
data DeleteAuthorizer = DeleteAuthorizer'
  { -- | The name of the authorizer to delete.
    DeleteAuthorizer -> Text
authorizerName :: Prelude.Text
  }
  deriving (DeleteAuthorizer -> DeleteAuthorizer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAuthorizer -> DeleteAuthorizer -> Bool
$c/= :: DeleteAuthorizer -> DeleteAuthorizer -> Bool
== :: DeleteAuthorizer -> DeleteAuthorizer -> Bool
$c== :: DeleteAuthorizer -> DeleteAuthorizer -> Bool
Prelude.Eq, ReadPrec [DeleteAuthorizer]
ReadPrec DeleteAuthorizer
Int -> ReadS DeleteAuthorizer
ReadS [DeleteAuthorizer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAuthorizer]
$creadListPrec :: ReadPrec [DeleteAuthorizer]
readPrec :: ReadPrec DeleteAuthorizer
$creadPrec :: ReadPrec DeleteAuthorizer
readList :: ReadS [DeleteAuthorizer]
$creadList :: ReadS [DeleteAuthorizer]
readsPrec :: Int -> ReadS DeleteAuthorizer
$creadsPrec :: Int -> ReadS DeleteAuthorizer
Prelude.Read, Int -> DeleteAuthorizer -> ShowS
[DeleteAuthorizer] -> ShowS
DeleteAuthorizer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAuthorizer] -> ShowS
$cshowList :: [DeleteAuthorizer] -> ShowS
show :: DeleteAuthorizer -> String
$cshow :: DeleteAuthorizer -> String
showsPrec :: Int -> DeleteAuthorizer -> ShowS
$cshowsPrec :: Int -> DeleteAuthorizer -> ShowS
Prelude.Show, forall x. Rep DeleteAuthorizer x -> DeleteAuthorizer
forall x. DeleteAuthorizer -> Rep DeleteAuthorizer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAuthorizer x -> DeleteAuthorizer
$cfrom :: forall x. DeleteAuthorizer -> Rep DeleteAuthorizer x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAuthorizer' 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:
--
-- 'authorizerName', 'deleteAuthorizer_authorizerName' - The name of the authorizer to delete.
newDeleteAuthorizer ::
  -- | 'authorizerName'
  Prelude.Text ->
  DeleteAuthorizer
newDeleteAuthorizer :: Text -> DeleteAuthorizer
newDeleteAuthorizer Text
pAuthorizerName_ =
  DeleteAuthorizer'
    { $sel:authorizerName:DeleteAuthorizer' :: Text
authorizerName =
        Text
pAuthorizerName_
    }

-- | The name of the authorizer to delete.
deleteAuthorizer_authorizerName :: Lens.Lens' DeleteAuthorizer Prelude.Text
deleteAuthorizer_authorizerName :: Lens' DeleteAuthorizer Text
deleteAuthorizer_authorizerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAuthorizer' {Text
authorizerName :: Text
$sel:authorizerName:DeleteAuthorizer' :: DeleteAuthorizer -> Text
authorizerName} -> Text
authorizerName) (\s :: DeleteAuthorizer
s@DeleteAuthorizer' {} Text
a -> DeleteAuthorizer
s {$sel:authorizerName:DeleteAuthorizer' :: Text
authorizerName = Text
a} :: DeleteAuthorizer)

instance Core.AWSRequest DeleteAuthorizer where
  type
    AWSResponse DeleteAuthorizer =
      DeleteAuthorizerResponse
  request :: (Service -> Service)
-> DeleteAuthorizer -> Request DeleteAuthorizer
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteAuthorizer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAuthorizer)))
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 -> DeleteAuthorizerResponse
DeleteAuthorizerResponse'
            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 DeleteAuthorizer where
  hashWithSalt :: Int -> DeleteAuthorizer -> Int
hashWithSalt Int
_salt DeleteAuthorizer' {Text
authorizerName :: Text
$sel:authorizerName:DeleteAuthorizer' :: DeleteAuthorizer -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
authorizerName

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

instance Data.ToHeaders DeleteAuthorizer where
  toHeaders :: DeleteAuthorizer -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DeleteAuthorizer where
  toPath :: DeleteAuthorizer -> ByteString
toPath DeleteAuthorizer' {Text
authorizerName :: Text
$sel:authorizerName:DeleteAuthorizer' :: DeleteAuthorizer -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/authorizer/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
authorizerName]

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

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

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

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

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