{-# 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.ApiGatewayV2.CreateAuthorizer
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an Authorizer for an API.
module Amazonka.ApiGatewayV2.CreateAuthorizer
  ( -- * Creating a Request
    CreateAuthorizer (..),
    newCreateAuthorizer,

    -- * Request Lenses
    createAuthorizer_authorizerCredentialsArn,
    createAuthorizer_authorizerPayloadFormatVersion,
    createAuthorizer_authorizerResultTtlInSeconds,
    createAuthorizer_authorizerUri,
    createAuthorizer_enableSimpleResponses,
    createAuthorizer_identityValidationExpression,
    createAuthorizer_jwtConfiguration,
    createAuthorizer_apiId,
    createAuthorizer_authorizerType,
    createAuthorizer_identitySource,
    createAuthorizer_name,

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

    -- * Response Lenses
    createAuthorizerResponse_authorizerCredentialsArn,
    createAuthorizerResponse_authorizerId,
    createAuthorizerResponse_authorizerPayloadFormatVersion,
    createAuthorizerResponse_authorizerResultTtlInSeconds,
    createAuthorizerResponse_authorizerType,
    createAuthorizerResponse_authorizerUri,
    createAuthorizerResponse_enableSimpleResponses,
    createAuthorizerResponse_identitySource,
    createAuthorizerResponse_identityValidationExpression,
    createAuthorizerResponse_jwtConfiguration,
    createAuthorizerResponse_name,
    createAuthorizerResponse_httpStatus,
  )
where

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

-- | Creates a new Authorizer resource to represent an authorizer.
--
-- /See:/ 'newCreateAuthorizer' smart constructor.
data CreateAuthorizer = CreateAuthorizer'
  { -- | Specifies the required credentials as an IAM role for API Gateway to
    -- invoke the authorizer. To specify an IAM role for API Gateway to assume,
    -- use the role\'s Amazon Resource Name (ARN). To use resource-based
    -- permissions on the Lambda function, don\'t specify this parameter.
    -- Supported only for REQUEST authorizers.
    CreateAuthorizer -> Maybe Text
authorizerCredentialsArn :: Prelude.Maybe Prelude.Text,
    -- | Specifies the format of the payload sent to an HTTP API Lambda
    -- authorizer. Required for HTTP API Lambda authorizers. Supported values
    -- are 1.0 and 2.0. To learn more, see
    -- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
    CreateAuthorizer -> Maybe Text
authorizerPayloadFormatVersion :: Prelude.Maybe Prelude.Text,
    -- | The time to live (TTL) for cached authorizer results, in seconds. If it
    -- equals 0, authorization caching is disabled. If it is greater than 0,
    -- API Gateway caches authorizer responses. The maximum value is 3600, or 1
    -- hour. Supported only for HTTP API Lambda authorizers.
    CreateAuthorizer -> Maybe Natural
authorizerResultTtlInSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The authorizer\'s Uniform Resource Identifier (URI). For REQUEST
    -- authorizers, this must be a well-formed Lambda function URI, for
    -- example,
    -- arn:aws:apigateway:us-west-2:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}\/invocations.
    -- In general, the URI has this form:
    -- arn:aws:apigateway:{region}:lambda:path\/{service_api} , where {region}
    -- is the same as the region hosting the Lambda function, path indicates
    -- that the remaining substring in the URI should be treated as the path to
    -- the resource, including the initial \/. For Lambda functions, this is
    -- usually of the form \/2015-03-31\/functions\/[FunctionARN]\/invocations.
    -- Supported only for REQUEST authorizers.
    CreateAuthorizer -> Maybe Text
authorizerUri :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether a Lambda authorizer returns a response in a simple
    -- format. By default, a Lambda authorizer must return an IAM policy. If
    -- enabled, the Lambda authorizer can return a boolean value instead of an
    -- IAM policy. Supported only for HTTP APIs. To learn more, see
    -- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>
    CreateAuthorizer -> Maybe Bool
enableSimpleResponses :: Prelude.Maybe Prelude.Bool,
    -- | This parameter is not used.
    CreateAuthorizer -> Maybe Text
identityValidationExpression :: Prelude.Maybe Prelude.Text,
    -- | Represents the configuration of a JWT authorizer. Required for the JWT
    -- authorizer type. Supported only for HTTP APIs.
    CreateAuthorizer -> Maybe JWTConfiguration
jwtConfiguration :: Prelude.Maybe JWTConfiguration,
    -- | The API identifier.
    CreateAuthorizer -> Text
apiId :: Prelude.Text,
    -- | The authorizer type. Specify REQUEST for a Lambda function using
    -- incoming request parameters. Specify JWT to use JSON Web Tokens
    -- (supported only for HTTP APIs).
    CreateAuthorizer -> AuthorizerType
authorizerType :: AuthorizerType,
    -- | The identity source for which authorization is requested.
    --
    -- For a REQUEST authorizer, this is optional. The value is a set of one or
    -- more mapping expressions of the specified request parameters. The
    -- identity source can be headers, query string parameters, stage
    -- variables, and context parameters. For example, if an Auth header and a
    -- Name query string parameter are defined as identity sources, this value
    -- is route.request.header.Auth, route.request.querystring.Name for
    -- WebSocket APIs. For HTTP APIs, use selection expressions prefixed with
    -- \$, for example, $request.header.Auth, $request.querystring.Name. These
    -- parameters are used to perform runtime validation for Lambda-based
    -- authorizers by verifying all of the identity-related request parameters
    -- are present in the request, not null, and non-empty. Only when this is
    -- true does the authorizer invoke the authorizer Lambda function.
    -- Otherwise, it returns a 401 Unauthorized response without calling the
    -- Lambda function. For HTTP APIs, identity sources are also used as the
    -- cache key when caching is enabled. To learn more, see
    -- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
    --
    -- For JWT, a single entry that specifies where to extract the JSON Web
    -- Token (JWT) from inbound requests. Currently only header-based and query
    -- parameter-based selections are supported, for example
    -- \$request.header.Authorization.
    CreateAuthorizer -> [Text]
identitySource :: [Prelude.Text],
    -- | The name of the authorizer.
    CreateAuthorizer -> Text
name :: Prelude.Text
  }
  deriving (CreateAuthorizer -> CreateAuthorizer -> Bool
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]
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
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. 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:
--
-- 'authorizerCredentialsArn', 'createAuthorizer_authorizerCredentialsArn' - Specifies the required credentials as an IAM role for API Gateway to
-- invoke the authorizer. To specify an IAM role for API Gateway to assume,
-- use the role\'s Amazon Resource Name (ARN). To use resource-based
-- permissions on the Lambda function, don\'t specify this parameter.
-- Supported only for REQUEST authorizers.
--
-- 'authorizerPayloadFormatVersion', 'createAuthorizer_authorizerPayloadFormatVersion' - Specifies the format of the payload sent to an HTTP API Lambda
-- authorizer. Required for HTTP API Lambda authorizers. Supported values
-- are 1.0 and 2.0. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
--
-- 'authorizerResultTtlInSeconds', 'createAuthorizer_authorizerResultTtlInSeconds' - The time to live (TTL) for cached authorizer results, in seconds. If it
-- equals 0, authorization caching is disabled. If it is greater than 0,
-- API Gateway caches authorizer responses. The maximum value is 3600, or 1
-- hour. Supported only for HTTP API Lambda authorizers.
--
-- 'authorizerUri', 'createAuthorizer_authorizerUri' - The authorizer\'s Uniform Resource Identifier (URI). For REQUEST
-- authorizers, this must be a well-formed Lambda function URI, for
-- example,
-- arn:aws:apigateway:us-west-2:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}\/invocations.
-- In general, the URI has this form:
-- arn:aws:apigateway:{region}:lambda:path\/{service_api} , where {region}
-- is the same as the region hosting the Lambda function, path indicates
-- that the remaining substring in the URI should be treated as the path to
-- the resource, including the initial \/. For Lambda functions, this is
-- usually of the form \/2015-03-31\/functions\/[FunctionARN]\/invocations.
-- Supported only for REQUEST authorizers.
--
-- 'enableSimpleResponses', 'createAuthorizer_enableSimpleResponses' - Specifies whether a Lambda authorizer returns a response in a simple
-- format. By default, a Lambda authorizer must return an IAM policy. If
-- enabled, the Lambda authorizer can return a boolean value instead of an
-- IAM policy. Supported only for HTTP APIs. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>
--
-- 'identityValidationExpression', 'createAuthorizer_identityValidationExpression' - This parameter is not used.
--
-- 'jwtConfiguration', 'createAuthorizer_jwtConfiguration' - Represents the configuration of a JWT authorizer. Required for the JWT
-- authorizer type. Supported only for HTTP APIs.
--
-- 'apiId', 'createAuthorizer_apiId' - The API identifier.
--
-- 'authorizerType', 'createAuthorizer_authorizerType' - The authorizer type. Specify REQUEST for a Lambda function using
-- incoming request parameters. Specify JWT to use JSON Web Tokens
-- (supported only for HTTP APIs).
--
-- 'identitySource', 'createAuthorizer_identitySource' - The identity source for which authorization is requested.
--
-- For a REQUEST authorizer, this is optional. The value is a set of one or
-- more mapping expressions of the specified request parameters. The
-- identity source can be headers, query string parameters, stage
-- variables, and context parameters. For example, if an Auth header and a
-- Name query string parameter are defined as identity sources, this value
-- is route.request.header.Auth, route.request.querystring.Name for
-- WebSocket APIs. For HTTP APIs, use selection expressions prefixed with
-- \$, for example, $request.header.Auth, $request.querystring.Name. These
-- parameters are used to perform runtime validation for Lambda-based
-- authorizers by verifying all of the identity-related request parameters
-- are present in the request, not null, and non-empty. Only when this is
-- true does the authorizer invoke the authorizer Lambda function.
-- Otherwise, it returns a 401 Unauthorized response without calling the
-- Lambda function. For HTTP APIs, identity sources are also used as the
-- cache key when caching is enabled. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
--
-- For JWT, a single entry that specifies where to extract the JSON Web
-- Token (JWT) from inbound requests. Currently only header-based and query
-- parameter-based selections are supported, for example
-- \$request.header.Authorization.
--
-- 'name', 'createAuthorizer_name' - The name of the authorizer.
newCreateAuthorizer ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'authorizerType'
  AuthorizerType ->
  -- | 'name'
  Prelude.Text ->
  CreateAuthorizer
newCreateAuthorizer :: Text -> AuthorizerType -> Text -> CreateAuthorizer
newCreateAuthorizer Text
pApiId_ AuthorizerType
pAuthorizerType_ Text
pName_ =
  CreateAuthorizer'
    { $sel:authorizerCredentialsArn:CreateAuthorizer' :: Maybe Text
authorizerCredentialsArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerPayloadFormatVersion:CreateAuthorizer' :: Maybe Text
authorizerPayloadFormatVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerResultTtlInSeconds:CreateAuthorizer' :: Maybe Natural
authorizerResultTtlInSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerUri:CreateAuthorizer' :: Maybe Text
authorizerUri = forall a. Maybe a
Prelude.Nothing,
      $sel:enableSimpleResponses:CreateAuthorizer' :: Maybe Bool
enableSimpleResponses = forall a. Maybe a
Prelude.Nothing,
      $sel:identityValidationExpression:CreateAuthorizer' :: Maybe Text
identityValidationExpression = forall a. Maybe a
Prelude.Nothing,
      $sel:jwtConfiguration:CreateAuthorizer' :: Maybe JWTConfiguration
jwtConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:apiId:CreateAuthorizer' :: Text
apiId = Text
pApiId_,
      $sel:authorizerType:CreateAuthorizer' :: AuthorizerType
authorizerType = AuthorizerType
pAuthorizerType_,
      $sel:identitySource:CreateAuthorizer' :: [Text]
identitySource = forall a. Monoid a => a
Prelude.mempty,
      $sel:name:CreateAuthorizer' :: Text
name = Text
pName_
    }

-- | Specifies the required credentials as an IAM role for API Gateway to
-- invoke the authorizer. To specify an IAM role for API Gateway to assume,
-- use the role\'s Amazon Resource Name (ARN). To use resource-based
-- permissions on the Lambda function, don\'t specify this parameter.
-- Supported only for REQUEST authorizers.
createAuthorizer_authorizerCredentialsArn :: Lens.Lens' CreateAuthorizer (Prelude.Maybe Prelude.Text)
createAuthorizer_authorizerCredentialsArn :: Lens' CreateAuthorizer (Maybe Text)
createAuthorizer_authorizerCredentialsArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe Text
authorizerCredentialsArn :: Maybe Text
$sel:authorizerCredentialsArn:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
authorizerCredentialsArn} -> Maybe Text
authorizerCredentialsArn) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe Text
a -> CreateAuthorizer
s {$sel:authorizerCredentialsArn:CreateAuthorizer' :: Maybe Text
authorizerCredentialsArn = Maybe Text
a} :: CreateAuthorizer)

-- | Specifies the format of the payload sent to an HTTP API Lambda
-- authorizer. Required for HTTP API Lambda authorizers. Supported values
-- are 1.0 and 2.0. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
createAuthorizer_authorizerPayloadFormatVersion :: Lens.Lens' CreateAuthorizer (Prelude.Maybe Prelude.Text)
createAuthorizer_authorizerPayloadFormatVersion :: Lens' CreateAuthorizer (Maybe Text)
createAuthorizer_authorizerPayloadFormatVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe Text
authorizerPayloadFormatVersion :: Maybe Text
$sel:authorizerPayloadFormatVersion:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
authorizerPayloadFormatVersion} -> Maybe Text
authorizerPayloadFormatVersion) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe Text
a -> CreateAuthorizer
s {$sel:authorizerPayloadFormatVersion:CreateAuthorizer' :: Maybe Text
authorizerPayloadFormatVersion = Maybe Text
a} :: CreateAuthorizer)

-- | The time to live (TTL) for cached authorizer results, in seconds. If it
-- equals 0, authorization caching is disabled. If it is greater than 0,
-- API Gateway caches authorizer responses. The maximum value is 3600, or 1
-- hour. Supported only for HTTP API Lambda authorizers.
createAuthorizer_authorizerResultTtlInSeconds :: Lens.Lens' CreateAuthorizer (Prelude.Maybe Prelude.Natural)
createAuthorizer_authorizerResultTtlInSeconds :: Lens' CreateAuthorizer (Maybe Natural)
createAuthorizer_authorizerResultTtlInSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe Natural
authorizerResultTtlInSeconds :: Maybe Natural
$sel:authorizerResultTtlInSeconds:CreateAuthorizer' :: CreateAuthorizer -> Maybe Natural
authorizerResultTtlInSeconds} -> Maybe Natural
authorizerResultTtlInSeconds) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe Natural
a -> CreateAuthorizer
s {$sel:authorizerResultTtlInSeconds:CreateAuthorizer' :: Maybe Natural
authorizerResultTtlInSeconds = Maybe Natural
a} :: CreateAuthorizer)

-- | The authorizer\'s Uniform Resource Identifier (URI). For REQUEST
-- authorizers, this must be a well-formed Lambda function URI, for
-- example,
-- arn:aws:apigateway:us-west-2:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}\/invocations.
-- In general, the URI has this form:
-- arn:aws:apigateway:{region}:lambda:path\/{service_api} , where {region}
-- is the same as the region hosting the Lambda function, path indicates
-- that the remaining substring in the URI should be treated as the path to
-- the resource, including the initial \/. For Lambda functions, this is
-- usually of the form \/2015-03-31\/functions\/[FunctionARN]\/invocations.
-- Supported only for REQUEST authorizers.
createAuthorizer_authorizerUri :: Lens.Lens' CreateAuthorizer (Prelude.Maybe Prelude.Text)
createAuthorizer_authorizerUri :: Lens' CreateAuthorizer (Maybe Text)
createAuthorizer_authorizerUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe Text
authorizerUri :: Maybe Text
$sel:authorizerUri:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
authorizerUri} -> Maybe Text
authorizerUri) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe Text
a -> CreateAuthorizer
s {$sel:authorizerUri:CreateAuthorizer' :: Maybe Text
authorizerUri = Maybe Text
a} :: CreateAuthorizer)

-- | Specifies whether a Lambda authorizer returns a response in a simple
-- format. By default, a Lambda authorizer must return an IAM policy. If
-- enabled, the Lambda authorizer can return a boolean value instead of an
-- IAM policy. Supported only for HTTP APIs. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>
createAuthorizer_enableSimpleResponses :: Lens.Lens' CreateAuthorizer (Prelude.Maybe Prelude.Bool)
createAuthorizer_enableSimpleResponses :: Lens' CreateAuthorizer (Maybe Bool)
createAuthorizer_enableSimpleResponses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe Bool
enableSimpleResponses :: Maybe Bool
$sel:enableSimpleResponses:CreateAuthorizer' :: CreateAuthorizer -> Maybe Bool
enableSimpleResponses} -> Maybe Bool
enableSimpleResponses) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe Bool
a -> CreateAuthorizer
s {$sel:enableSimpleResponses:CreateAuthorizer' :: Maybe Bool
enableSimpleResponses = Maybe Bool
a} :: CreateAuthorizer)

-- | This parameter is not used.
createAuthorizer_identityValidationExpression :: Lens.Lens' CreateAuthorizer (Prelude.Maybe Prelude.Text)
createAuthorizer_identityValidationExpression :: Lens' CreateAuthorizer (Maybe Text)
createAuthorizer_identityValidationExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe Text
identityValidationExpression :: Maybe Text
$sel:identityValidationExpression:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
identityValidationExpression} -> Maybe Text
identityValidationExpression) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe Text
a -> CreateAuthorizer
s {$sel:identityValidationExpression:CreateAuthorizer' :: Maybe Text
identityValidationExpression = Maybe Text
a} :: CreateAuthorizer)

-- | Represents the configuration of a JWT authorizer. Required for the JWT
-- authorizer type. Supported only for HTTP APIs.
createAuthorizer_jwtConfiguration :: Lens.Lens' CreateAuthorizer (Prelude.Maybe JWTConfiguration)
createAuthorizer_jwtConfiguration :: Lens' CreateAuthorizer (Maybe JWTConfiguration)
createAuthorizer_jwtConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Maybe JWTConfiguration
jwtConfiguration :: Maybe JWTConfiguration
$sel:jwtConfiguration:CreateAuthorizer' :: CreateAuthorizer -> Maybe JWTConfiguration
jwtConfiguration} -> Maybe JWTConfiguration
jwtConfiguration) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Maybe JWTConfiguration
a -> CreateAuthorizer
s {$sel:jwtConfiguration:CreateAuthorizer' :: Maybe JWTConfiguration
jwtConfiguration = Maybe JWTConfiguration
a} :: CreateAuthorizer)

-- | The API identifier.
createAuthorizer_apiId :: Lens.Lens' CreateAuthorizer Prelude.Text
createAuthorizer_apiId :: Lens' CreateAuthorizer Text
createAuthorizer_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {Text
apiId :: Text
$sel:apiId:CreateAuthorizer' :: CreateAuthorizer -> Text
apiId} -> Text
apiId) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} Text
a -> CreateAuthorizer
s {$sel:apiId:CreateAuthorizer' :: Text
apiId = Text
a} :: CreateAuthorizer)

-- | The authorizer type. Specify REQUEST for a Lambda function using
-- incoming request parameters. Specify JWT to use JSON Web Tokens
-- (supported only for HTTP APIs).
createAuthorizer_authorizerType :: Lens.Lens' CreateAuthorizer AuthorizerType
createAuthorizer_authorizerType :: Lens' CreateAuthorizer AuthorizerType
createAuthorizer_authorizerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {AuthorizerType
authorizerType :: AuthorizerType
$sel:authorizerType:CreateAuthorizer' :: CreateAuthorizer -> AuthorizerType
authorizerType} -> AuthorizerType
authorizerType) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} AuthorizerType
a -> CreateAuthorizer
s {$sel:authorizerType:CreateAuthorizer' :: AuthorizerType
authorizerType = AuthorizerType
a} :: CreateAuthorizer)

-- | The identity source for which authorization is requested.
--
-- For a REQUEST authorizer, this is optional. The value is a set of one or
-- more mapping expressions of the specified request parameters. The
-- identity source can be headers, query string parameters, stage
-- variables, and context parameters. For example, if an Auth header and a
-- Name query string parameter are defined as identity sources, this value
-- is route.request.header.Auth, route.request.querystring.Name for
-- WebSocket APIs. For HTTP APIs, use selection expressions prefixed with
-- \$, for example, $request.header.Auth, $request.querystring.Name. These
-- parameters are used to perform runtime validation for Lambda-based
-- authorizers by verifying all of the identity-related request parameters
-- are present in the request, not null, and non-empty. Only when this is
-- true does the authorizer invoke the authorizer Lambda function.
-- Otherwise, it returns a 401 Unauthorized response without calling the
-- Lambda function. For HTTP APIs, identity sources are also used as the
-- cache key when caching is enabled. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
--
-- For JWT, a single entry that specifies where to extract the JSON Web
-- Token (JWT) from inbound requests. Currently only header-based and query
-- parameter-based selections are supported, for example
-- \$request.header.Authorization.
createAuthorizer_identitySource :: Lens.Lens' CreateAuthorizer [Prelude.Text]
createAuthorizer_identitySource :: Lens' CreateAuthorizer [Text]
createAuthorizer_identitySource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizer' {[Text]
identitySource :: [Text]
$sel:identitySource:CreateAuthorizer' :: CreateAuthorizer -> [Text]
identitySource} -> [Text]
identitySource) (\s :: CreateAuthorizer
s@CreateAuthorizer' {} [Text]
a -> CreateAuthorizer
s {$sel:identitySource:CreateAuthorizer' :: [Text]
identitySource = [Text]
a} :: CreateAuthorizer) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Core.AWSRequest CreateAuthorizer where
  type
    AWSResponse CreateAuthorizer =
      CreateAuthorizerResponse
  request :: (Service -> Service)
-> CreateAuthorizer -> Request CreateAuthorizer
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 CreateAuthorizer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAuthorizer)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe AuthorizerType
-> Maybe Text
-> Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> Maybe JWTConfiguration
-> Maybe Text
-> Int
-> CreateAuthorizerResponse
CreateAuthorizerResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"authorizerCredentialsArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"authorizerId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"authorizerPayloadFormatVersion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"authorizerResultTtlInSeconds")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"authorizerType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"authorizerUri")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"enableSimpleResponses")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"identitySource" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"identityValidationExpression")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"jwtConfiguration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"name")
            forall (f :: * -> *) a b. Applicative f => 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 CreateAuthorizer where
  hashWithSalt :: Int -> CreateAuthorizer -> Int
hashWithSalt Int
_salt CreateAuthorizer' {[Text]
Maybe Bool
Maybe Natural
Maybe Text
Maybe JWTConfiguration
Text
AuthorizerType
name :: Text
identitySource :: [Text]
authorizerType :: AuthorizerType
apiId :: Text
jwtConfiguration :: Maybe JWTConfiguration
identityValidationExpression :: Maybe Text
enableSimpleResponses :: Maybe Bool
authorizerUri :: Maybe Text
authorizerResultTtlInSeconds :: Maybe Natural
authorizerPayloadFormatVersion :: Maybe Text
authorizerCredentialsArn :: Maybe Text
$sel:name:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:identitySource:CreateAuthorizer' :: CreateAuthorizer -> [Text]
$sel:authorizerType:CreateAuthorizer' :: CreateAuthorizer -> AuthorizerType
$sel:apiId:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:jwtConfiguration:CreateAuthorizer' :: CreateAuthorizer -> Maybe JWTConfiguration
$sel:identityValidationExpression:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:enableSimpleResponses:CreateAuthorizer' :: CreateAuthorizer -> Maybe Bool
$sel:authorizerUri:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:authorizerResultTtlInSeconds:CreateAuthorizer' :: CreateAuthorizer -> Maybe Natural
$sel:authorizerPayloadFormatVersion:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:authorizerCredentialsArn:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorizerCredentialsArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorizerPayloadFormatVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
authorizerResultTtlInSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorizerUri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enableSimpleResponses
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identityValidationExpression
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe JWTConfiguration
jwtConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AuthorizerType
authorizerType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
identitySource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData CreateAuthorizer where
  rnf :: CreateAuthorizer -> ()
rnf CreateAuthorizer' {[Text]
Maybe Bool
Maybe Natural
Maybe Text
Maybe JWTConfiguration
Text
AuthorizerType
name :: Text
identitySource :: [Text]
authorizerType :: AuthorizerType
apiId :: Text
jwtConfiguration :: Maybe JWTConfiguration
identityValidationExpression :: Maybe Text
enableSimpleResponses :: Maybe Bool
authorizerUri :: Maybe Text
authorizerResultTtlInSeconds :: Maybe Natural
authorizerPayloadFormatVersion :: Maybe Text
authorizerCredentialsArn :: Maybe Text
$sel:name:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:identitySource:CreateAuthorizer' :: CreateAuthorizer -> [Text]
$sel:authorizerType:CreateAuthorizer' :: CreateAuthorizer -> AuthorizerType
$sel:apiId:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:jwtConfiguration:CreateAuthorizer' :: CreateAuthorizer -> Maybe JWTConfiguration
$sel:identityValidationExpression:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:enableSimpleResponses:CreateAuthorizer' :: CreateAuthorizer -> Maybe Bool
$sel:authorizerUri:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:authorizerResultTtlInSeconds:CreateAuthorizer' :: CreateAuthorizer -> Maybe Natural
$sel:authorizerPayloadFormatVersion:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:authorizerCredentialsArn:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizerCredentialsArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizerPayloadFormatVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
authorizerResultTtlInSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizerUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableSimpleResponses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityValidationExpression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JWTConfiguration
jwtConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
apiId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AuthorizerType
authorizerType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
identitySource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

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

instance Data.ToJSON CreateAuthorizer where
  toJSON :: CreateAuthorizer -> Value
toJSON CreateAuthorizer' {[Text]
Maybe Bool
Maybe Natural
Maybe Text
Maybe JWTConfiguration
Text
AuthorizerType
name :: Text
identitySource :: [Text]
authorizerType :: AuthorizerType
apiId :: Text
jwtConfiguration :: Maybe JWTConfiguration
identityValidationExpression :: Maybe Text
enableSimpleResponses :: Maybe Bool
authorizerUri :: Maybe Text
authorizerResultTtlInSeconds :: Maybe Natural
authorizerPayloadFormatVersion :: Maybe Text
authorizerCredentialsArn :: Maybe Text
$sel:name:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:identitySource:CreateAuthorizer' :: CreateAuthorizer -> [Text]
$sel:authorizerType:CreateAuthorizer' :: CreateAuthorizer -> AuthorizerType
$sel:apiId:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:jwtConfiguration:CreateAuthorizer' :: CreateAuthorizer -> Maybe JWTConfiguration
$sel:identityValidationExpression:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:enableSimpleResponses:CreateAuthorizer' :: CreateAuthorizer -> Maybe Bool
$sel:authorizerUri:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:authorizerResultTtlInSeconds:CreateAuthorizer' :: CreateAuthorizer -> Maybe Natural
$sel:authorizerPayloadFormatVersion:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:authorizerCredentialsArn:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"authorizerCredentialsArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
authorizerCredentialsArn,
            (Key
"authorizerPayloadFormatVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
authorizerPayloadFormatVersion,
            (Key
"authorizerResultTtlInSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
authorizerResultTtlInSeconds,
            (Key
"authorizerUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
authorizerUri,
            (Key
"enableSimpleResponses" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableSimpleResponses,
            (Key
"identityValidationExpression" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
identityValidationExpression,
            (Key
"jwtConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe JWTConfiguration
jwtConfiguration,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"authorizerType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AuthorizerType
authorizerType),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"identitySource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
identitySource),
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
          ]
      )

instance Data.ToPath CreateAuthorizer where
  toPath :: CreateAuthorizer -> ByteString
toPath CreateAuthorizer' {[Text]
Maybe Bool
Maybe Natural
Maybe Text
Maybe JWTConfiguration
Text
AuthorizerType
name :: Text
identitySource :: [Text]
authorizerType :: AuthorizerType
apiId :: Text
jwtConfiguration :: Maybe JWTConfiguration
identityValidationExpression :: Maybe Text
enableSimpleResponses :: Maybe Bool
authorizerUri :: Maybe Text
authorizerResultTtlInSeconds :: Maybe Natural
authorizerPayloadFormatVersion :: Maybe Text
authorizerCredentialsArn :: Maybe Text
$sel:name:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:identitySource:CreateAuthorizer' :: CreateAuthorizer -> [Text]
$sel:authorizerType:CreateAuthorizer' :: CreateAuthorizer -> AuthorizerType
$sel:apiId:CreateAuthorizer' :: CreateAuthorizer -> Text
$sel:jwtConfiguration:CreateAuthorizer' :: CreateAuthorizer -> Maybe JWTConfiguration
$sel:identityValidationExpression:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:enableSimpleResponses:CreateAuthorizer' :: CreateAuthorizer -> Maybe Bool
$sel:authorizerUri:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:authorizerResultTtlInSeconds:CreateAuthorizer' :: CreateAuthorizer -> Maybe Natural
$sel:authorizerPayloadFormatVersion:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
$sel:authorizerCredentialsArn:CreateAuthorizer' :: CreateAuthorizer -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v2/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId, ByteString
"/authorizers"]

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

-- | /See:/ 'newCreateAuthorizerResponse' smart constructor.
data CreateAuthorizerResponse = CreateAuthorizerResponse'
  { -- | Specifies the required credentials as an IAM role for API Gateway to
    -- invoke the authorizer. To specify an IAM role for API Gateway to assume,
    -- use the role\'s Amazon Resource Name (ARN). To use resource-based
    -- permissions on the Lambda function, don\'t specify this parameter.
    -- Supported only for REQUEST authorizers.
    CreateAuthorizerResponse -> Maybe Text
authorizerCredentialsArn :: Prelude.Maybe Prelude.Text,
    -- | The authorizer identifier.
    CreateAuthorizerResponse -> Maybe Text
authorizerId :: Prelude.Maybe Prelude.Text,
    -- | Specifies the format of the payload sent to an HTTP API Lambda
    -- authorizer. Required for HTTP API Lambda authorizers. Supported values
    -- are 1.0 and 2.0. To learn more, see
    -- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
    CreateAuthorizerResponse -> Maybe Text
authorizerPayloadFormatVersion :: Prelude.Maybe Prelude.Text,
    -- | The time to live (TTL) for cached authorizer results, in seconds. If it
    -- equals 0, authorization caching is disabled. If it is greater than 0,
    -- API Gateway caches authorizer responses. The maximum value is 3600, or 1
    -- hour. Supported only for HTTP API Lambda authorizers.
    CreateAuthorizerResponse -> Maybe Natural
authorizerResultTtlInSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The authorizer type. Specify REQUEST for a Lambda function using
    -- incoming request parameters. Specify JWT to use JSON Web Tokens
    -- (supported only for HTTP APIs).
    CreateAuthorizerResponse -> Maybe AuthorizerType
authorizerType :: Prelude.Maybe AuthorizerType,
    -- | The authorizer\'s Uniform Resource Identifier (URI). For REQUEST
    -- authorizers, this must be a well-formed Lambda function URI, for
    -- example,
    -- arn:aws:apigateway:us-west-2:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}\/invocations.
    -- In general, the URI has this form:
    -- arn:aws:apigateway:{region}:lambda:path\/{service_api} , where {region}
    -- is the same as the region hosting the Lambda function, path indicates
    -- that the remaining substring in the URI should be treated as the path to
    -- the resource, including the initial \/. For Lambda functions, this is
    -- usually of the form \/2015-03-31\/functions\/[FunctionARN]\/invocations.
    -- Supported only for REQUEST authorizers.
    CreateAuthorizerResponse -> Maybe Text
authorizerUri :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether a Lambda authorizer returns a response in a simple
    -- format. If enabled, the Lambda authorizer can return a boolean value
    -- instead of an IAM policy. Supported only for HTTP APIs. To learn more,
    -- see
    -- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>
    CreateAuthorizerResponse -> Maybe Bool
enableSimpleResponses :: Prelude.Maybe Prelude.Bool,
    -- | The identity source for which authorization is requested.
    --
    -- For a REQUEST authorizer, this is optional. The value is a set of one or
    -- more mapping expressions of the specified request parameters. The
    -- identity source can be headers, query string parameters, stage
    -- variables, and context parameters. For example, if an Auth header and a
    -- Name query string parameter are defined as identity sources, this value
    -- is route.request.header.Auth, route.request.querystring.Name for
    -- WebSocket APIs. For HTTP APIs, use selection expressions prefixed with
    -- \$, for example, $request.header.Auth, $request.querystring.Name. These
    -- parameters are used to perform runtime validation for Lambda-based
    -- authorizers by verifying all of the identity-related request parameters
    -- are present in the request, not null, and non-empty. Only when this is
    -- true does the authorizer invoke the authorizer Lambda function.
    -- Otherwise, it returns a 401 Unauthorized response without calling the
    -- Lambda function. For HTTP APIs, identity sources are also used as the
    -- cache key when caching is enabled. To learn more, see
    -- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
    --
    -- For JWT, a single entry that specifies where to extract the JSON Web
    -- Token (JWT) from inbound requests. Currently only header-based and query
    -- parameter-based selections are supported, for example
    -- \$request.header.Authorization.
    CreateAuthorizerResponse -> Maybe [Text]
identitySource :: Prelude.Maybe [Prelude.Text],
    -- | The validation expression does not apply to the REQUEST authorizer.
    CreateAuthorizerResponse -> Maybe Text
identityValidationExpression :: Prelude.Maybe Prelude.Text,
    -- | Represents the configuration of a JWT authorizer. Required for the JWT
    -- authorizer type. Supported only for HTTP APIs.
    CreateAuthorizerResponse -> Maybe JWTConfiguration
jwtConfiguration :: Prelude.Maybe JWTConfiguration,
    -- | The name of the authorizer.
    CreateAuthorizerResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateAuthorizerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateAuthorizerResponse -> CreateAuthorizerResponse -> Bool
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]
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
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.
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:
--
-- 'authorizerCredentialsArn', 'createAuthorizerResponse_authorizerCredentialsArn' - Specifies the required credentials as an IAM role for API Gateway to
-- invoke the authorizer. To specify an IAM role for API Gateway to assume,
-- use the role\'s Amazon Resource Name (ARN). To use resource-based
-- permissions on the Lambda function, don\'t specify this parameter.
-- Supported only for REQUEST authorizers.
--
-- 'authorizerId', 'createAuthorizerResponse_authorizerId' - The authorizer identifier.
--
-- 'authorizerPayloadFormatVersion', 'createAuthorizerResponse_authorizerPayloadFormatVersion' - Specifies the format of the payload sent to an HTTP API Lambda
-- authorizer. Required for HTTP API Lambda authorizers. Supported values
-- are 1.0 and 2.0. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
--
-- 'authorizerResultTtlInSeconds', 'createAuthorizerResponse_authorizerResultTtlInSeconds' - The time to live (TTL) for cached authorizer results, in seconds. If it
-- equals 0, authorization caching is disabled. If it is greater than 0,
-- API Gateway caches authorizer responses. The maximum value is 3600, or 1
-- hour. Supported only for HTTP API Lambda authorizers.
--
-- 'authorizerType', 'createAuthorizerResponse_authorizerType' - The authorizer type. Specify REQUEST for a Lambda function using
-- incoming request parameters. Specify JWT to use JSON Web Tokens
-- (supported only for HTTP APIs).
--
-- 'authorizerUri', 'createAuthorizerResponse_authorizerUri' - The authorizer\'s Uniform Resource Identifier (URI). For REQUEST
-- authorizers, this must be a well-formed Lambda function URI, for
-- example,
-- arn:aws:apigateway:us-west-2:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}\/invocations.
-- In general, the URI has this form:
-- arn:aws:apigateway:{region}:lambda:path\/{service_api} , where {region}
-- is the same as the region hosting the Lambda function, path indicates
-- that the remaining substring in the URI should be treated as the path to
-- the resource, including the initial \/. For Lambda functions, this is
-- usually of the form \/2015-03-31\/functions\/[FunctionARN]\/invocations.
-- Supported only for REQUEST authorizers.
--
-- 'enableSimpleResponses', 'createAuthorizerResponse_enableSimpleResponses' - Specifies whether a Lambda authorizer returns a response in a simple
-- format. If enabled, the Lambda authorizer can return a boolean value
-- instead of an IAM policy. Supported only for HTTP APIs. To learn more,
-- see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>
--
-- 'identitySource', 'createAuthorizerResponse_identitySource' - The identity source for which authorization is requested.
--
-- For a REQUEST authorizer, this is optional. The value is a set of one or
-- more mapping expressions of the specified request parameters. The
-- identity source can be headers, query string parameters, stage
-- variables, and context parameters. For example, if an Auth header and a
-- Name query string parameter are defined as identity sources, this value
-- is route.request.header.Auth, route.request.querystring.Name for
-- WebSocket APIs. For HTTP APIs, use selection expressions prefixed with
-- \$, for example, $request.header.Auth, $request.querystring.Name. These
-- parameters are used to perform runtime validation for Lambda-based
-- authorizers by verifying all of the identity-related request parameters
-- are present in the request, not null, and non-empty. Only when this is
-- true does the authorizer invoke the authorizer Lambda function.
-- Otherwise, it returns a 401 Unauthorized response without calling the
-- Lambda function. For HTTP APIs, identity sources are also used as the
-- cache key when caching is enabled. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
--
-- For JWT, a single entry that specifies where to extract the JSON Web
-- Token (JWT) from inbound requests. Currently only header-based and query
-- parameter-based selections are supported, for example
-- \$request.header.Authorization.
--
-- 'identityValidationExpression', 'createAuthorizerResponse_identityValidationExpression' - The validation expression does not apply to the REQUEST authorizer.
--
-- 'jwtConfiguration', 'createAuthorizerResponse_jwtConfiguration' - Represents the configuration of a JWT authorizer. Required for the JWT
-- authorizer type. Supported only for HTTP APIs.
--
-- 'name', 'createAuthorizerResponse_name' - The name of the authorizer.
--
-- 'httpStatus', 'createAuthorizerResponse_httpStatus' - The response's http status code.
newCreateAuthorizerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateAuthorizerResponse
newCreateAuthorizerResponse :: Int -> CreateAuthorizerResponse
newCreateAuthorizerResponse Int
pHttpStatus_ =
  CreateAuthorizerResponse'
    { $sel:authorizerCredentialsArn:CreateAuthorizerResponse' :: Maybe Text
authorizerCredentialsArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerId:CreateAuthorizerResponse' :: Maybe Text
authorizerId = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerPayloadFormatVersion:CreateAuthorizerResponse' :: Maybe Text
authorizerPayloadFormatVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerResultTtlInSeconds:CreateAuthorizerResponse' :: Maybe Natural
authorizerResultTtlInSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerType:CreateAuthorizerResponse' :: Maybe AuthorizerType
authorizerType = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerUri:CreateAuthorizerResponse' :: Maybe Text
authorizerUri = forall a. Maybe a
Prelude.Nothing,
      $sel:enableSimpleResponses:CreateAuthorizerResponse' :: Maybe Bool
enableSimpleResponses = forall a. Maybe a
Prelude.Nothing,
      $sel:identitySource:CreateAuthorizerResponse' :: Maybe [Text]
identitySource = forall a. Maybe a
Prelude.Nothing,
      $sel:identityValidationExpression:CreateAuthorizerResponse' :: Maybe Text
identityValidationExpression = forall a. Maybe a
Prelude.Nothing,
      $sel:jwtConfiguration:CreateAuthorizerResponse' :: Maybe JWTConfiguration
jwtConfiguration = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateAuthorizerResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateAuthorizerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Specifies the required credentials as an IAM role for API Gateway to
-- invoke the authorizer. To specify an IAM role for API Gateway to assume,
-- use the role\'s Amazon Resource Name (ARN). To use resource-based
-- permissions on the Lambda function, don\'t specify this parameter.
-- Supported only for REQUEST authorizers.
createAuthorizerResponse_authorizerCredentialsArn :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe Prelude.Text)
createAuthorizerResponse_authorizerCredentialsArn :: Lens' CreateAuthorizerResponse (Maybe Text)
createAuthorizerResponse_authorizerCredentialsArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe Text
authorizerCredentialsArn :: Maybe Text
$sel:authorizerCredentialsArn:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
authorizerCredentialsArn} -> Maybe Text
authorizerCredentialsArn) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe Text
a -> CreateAuthorizerResponse
s {$sel:authorizerCredentialsArn:CreateAuthorizerResponse' :: Maybe Text
authorizerCredentialsArn = Maybe Text
a} :: CreateAuthorizerResponse)

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

-- | Specifies the format of the payload sent to an HTTP API Lambda
-- authorizer. Required for HTTP API Lambda authorizers. Supported values
-- are 1.0 and 2.0. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
createAuthorizerResponse_authorizerPayloadFormatVersion :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe Prelude.Text)
createAuthorizerResponse_authorizerPayloadFormatVersion :: Lens' CreateAuthorizerResponse (Maybe Text)
createAuthorizerResponse_authorizerPayloadFormatVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe Text
authorizerPayloadFormatVersion :: Maybe Text
$sel:authorizerPayloadFormatVersion:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
authorizerPayloadFormatVersion} -> Maybe Text
authorizerPayloadFormatVersion) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe Text
a -> CreateAuthorizerResponse
s {$sel:authorizerPayloadFormatVersion:CreateAuthorizerResponse' :: Maybe Text
authorizerPayloadFormatVersion = Maybe Text
a} :: CreateAuthorizerResponse)

-- | The time to live (TTL) for cached authorizer results, in seconds. If it
-- equals 0, authorization caching is disabled. If it is greater than 0,
-- API Gateway caches authorizer responses. The maximum value is 3600, or 1
-- hour. Supported only for HTTP API Lambda authorizers.
createAuthorizerResponse_authorizerResultTtlInSeconds :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe Prelude.Natural)
createAuthorizerResponse_authorizerResultTtlInSeconds :: Lens' CreateAuthorizerResponse (Maybe Natural)
createAuthorizerResponse_authorizerResultTtlInSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe Natural
authorizerResultTtlInSeconds :: Maybe Natural
$sel:authorizerResultTtlInSeconds:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Natural
authorizerResultTtlInSeconds} -> Maybe Natural
authorizerResultTtlInSeconds) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe Natural
a -> CreateAuthorizerResponse
s {$sel:authorizerResultTtlInSeconds:CreateAuthorizerResponse' :: Maybe Natural
authorizerResultTtlInSeconds = Maybe Natural
a} :: CreateAuthorizerResponse)

-- | The authorizer type. Specify REQUEST for a Lambda function using
-- incoming request parameters. Specify JWT to use JSON Web Tokens
-- (supported only for HTTP APIs).
createAuthorizerResponse_authorizerType :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe AuthorizerType)
createAuthorizerResponse_authorizerType :: Lens' CreateAuthorizerResponse (Maybe AuthorizerType)
createAuthorizerResponse_authorizerType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe AuthorizerType
authorizerType :: Maybe AuthorizerType
$sel:authorizerType:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe AuthorizerType
authorizerType} -> Maybe AuthorizerType
authorizerType) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe AuthorizerType
a -> CreateAuthorizerResponse
s {$sel:authorizerType:CreateAuthorizerResponse' :: Maybe AuthorizerType
authorizerType = Maybe AuthorizerType
a} :: CreateAuthorizerResponse)

-- | The authorizer\'s Uniform Resource Identifier (URI). For REQUEST
-- authorizers, this must be a well-formed Lambda function URI, for
-- example,
-- arn:aws:apigateway:us-west-2:lambda:path\/2015-03-31\/functions\/arn:aws:lambda:us-west-2:{account_id}:function:{lambda_function_name}\/invocations.
-- In general, the URI has this form:
-- arn:aws:apigateway:{region}:lambda:path\/{service_api} , where {region}
-- is the same as the region hosting the Lambda function, path indicates
-- that the remaining substring in the URI should be treated as the path to
-- the resource, including the initial \/. For Lambda functions, this is
-- usually of the form \/2015-03-31\/functions\/[FunctionARN]\/invocations.
-- Supported only for REQUEST authorizers.
createAuthorizerResponse_authorizerUri :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe Prelude.Text)
createAuthorizerResponse_authorizerUri :: Lens' CreateAuthorizerResponse (Maybe Text)
createAuthorizerResponse_authorizerUri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe Text
authorizerUri :: Maybe Text
$sel:authorizerUri:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
authorizerUri} -> Maybe Text
authorizerUri) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe Text
a -> CreateAuthorizerResponse
s {$sel:authorizerUri:CreateAuthorizerResponse' :: Maybe Text
authorizerUri = Maybe Text
a} :: CreateAuthorizerResponse)

-- | Specifies whether a Lambda authorizer returns a response in a simple
-- format. If enabled, the Lambda authorizer can return a boolean value
-- instead of an IAM policy. Supported only for HTTP APIs. To learn more,
-- see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>
createAuthorizerResponse_enableSimpleResponses :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe Prelude.Bool)
createAuthorizerResponse_enableSimpleResponses :: Lens' CreateAuthorizerResponse (Maybe Bool)
createAuthorizerResponse_enableSimpleResponses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe Bool
enableSimpleResponses :: Maybe Bool
$sel:enableSimpleResponses:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Bool
enableSimpleResponses} -> Maybe Bool
enableSimpleResponses) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe Bool
a -> CreateAuthorizerResponse
s {$sel:enableSimpleResponses:CreateAuthorizerResponse' :: Maybe Bool
enableSimpleResponses = Maybe Bool
a} :: CreateAuthorizerResponse)

-- | The identity source for which authorization is requested.
--
-- For a REQUEST authorizer, this is optional. The value is a set of one or
-- more mapping expressions of the specified request parameters. The
-- identity source can be headers, query string parameters, stage
-- variables, and context parameters. For example, if an Auth header and a
-- Name query string parameter are defined as identity sources, this value
-- is route.request.header.Auth, route.request.querystring.Name for
-- WebSocket APIs. For HTTP APIs, use selection expressions prefixed with
-- \$, for example, $request.header.Auth, $request.querystring.Name. These
-- parameters are used to perform runtime validation for Lambda-based
-- authorizers by verifying all of the identity-related request parameters
-- are present in the request, not null, and non-empty. Only when this is
-- true does the authorizer invoke the authorizer Lambda function.
-- Otherwise, it returns a 401 Unauthorized response without calling the
-- Lambda function. For HTTP APIs, identity sources are also used as the
-- cache key when caching is enabled. To learn more, see
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-lambda-authorizer.html Working with AWS Lambda authorizers for HTTP APIs>.
--
-- For JWT, a single entry that specifies where to extract the JSON Web
-- Token (JWT) from inbound requests. Currently only header-based and query
-- parameter-based selections are supported, for example
-- \$request.header.Authorization.
createAuthorizerResponse_identitySource :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe [Prelude.Text])
createAuthorizerResponse_identitySource :: Lens' CreateAuthorizerResponse (Maybe [Text])
createAuthorizerResponse_identitySource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe [Text]
identitySource :: Maybe [Text]
$sel:identitySource:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe [Text]
identitySource} -> Maybe [Text]
identitySource) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe [Text]
a -> CreateAuthorizerResponse
s {$sel:identitySource:CreateAuthorizerResponse' :: Maybe [Text]
identitySource = Maybe [Text]
a} :: CreateAuthorizerResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The validation expression does not apply to the REQUEST authorizer.
createAuthorizerResponse_identityValidationExpression :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe Prelude.Text)
createAuthorizerResponse_identityValidationExpression :: Lens' CreateAuthorizerResponse (Maybe Text)
createAuthorizerResponse_identityValidationExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe Text
identityValidationExpression :: Maybe Text
$sel:identityValidationExpression:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
identityValidationExpression} -> Maybe Text
identityValidationExpression) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe Text
a -> CreateAuthorizerResponse
s {$sel:identityValidationExpression:CreateAuthorizerResponse' :: Maybe Text
identityValidationExpression = Maybe Text
a} :: CreateAuthorizerResponse)

-- | Represents the configuration of a JWT authorizer. Required for the JWT
-- authorizer type. Supported only for HTTP APIs.
createAuthorizerResponse_jwtConfiguration :: Lens.Lens' CreateAuthorizerResponse (Prelude.Maybe JWTConfiguration)
createAuthorizerResponse_jwtConfiguration :: Lens' CreateAuthorizerResponse (Maybe JWTConfiguration)
createAuthorizerResponse_jwtConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAuthorizerResponse' {Maybe JWTConfiguration
jwtConfiguration :: Maybe JWTConfiguration
$sel:jwtConfiguration:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe JWTConfiguration
jwtConfiguration} -> Maybe JWTConfiguration
jwtConfiguration) (\s :: CreateAuthorizerResponse
s@CreateAuthorizerResponse' {} Maybe JWTConfiguration
a -> CreateAuthorizerResponse
s {$sel:jwtConfiguration:CreateAuthorizerResponse' :: Maybe JWTConfiguration
jwtConfiguration = Maybe JWTConfiguration
a} :: CreateAuthorizerResponse)

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

-- | The response's http status code.
createAuthorizerResponse_httpStatus :: Lens.Lens' CreateAuthorizerResponse Prelude.Int
createAuthorizerResponse_httpStatus :: Lens' CreateAuthorizerResponse Int
createAuthorizerResponse_httpStatus = 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 where
  rnf :: CreateAuthorizerResponse -> ()
rnf CreateAuthorizerResponse' {Int
Maybe Bool
Maybe Natural
Maybe [Text]
Maybe Text
Maybe AuthorizerType
Maybe JWTConfiguration
httpStatus :: Int
name :: Maybe Text
jwtConfiguration :: Maybe JWTConfiguration
identityValidationExpression :: Maybe Text
identitySource :: Maybe [Text]
enableSimpleResponses :: Maybe Bool
authorizerUri :: Maybe Text
authorizerType :: Maybe AuthorizerType
authorizerResultTtlInSeconds :: Maybe Natural
authorizerPayloadFormatVersion :: Maybe Text
authorizerId :: Maybe Text
authorizerCredentialsArn :: Maybe Text
$sel:httpStatus:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Int
$sel:name:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
$sel:jwtConfiguration:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe JWTConfiguration
$sel:identityValidationExpression:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
$sel:identitySource:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe [Text]
$sel:enableSimpleResponses:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Bool
$sel:authorizerUri:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
$sel:authorizerType:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe AuthorizerType
$sel:authorizerResultTtlInSeconds:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Natural
$sel:authorizerPayloadFormatVersion:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
$sel:authorizerId:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
$sel:authorizerCredentialsArn:CreateAuthorizerResponse' :: CreateAuthorizerResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizerCredentialsArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizerId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizerPayloadFormatVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
authorizerResultTtlInSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AuthorizerType
authorizerType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizerUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableSimpleResponses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
identitySource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identityValidationExpression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe JWTConfiguration
jwtConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus