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

    -- * Request Lenses
    createAuthorizer_status,
    createAuthorizer_signingDisabled,
    createAuthorizer_tokenSigningPublicKeys,
    createAuthorizer_tokenKeyName,
    createAuthorizer_tags,
    createAuthorizer_authorizerName,
    createAuthorizer_authorizerFunctionArn,

    -- * Destructuring the Response
    CreateAuthorizerResponse (..),
    newCreateAuthorizerResponse,

    -- * Response Lenses
    createAuthorizerResponse_authorizerName,
    createAuthorizerResponse_authorizerArn,
    createAuthorizerResponse_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:/ 'newCreateAuthorizer' smart constructor.
data CreateAuthorizer = CreateAuthorizer'
  { -- | The status of the create authorizer request.
    CreateAuthorizer -> Maybe AuthorizerStatus
status :: Prelude.Maybe AuthorizerStatus,
    -- | Specifies whether IoT validates the token signature in an authorization
    -- request.
    CreateAuthorizer -> Maybe Bool
signingDisabled :: Prelude.Maybe Prelude.Bool,
    -- | The public keys used to verify the digital signature returned by your
    -- custom authentication service.
    CreateAuthorizer -> Maybe (HashMap Text Text)
tokenSigningPublicKeys :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the token key used to extract the token from the HTTP
    -- headers.
    CreateAuthorizer -> Maybe Text
tokenKeyName :: Prelude.Maybe Prelude.Text,
    -- | Metadata which can be used to manage the custom authorizer.
    --
    -- For URI Request parameters use format: ...key1=value1&key2=value2...
    --
    -- For the CLI command-line parameter use format: &&tags
    -- \"key1=value1&key2=value2...\"
    --
    -- For the cli-input-json file use format: \"tags\":
    -- \"key1=value1&key2=value2...\"
    CreateAuthorizer -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The authorizer name.
    CreateAuthorizer -> Text
authorizerName :: Prelude.Text,
    -- | The ARN of the authorizer\'s Lambda function.
    CreateAuthorizer -> Text
authorizerFunctionArn :: Prelude.Text
  }
  deriving (CreateAuthorizer -> CreateAuthorizer -> Bool
(CreateAuthorizer -> CreateAuthorizer -> Bool)
-> (CreateAuthorizer -> CreateAuthorizer -> Bool)
-> Eq CreateAuthorizer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAuthorizer -> CreateAuthorizer -> Bool
$c/= :: CreateAuthorizer -> CreateAuthorizer -> Bool
== :: CreateAuthorizer -> CreateAuthorizer -> Bool
$c== :: CreateAuthorizer -> CreateAuthorizer -> Bool
Prelude.Eq, ReadPrec [CreateAuthorizer]
ReadPrec CreateAuthorizer
Int -> ReadS CreateAuthorizer
ReadS [CreateAuthorizer]
(Int -> ReadS CreateAuthorizer)
-> ReadS [CreateAuthorizer]
-> ReadPrec CreateAuthorizer
-> ReadPrec [CreateAuthorizer]
-> Read CreateAuthorizer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAuthorizer]
$creadListPrec :: ReadPrec [CreateAuthorizer]
readPrec :: ReadPrec CreateAuthorizer
$creadPrec :: ReadPrec CreateAuthorizer
readList :: ReadS [CreateAuthorizer]
$creadList :: ReadS [CreateAuthorizer]
readsPrec :: Int -> ReadS CreateAuthorizer
$creadsPrec :: Int -> ReadS CreateAuthorizer
Prelude.Read, Int -> CreateAuthorizer -> ShowS
[CreateAuthorizer] -> ShowS
CreateAuthorizer -> String
(Int -> CreateAuthorizer -> ShowS)
-> (CreateAuthorizer -> String)
-> ([CreateAuthorizer] -> ShowS)
-> Show CreateAuthorizer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAuthorizer] -> ShowS
$cshowList :: [CreateAuthorizer] -> ShowS
show :: CreateAuthorizer -> String
$cshow :: CreateAuthorizer -> String
showsPrec :: Int -> CreateAuthorizer -> ShowS
$cshowsPrec :: Int -> CreateAuthorizer -> ShowS
Prelude.Show, (forall x. CreateAuthorizer -> Rep CreateAuthorizer x)
-> (forall x. Rep CreateAuthorizer x -> CreateAuthorizer)
-> Generic CreateAuthorizer
forall x. Rep CreateAuthorizer x -> CreateAuthorizer
forall x. CreateAuthorizer -> Rep CreateAuthorizer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAuthorizer x -> CreateAuthorizer
$cfrom :: forall x. CreateAuthorizer -> Rep CreateAuthorizer x
Prelude.Generic)

-- |
-- Create a value of 'CreateAuthorizer' 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:
--
-- 'status', 'createAuthorizer_status' - The status of the create authorizer request.
--
-- 'signingDisabled', 'createAuthorizer_signingDisabled' - Specifies whether IoT validates the token signature in an authorization
-- request.
--
-- 'tokenSigningPublicKeys', 'createAuthorizer_tokenSigningPublicKeys' - The public keys used to verify the digital signature returned by your
-- custom authentication service.
--
-- 'tokenKeyName', 'createAuthorizer_tokenKeyName' - The name of the token key used to extract the token from the HTTP
-- headers.
--
-- 'tags', 'createAuthorizer_tags' - Metadata which can be used to manage the custom authorizer.
--
-- For URI Request parameters use format: ...key1=value1&key2=value2...
--
-- For the CLI command-line parameter use format: &&tags
-- \"key1=value1&key2=value2...\"
--
-- For the cli-input-json file use format: \"tags\":
-- \"key1=value1&key2=value2...\"
--
-- 'authorizerName', 'createAuthorizer_authorizerName' - The authorizer name.
--
-- 'authorizerFunctionArn', 'createAuthorizer_authorizerFunctionArn' - The ARN of the authorizer\'s Lambda function.
newCreateAuthorizer ::
  -- | 'authorizerName'
  Prelude.Text ->
  -- | 'authorizerFunctionArn'
  Prelude.Text ->
  CreateAuthorizer
newCreateAuthorizer :: Text -> Text -> CreateAuthorizer
newCreateAuthorizer
  Text
pAuthorizerName_
  Text
pAuthorizerFunctionArn_ =
    CreateAuthorizer' :: Maybe AuthorizerStatus
-> Maybe Bool
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> CreateAuthorizer
CreateAuthorizer'
      { $sel:status:CreateAuthorizer' :: Maybe AuthorizerStatus
status = Maybe AuthorizerStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:signingDisabled:CreateAuthorizer' :: Maybe Bool
signingDisabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:tokenSigningPublicKeys:CreateAuthorizer' :: Maybe (HashMap Text Text)
tokenSigningPublicKeys = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:tokenKeyName:CreateAuthorizer' :: Maybe Text
tokenKeyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateAuthorizer' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:authorizerName:CreateAuthorizer' :: Text
authorizerName = Text
pAuthorizerName_,
        $sel:authorizerFunctionArn:CreateAuthorizer' :: Text
authorizerFunctionArn = Text
pAuthorizerFunctionArn_
      }

-- | The status of the create authorizer request.
createAuthorizer_status :: Lens.Lens' CreateAuthorizer (Prelude.Maybe AuthorizerStatus)
createAuthorizer_status :: (Maybe AuthorizerStatus -> f (Maybe AuthorizerStatus))
-> CreateAuthorizer -> f CreateAuthorizer
createAuthorizer_status = (CreateAuthorizer -> Maybe AuthorizerStatus)
-> (CreateAuthorizer -> Maybe AuthorizerStatus -> CreateAuthorizer)
-> Lens
     CreateAuthorizer
     CreateAuthorizer
     (Maybe AuthorizerStatus)
     (Maybe AuthorizerStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe AuthorizerStatus
status :: Maybe AuthorizerStatus
$sel:status:CreateAuthorizer' :: CreateAuthorizer -> Maybe AuthorizerStatus
status} -> Maybe AuthorizerStatus
status) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe AuthorizerStatus
a -> CreateAuthorizer
s {$sel:status:CreateAuthorizer' :: Maybe AuthorizerStatus
status = Maybe AuthorizerStatus
a} :: CreateAuthorizer)

-- | Specifies whether IoT validates the token signature in an authorization
-- request.
createAuthorizer_signingDisabled :: Lens.Lens' CreateAuthorizer (Prelude.Maybe Prelude.Bool)
createAuthorizer_signingDisabled :: (Maybe Bool -> f (Maybe Bool))
-> CreateAuthorizer -> f CreateAuthorizer
createAuthorizer_signingDisabled = (CreateAuthorizer -> Maybe Bool)
-> (CreateAuthorizer -> Maybe Bool -> CreateAuthorizer)
-> Lens CreateAuthorizer CreateAuthorizer (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe Bool
signingDisabled :: Maybe Bool
$sel:signingDisabled:CreateAuthorizer' :: CreateAuthorizer -> Maybe Bool
signingDisabled} -> Maybe Bool
signingDisabled) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe Bool
a -> CreateAuthorizer
s {$sel:signingDisabled:CreateAuthorizer' :: Maybe Bool
signingDisabled = Maybe Bool
a} :: CreateAuthorizer)

-- | The public keys used to verify the digital signature returned by your
-- custom authentication service.
createAuthorizer_tokenSigningPublicKeys :: Lens.Lens' CreateAuthorizer (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createAuthorizer_tokenSigningPublicKeys :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateAuthorizer -> f CreateAuthorizer
createAuthorizer_tokenSigningPublicKeys = (CreateAuthorizer -> Maybe (HashMap Text Text))
-> (CreateAuthorizer
    -> Maybe (HashMap Text Text) -> CreateAuthorizer)
-> Lens
     CreateAuthorizer
     CreateAuthorizer
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe (HashMap Text Text)
tokenSigningPublicKeys :: Maybe (HashMap Text Text)
$sel:tokenSigningPublicKeys:CreateAuthorizer' :: CreateAuthorizer -> Maybe (HashMap Text Text)
tokenSigningPublicKeys} -> Maybe (HashMap Text Text)
tokenSigningPublicKeys) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe (HashMap Text Text)
a -> CreateAuthorizer
s {$sel:tokenSigningPublicKeys:CreateAuthorizer' :: Maybe (HashMap Text Text)
tokenSigningPublicKeys = Maybe (HashMap Text Text)
a} :: CreateAuthorizer) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateAuthorizer -> f CreateAuthorizer)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateAuthorizer
-> f CreateAuthorizer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the token key used to extract the token from the HTTP
-- headers.
createAuthorizer_tokenKeyName :: Lens.Lens' CreateAuthorizer (Prelude.Maybe Prelude.Text)
createAuthorizer_tokenKeyName :: (Maybe Text -> f (Maybe Text))
-> CreateAuthorizer -> f CreateAuthorizer
createAuthorizer_tokenKeyName = (CreateAuthorizer -> Maybe Text)
-> (CreateAuthorizer -> Maybe Text -> CreateAuthorizer)
-> Lens CreateAuthorizer CreateAuthorizer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe Text
tokenKeyName :: Maybe Text
$sel:tokenKeyName:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
tokenKeyName} -> Maybe Text
tokenKeyName) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe Text
a -> CreateAuthorizer
s {$sel:tokenKeyName:CreateAuthorizer' :: Maybe Text
tokenKeyName = Maybe Text
a} :: CreateAuthorizer)

-- | Metadata which can be used to manage the custom authorizer.
--
-- For URI Request parameters use format: ...key1=value1&key2=value2...
--
-- For the CLI command-line parameter use format: &&tags
-- \"key1=value1&key2=value2...\"
--
-- For the cli-input-json file use format: \"tags\":
-- \"key1=value1&key2=value2...\"
createAuthorizer_tags :: Lens.Lens' CreateAuthorizer (Prelude.Maybe [Tag])
createAuthorizer_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAuthorizer -> f CreateAuthorizer
createAuthorizer_tags = (CreateAuthorizer -> Maybe [Tag])
-> (CreateAuthorizer -> Maybe [Tag] -> CreateAuthorizer)
-> Lens
     CreateAuthorizer CreateAuthorizer (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateAuthorizer' :: CreateAuthorizer -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe [Tag]
a -> CreateAuthorizer
s {$sel:tags:CreateAuthorizer' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateAuthorizer) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateAuthorizer -> f CreateAuthorizer)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAuthorizer
-> f CreateAuthorizer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The authorizer name.
createAuthorizer_authorizerName :: Lens.Lens' CreateAuthorizer Prelude.Text
createAuthorizer_authorizerName :: (Text -> f Text) -> CreateAuthorizer -> f CreateAuthorizer
createAuthorizer_authorizerName = (CreateAuthorizer -> Text)
-> (CreateAuthorizer -> Text -> CreateAuthorizer)
-> Lens CreateAuthorizer CreateAuthorizer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Text
authorizerName :: Text
$sel:authorizerName:CreateAuthorizer' :: CreateAuthorizer -> Text
authorizerName} -> Text
authorizerName) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Text
a -> CreateAuthorizer
s {$sel:authorizerName:CreateAuthorizer' :: Text
authorizerName = Text
a} :: CreateAuthorizer)

-- | The ARN of the authorizer\'s Lambda function.
createAuthorizer_authorizerFunctionArn :: Lens.Lens' CreateAuthorizer Prelude.Text
createAuthorizer_authorizerFunctionArn :: (Text -> f Text) -> CreateAuthorizer -> f CreateAuthorizer
createAuthorizer_authorizerFunctionArn = (CreateAuthorizer -> Text)
-> (CreateAuthorizer -> Text -> CreateAuthorizer)
-> Lens CreateAuthorizer CreateAuthorizer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Text
authorizerFunctionArn :: Text
$sel:authorizerFunctionArn:CreateAuthorizer' :: CreateAuthorizer -> Text
authorizerFunctionArn} -> Text
authorizerFunctionArn) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Text
a -> CreateAuthorizer
s {$sel:authorizerFunctionArn:CreateAuthorizer' :: Text
authorizerFunctionArn = Text
a} :: CreateAuthorizer)

instance Core.AWSRequest CreateAuthorizer where
  type
    AWSResponse CreateAuthorizer =
      CreateAuthorizerResponse
  request :: CreateAuthorizer -> Request CreateAuthorizer
request = Service -> CreateAuthorizer -> Request CreateAuthorizer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateAuthorizer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAuthorizer)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateAuthorizer))
-> Logger
-> Service
-> Proxy CreateAuthorizer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAuthorizer)))
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 Text -> Maybe Text -> Int -> CreateAuthorizerResponse
CreateAuthorizerResponse'
            (Maybe Text -> Maybe Text -> Int -> CreateAuthorizerResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateAuthorizerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"authorizerName")
            Either String (Maybe Text -> Int -> CreateAuthorizerResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateAuthorizerResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"authorizerArn")
            Either String (Int -> CreateAuthorizerResponse)
-> Either String Int -> Either String CreateAuthorizerResponse
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 CreateAuthorizer

instance Prelude.NFData CreateAuthorizer

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

instance Core.ToJSON CreateAuthorizer where
  toJSON :: CreateAuthorizer -> Value
toJSON CreateAuthorizer' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Maybe AuthorizerStatus
Text
authorizerFunctionArn :: Text
authorizerName :: Text
tags :: Maybe [Tag]
tokenKeyName :: Maybe Text
tokenSigningPublicKeys :: Maybe (HashMap Text Text)
signingDisabled :: Maybe Bool
status :: Maybe AuthorizerStatus
$sel:authorizerFunctionArn:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:authorizerName:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:tags:CreateAuthorizer' :: CreateAuthorizer -> Maybe [Tag]
$sel:tokenKeyName:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:tokenSigningPublicKeys:CreateAuthorizer' :: CreateAuthorizer -> Maybe (HashMap Text Text)
$sel:signingDisabled:CreateAuthorizer' :: CreateAuthorizer -> Maybe Bool
$sel:status:CreateAuthorizer' :: CreateAuthorizer -> Maybe AuthorizerStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"status" Text -> AuthorizerStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AuthorizerStatus -> Pair) -> Maybe AuthorizerStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthorizerStatus
status,
            (Text
"signingDisabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
signingDisabled,
            (Text
"tokenSigningPublicKeys" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tokenSigningPublicKeys,
            (Text
"tokenKeyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
tokenKeyName,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"authorizerFunctionArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
authorizerFunctionArn
              )
          ]
      )

instance Core.ToPath CreateAuthorizer where
  toPath :: CreateAuthorizer -> ByteString
toPath CreateAuthorizer' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Maybe AuthorizerStatus
Text
authorizerFunctionArn :: Text
authorizerName :: Text
tags :: Maybe [Tag]
tokenKeyName :: Maybe Text
tokenSigningPublicKeys :: Maybe (HashMap Text Text)
signingDisabled :: Maybe Bool
status :: Maybe AuthorizerStatus
$sel:authorizerFunctionArn:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:authorizerName:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:tags:CreateAuthorizer' :: CreateAuthorizer -> Maybe [Tag]
$sel:tokenKeyName:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:tokenSigningPublicKeys:CreateAuthorizer' :: CreateAuthorizer -> Maybe (HashMap Text Text)
$sel:signingDisabled:CreateAuthorizer' :: CreateAuthorizer -> Maybe Bool
$sel:status:CreateAuthorizer' :: CreateAuthorizer -> Maybe AuthorizerStatus
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/authorizer/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
authorizerName]

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

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

-- |
-- Create a value of 'CreateAuthorizerResponse' 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', 'createAuthorizerResponse_authorizerName' - The authorizer\'s name.
--
-- 'authorizerArn', 'createAuthorizerResponse_authorizerArn' - The authorizer ARN.
--
-- 'httpStatus', 'createAuthorizerResponse_httpStatus' - The response's http status code.
newCreateAuthorizerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateAuthorizerResponse
newCreateAuthorizerResponse :: Int -> CreateAuthorizerResponse
newCreateAuthorizerResponse Int
pHttpStatus_ =
  CreateAuthorizerResponse' :: Maybe Text -> Maybe Text -> Int -> CreateAuthorizerResponse
CreateAuthorizerResponse'
    { $sel:authorizerName:CreateAuthorizerResponse' :: Maybe Text
authorizerName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerArn:CreateAuthorizerResponse' :: Maybe Text
authorizerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateAuthorizerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The authorizer\'s name.
createAuthorizerResponse_authorizerName :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe Prelude.Text)
createAuthorizerResponse_authorizerName :: (Maybe Text -> f (Maybe Text))
-> CreateAuthorizerResponse -> f CreateAuthorizerResponse
createAuthorizerResponse_authorizerName = (CreateAuthorizerResponse -> Maybe Text)
-> (CreateAuthorizerResponse
    -> Maybe Text -> CreateAuthorizerResponse)
-> Lens
     CreateAuthorizerResponse
     CreateAuthorizerResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe Text
authorizerName :: Maybe Text
$sel:authorizerName:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
authorizerName} -> Maybe Text
authorizerName) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe Text
a -> CreateAuthorizerResponse
s {$sel:authorizerName:CreateAuthorizerResponse' :: Maybe Text
authorizerName = Maybe Text
a} :: CreateAuthorizerResponse)

-- | The authorizer ARN.
createAuthorizerResponse_authorizerArn :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe Prelude.Text)
createAuthorizerResponse_authorizerArn :: (Maybe Text -> f (Maybe Text))
-> CreateAuthorizerResponse -> f CreateAuthorizerResponse
createAuthorizerResponse_authorizerArn = (CreateAuthorizerResponse -> Maybe Text)
-> (CreateAuthorizerResponse
    -> Maybe Text -> CreateAuthorizerResponse)
-> Lens
     CreateAuthorizerResponse
     CreateAuthorizerResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe Text
authorizerArn :: Maybe Text
$sel:authorizerArn:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
authorizerArn} -> Maybe Text
authorizerArn) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe Text
a -> CreateAuthorizerResponse
s {$sel:authorizerArn:CreateAuthorizerResponse' :: Maybe Text
authorizerArn = Maybe Text
a} :: CreateAuthorizerResponse)

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

instance Prelude.NFData CreateAuthorizerResponse