{-# 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.DescribeDefaultAuthorizer
-- 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)
--
-- Describes the default authorizer.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DescribeDefaultAuthorizer>
-- action.
module Amazonka.IoT.DescribeDefaultAuthorizer
  ( -- * Creating a Request
    DescribeDefaultAuthorizer (..),
    newDescribeDefaultAuthorizer,

    -- * Destructuring the Response
    DescribeDefaultAuthorizerResponse (..),
    newDescribeDefaultAuthorizerResponse,

    -- * Response Lenses
    describeDefaultAuthorizerResponse_authorizerDescription,
    describeDefaultAuthorizerResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.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

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

-- |
-- Create a value of 'DescribeDefaultAuthorizer' 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.
newDescribeDefaultAuthorizer ::
  DescribeDefaultAuthorizer
newDescribeDefaultAuthorizer :: DescribeDefaultAuthorizer
newDescribeDefaultAuthorizer =
  DescribeDefaultAuthorizer
DescribeDefaultAuthorizer'

instance Core.AWSRequest DescribeDefaultAuthorizer where
  type
    AWSResponse DescribeDefaultAuthorizer =
      DescribeDefaultAuthorizerResponse
  request :: DescribeDefaultAuthorizer -> Request DescribeDefaultAuthorizer
request = Service
-> DescribeDefaultAuthorizer -> Request DescribeDefaultAuthorizer
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDefaultAuthorizer
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDefaultAuthorizer)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeDefaultAuthorizer))
-> Logger
-> Service
-> Proxy DescribeDefaultAuthorizer
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDefaultAuthorizer)))
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 ->
          Maybe AuthorizerDescription
-> Int -> DescribeDefaultAuthorizerResponse
DescribeDefaultAuthorizerResponse'
            (Maybe AuthorizerDescription
 -> Int -> DescribeDefaultAuthorizerResponse)
-> Either String (Maybe AuthorizerDescription)
-> Either String (Int -> DescribeDefaultAuthorizerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe AuthorizerDescription)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"authorizerDescription")
            Either String (Int -> DescribeDefaultAuthorizerResponse)
-> Either String Int
-> Either String DescribeDefaultAuthorizerResponse
forall (f :: * -> *) a b. Applicative f => 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 DescribeDefaultAuthorizer

instance Prelude.NFData DescribeDefaultAuthorizer

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

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

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

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

-- |
-- Create a value of 'DescribeDefaultAuthorizerResponse' 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:
--
-- 'authorizerDescription', 'describeDefaultAuthorizerResponse_authorizerDescription' - The default authorizer\'s description.
--
-- 'httpStatus', 'describeDefaultAuthorizerResponse_httpStatus' - The response's http status code.
newDescribeDefaultAuthorizerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDefaultAuthorizerResponse
newDescribeDefaultAuthorizerResponse :: Int -> DescribeDefaultAuthorizerResponse
newDescribeDefaultAuthorizerResponse Int
pHttpStatus_ =
  DescribeDefaultAuthorizerResponse' :: Maybe AuthorizerDescription
-> Int -> DescribeDefaultAuthorizerResponse
DescribeDefaultAuthorizerResponse'
    { $sel:authorizerDescription:DescribeDefaultAuthorizerResponse' :: Maybe AuthorizerDescription
authorizerDescription =
        Maybe AuthorizerDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDefaultAuthorizerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The default authorizer\'s description.
describeDefaultAuthorizerResponse_authorizerDescription :: Lens.Lens' DescribeDefaultAuthorizerResponse (Prelude.Maybe AuthorizerDescription)
describeDefaultAuthorizerResponse_authorizerDescription :: (Maybe AuthorizerDescription -> f (Maybe AuthorizerDescription))
-> DescribeDefaultAuthorizerResponse
-> f DescribeDefaultAuthorizerResponse
describeDefaultAuthorizerResponse_authorizerDescription = (DescribeDefaultAuthorizerResponse -> Maybe AuthorizerDescription)
-> (DescribeDefaultAuthorizerResponse
    -> Maybe AuthorizerDescription
    -> DescribeDefaultAuthorizerResponse)
-> Lens
     DescribeDefaultAuthorizerResponse
     DescribeDefaultAuthorizerResponse
     (Maybe AuthorizerDescription)
     (Maybe AuthorizerDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDefaultAuthorizerResponse' {Maybe AuthorizerDescription
authorizerDescription :: Maybe AuthorizerDescription
$sel:authorizerDescription:DescribeDefaultAuthorizerResponse' :: DescribeDefaultAuthorizerResponse -> Maybe AuthorizerDescription
authorizerDescription} -> Maybe AuthorizerDescription
authorizerDescription) (\s :: DescribeDefaultAuthorizerResponse
s@DescribeDefaultAuthorizerResponse' {} Maybe AuthorizerDescription
a -> DescribeDefaultAuthorizerResponse
s {$sel:authorizerDescription:DescribeDefaultAuthorizerResponse' :: Maybe AuthorizerDescription
authorizerDescription = Maybe AuthorizerDescription
a} :: DescribeDefaultAuthorizerResponse)

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

instance
  Prelude.NFData
    DescribeDefaultAuthorizerResponse