{-# 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.CreateRoute
-- 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 a Route for an API.
module Amazonka.ApiGatewayV2.CreateRoute
  ( -- * Creating a Request
    CreateRoute (..),
    newCreateRoute,

    -- * Request Lenses
    createRoute_apiKeyRequired,
    createRoute_authorizationScopes,
    createRoute_authorizationType,
    createRoute_authorizerId,
    createRoute_modelSelectionExpression,
    createRoute_operationName,
    createRoute_requestModels,
    createRoute_requestParameters,
    createRoute_routeResponseSelectionExpression,
    createRoute_target,
    createRoute_apiId,
    createRoute_routeKey,

    -- * Destructuring the Response
    CreateRouteResponse' (..),
    newCreateRouteResponse',

    -- * Response Lenses
    createRouteResponse'_apiGatewayManaged,
    createRouteResponse'_apiKeyRequired,
    createRouteResponse'_authorizationScopes,
    createRouteResponse'_authorizationType,
    createRouteResponse'_authorizerId,
    createRouteResponse'_modelSelectionExpression,
    createRouteResponse'_operationName,
    createRouteResponse'_requestModels,
    createRouteResponse'_requestParameters,
    createRouteResponse'_routeId,
    createRouteResponse'_routeKey,
    createRouteResponse'_routeResponseSelectionExpression,
    createRouteResponse'_target,
    createRouteResponse'_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 Route resource to represent a route.
--
-- /See:/ 'newCreateRoute' smart constructor.
data CreateRoute = CreateRoute'
  { -- | Specifies whether an API key is required for the route. Supported only
    -- for WebSocket APIs.
    CreateRoute -> Maybe Bool
apiKeyRequired :: Prelude.Maybe Prelude.Bool,
    -- | The authorization scopes supported by this route.
    CreateRoute -> Maybe [Text]
authorizationScopes :: Prelude.Maybe [Prelude.Text],
    -- | The authorization type for the route. For WebSocket APIs, valid values
    -- are NONE for open access, AWS_IAM for using AWS IAM permissions, and
    -- CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are
    -- NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using
    -- AWS IAM permissions, and CUSTOM for using a Lambda authorizer.
    CreateRoute -> Maybe AuthorizationType
authorizationType :: Prelude.Maybe AuthorizationType,
    -- | The identifier of the Authorizer resource to be associated with this
    -- route. The authorizer identifier is generated by API Gateway when you
    -- created the authorizer.
    CreateRoute -> Maybe Text
authorizerId :: Prelude.Maybe Prelude.Text,
    -- | The model selection expression for the route. Supported only for
    -- WebSocket APIs.
    CreateRoute -> Maybe Text
modelSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | The operation name for the route.
    CreateRoute -> Maybe Text
operationName :: Prelude.Maybe Prelude.Text,
    -- | The request models for the route. Supported only for WebSocket APIs.
    CreateRoute -> Maybe (HashMap Text Text)
requestModels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The request parameters for the route. Supported only for WebSocket APIs.
    CreateRoute -> Maybe (HashMap Text ParameterConstraints)
requestParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints),
    -- | The route response selection expression for the route. Supported only
    -- for WebSocket APIs.
    CreateRoute -> Maybe Text
routeResponseSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | The target for the route.
    CreateRoute -> Maybe Text
target :: Prelude.Maybe Prelude.Text,
    -- | The API identifier.
    CreateRoute -> Text
apiId :: Prelude.Text,
    -- | The route key for the route.
    CreateRoute -> Text
routeKey :: Prelude.Text
  }
  deriving (CreateRoute -> CreateRoute -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRoute -> CreateRoute -> Bool
$c/= :: CreateRoute -> CreateRoute -> Bool
== :: CreateRoute -> CreateRoute -> Bool
$c== :: CreateRoute -> CreateRoute -> Bool
Prelude.Eq, ReadPrec [CreateRoute]
ReadPrec CreateRoute
Int -> ReadS CreateRoute
ReadS [CreateRoute]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRoute]
$creadListPrec :: ReadPrec [CreateRoute]
readPrec :: ReadPrec CreateRoute
$creadPrec :: ReadPrec CreateRoute
readList :: ReadS [CreateRoute]
$creadList :: ReadS [CreateRoute]
readsPrec :: Int -> ReadS CreateRoute
$creadsPrec :: Int -> ReadS CreateRoute
Prelude.Read, Int -> CreateRoute -> ShowS
[CreateRoute] -> ShowS
CreateRoute -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRoute] -> ShowS
$cshowList :: [CreateRoute] -> ShowS
show :: CreateRoute -> String
$cshow :: CreateRoute -> String
showsPrec :: Int -> CreateRoute -> ShowS
$cshowsPrec :: Int -> CreateRoute -> ShowS
Prelude.Show, forall x. Rep CreateRoute x -> CreateRoute
forall x. CreateRoute -> Rep CreateRoute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRoute x -> CreateRoute
$cfrom :: forall x. CreateRoute -> Rep CreateRoute x
Prelude.Generic)

-- |
-- Create a value of 'CreateRoute' 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:
--
-- 'apiKeyRequired', 'createRoute_apiKeyRequired' - Specifies whether an API key is required for the route. Supported only
-- for WebSocket APIs.
--
-- 'authorizationScopes', 'createRoute_authorizationScopes' - The authorization scopes supported by this route.
--
-- 'authorizationType', 'createRoute_authorizationType' - The authorization type for the route. For WebSocket APIs, valid values
-- are NONE for open access, AWS_IAM for using AWS IAM permissions, and
-- CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are
-- NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using
-- AWS IAM permissions, and CUSTOM for using a Lambda authorizer.
--
-- 'authorizerId', 'createRoute_authorizerId' - The identifier of the Authorizer resource to be associated with this
-- route. The authorizer identifier is generated by API Gateway when you
-- created the authorizer.
--
-- 'modelSelectionExpression', 'createRoute_modelSelectionExpression' - The model selection expression for the route. Supported only for
-- WebSocket APIs.
--
-- 'operationName', 'createRoute_operationName' - The operation name for the route.
--
-- 'requestModels', 'createRoute_requestModels' - The request models for the route. Supported only for WebSocket APIs.
--
-- 'requestParameters', 'createRoute_requestParameters' - The request parameters for the route. Supported only for WebSocket APIs.
--
-- 'routeResponseSelectionExpression', 'createRoute_routeResponseSelectionExpression' - The route response selection expression for the route. Supported only
-- for WebSocket APIs.
--
-- 'target', 'createRoute_target' - The target for the route.
--
-- 'apiId', 'createRoute_apiId' - The API identifier.
--
-- 'routeKey', 'createRoute_routeKey' - The route key for the route.
newCreateRoute ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'routeKey'
  Prelude.Text ->
  CreateRoute
newCreateRoute :: Text -> Text -> CreateRoute
newCreateRoute Text
pApiId_ Text
pRouteKey_ =
  CreateRoute'
    { $sel:apiKeyRequired:CreateRoute' :: Maybe Bool
apiKeyRequired = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationScopes:CreateRoute' :: Maybe [Text]
authorizationScopes = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationType:CreateRoute' :: Maybe AuthorizationType
authorizationType = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerId:CreateRoute' :: Maybe Text
authorizerId = forall a. Maybe a
Prelude.Nothing,
      $sel:modelSelectionExpression:CreateRoute' :: Maybe Text
modelSelectionExpression = forall a. Maybe a
Prelude.Nothing,
      $sel:operationName:CreateRoute' :: Maybe Text
operationName = forall a. Maybe a
Prelude.Nothing,
      $sel:requestModels:CreateRoute' :: Maybe (HashMap Text Text)
requestModels = forall a. Maybe a
Prelude.Nothing,
      $sel:requestParameters:CreateRoute' :: Maybe (HashMap Text ParameterConstraints)
requestParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:routeResponseSelectionExpression:CreateRoute' :: Maybe Text
routeResponseSelectionExpression = forall a. Maybe a
Prelude.Nothing,
      $sel:target:CreateRoute' :: Maybe Text
target = forall a. Maybe a
Prelude.Nothing,
      $sel:apiId:CreateRoute' :: Text
apiId = Text
pApiId_,
      $sel:routeKey:CreateRoute' :: Text
routeKey = Text
pRouteKey_
    }

-- | Specifies whether an API key is required for the route. Supported only
-- for WebSocket APIs.
createRoute_apiKeyRequired :: Lens.Lens' CreateRoute (Prelude.Maybe Prelude.Bool)
createRoute_apiKeyRequired :: Lens' CreateRoute (Maybe Bool)
createRoute_apiKeyRequired = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe Bool
apiKeyRequired :: Maybe Bool
$sel:apiKeyRequired:CreateRoute' :: CreateRoute -> Maybe Bool
apiKeyRequired} -> Maybe Bool
apiKeyRequired) (\s :: CreateRoute
s@CreateRoute' {} Maybe Bool
a -> CreateRoute
s {$sel:apiKeyRequired:CreateRoute' :: Maybe Bool
apiKeyRequired = Maybe Bool
a} :: CreateRoute)

-- | The authorization scopes supported by this route.
createRoute_authorizationScopes :: Lens.Lens' CreateRoute (Prelude.Maybe [Prelude.Text])
createRoute_authorizationScopes :: Lens' CreateRoute (Maybe [Text])
createRoute_authorizationScopes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe [Text]
authorizationScopes :: Maybe [Text]
$sel:authorizationScopes:CreateRoute' :: CreateRoute -> Maybe [Text]
authorizationScopes} -> Maybe [Text]
authorizationScopes) (\s :: CreateRoute
s@CreateRoute' {} Maybe [Text]
a -> CreateRoute
s {$sel:authorizationScopes:CreateRoute' :: Maybe [Text]
authorizationScopes = Maybe [Text]
a} :: CreateRoute) 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 authorization type for the route. For WebSocket APIs, valid values
-- are NONE for open access, AWS_IAM for using AWS IAM permissions, and
-- CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are
-- NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using
-- AWS IAM permissions, and CUSTOM for using a Lambda authorizer.
createRoute_authorizationType :: Lens.Lens' CreateRoute (Prelude.Maybe AuthorizationType)
createRoute_authorizationType :: Lens' CreateRoute (Maybe AuthorizationType)
createRoute_authorizationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe AuthorizationType
authorizationType :: Maybe AuthorizationType
$sel:authorizationType:CreateRoute' :: CreateRoute -> Maybe AuthorizationType
authorizationType} -> Maybe AuthorizationType
authorizationType) (\s :: CreateRoute
s@CreateRoute' {} Maybe AuthorizationType
a -> CreateRoute
s {$sel:authorizationType:CreateRoute' :: Maybe AuthorizationType
authorizationType = Maybe AuthorizationType
a} :: CreateRoute)

-- | The identifier of the Authorizer resource to be associated with this
-- route. The authorizer identifier is generated by API Gateway when you
-- created the authorizer.
createRoute_authorizerId :: Lens.Lens' CreateRoute (Prelude.Maybe Prelude.Text)
createRoute_authorizerId :: Lens' CreateRoute (Maybe Text)
createRoute_authorizerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe Text
authorizerId :: Maybe Text
$sel:authorizerId:CreateRoute' :: CreateRoute -> Maybe Text
authorizerId} -> Maybe Text
authorizerId) (\s :: CreateRoute
s@CreateRoute' {} Maybe Text
a -> CreateRoute
s {$sel:authorizerId:CreateRoute' :: Maybe Text
authorizerId = Maybe Text
a} :: CreateRoute)

-- | The model selection expression for the route. Supported only for
-- WebSocket APIs.
createRoute_modelSelectionExpression :: Lens.Lens' CreateRoute (Prelude.Maybe Prelude.Text)
createRoute_modelSelectionExpression :: Lens' CreateRoute (Maybe Text)
createRoute_modelSelectionExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe Text
modelSelectionExpression :: Maybe Text
$sel:modelSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
modelSelectionExpression} -> Maybe Text
modelSelectionExpression) (\s :: CreateRoute
s@CreateRoute' {} Maybe Text
a -> CreateRoute
s {$sel:modelSelectionExpression:CreateRoute' :: Maybe Text
modelSelectionExpression = Maybe Text
a} :: CreateRoute)

-- | The operation name for the route.
createRoute_operationName :: Lens.Lens' CreateRoute (Prelude.Maybe Prelude.Text)
createRoute_operationName :: Lens' CreateRoute (Maybe Text)
createRoute_operationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe Text
operationName :: Maybe Text
$sel:operationName:CreateRoute' :: CreateRoute -> Maybe Text
operationName} -> Maybe Text
operationName) (\s :: CreateRoute
s@CreateRoute' {} Maybe Text
a -> CreateRoute
s {$sel:operationName:CreateRoute' :: Maybe Text
operationName = Maybe Text
a} :: CreateRoute)

-- | The request models for the route. Supported only for WebSocket APIs.
createRoute_requestModels :: Lens.Lens' CreateRoute (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRoute_requestModels :: Lens' CreateRoute (Maybe (HashMap Text Text))
createRoute_requestModels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe (HashMap Text Text)
requestModels :: Maybe (HashMap Text Text)
$sel:requestModels:CreateRoute' :: CreateRoute -> Maybe (HashMap Text Text)
requestModels} -> Maybe (HashMap Text Text)
requestModels) (\s :: CreateRoute
s@CreateRoute' {} Maybe (HashMap Text Text)
a -> CreateRoute
s {$sel:requestModels:CreateRoute' :: Maybe (HashMap Text Text)
requestModels = Maybe (HashMap Text Text)
a} :: CreateRoute) 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 request parameters for the route. Supported only for WebSocket APIs.
createRoute_requestParameters :: Lens.Lens' CreateRoute (Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints))
createRoute_requestParameters :: Lens' CreateRoute (Maybe (HashMap Text ParameterConstraints))
createRoute_requestParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe (HashMap Text ParameterConstraints)
requestParameters :: Maybe (HashMap Text ParameterConstraints)
$sel:requestParameters:CreateRoute' :: CreateRoute -> Maybe (HashMap Text ParameterConstraints)
requestParameters} -> Maybe (HashMap Text ParameterConstraints)
requestParameters) (\s :: CreateRoute
s@CreateRoute' {} Maybe (HashMap Text ParameterConstraints)
a -> CreateRoute
s {$sel:requestParameters:CreateRoute' :: Maybe (HashMap Text ParameterConstraints)
requestParameters = Maybe (HashMap Text ParameterConstraints)
a} :: CreateRoute) 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 route response selection expression for the route. Supported only
-- for WebSocket APIs.
createRoute_routeResponseSelectionExpression :: Lens.Lens' CreateRoute (Prelude.Maybe Prelude.Text)
createRoute_routeResponseSelectionExpression :: Lens' CreateRoute (Maybe Text)
createRoute_routeResponseSelectionExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe Text
routeResponseSelectionExpression :: Maybe Text
$sel:routeResponseSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
routeResponseSelectionExpression} -> Maybe Text
routeResponseSelectionExpression) (\s :: CreateRoute
s@CreateRoute' {} Maybe Text
a -> CreateRoute
s {$sel:routeResponseSelectionExpression:CreateRoute' :: Maybe Text
routeResponseSelectionExpression = Maybe Text
a} :: CreateRoute)

-- | The target for the route.
createRoute_target :: Lens.Lens' CreateRoute (Prelude.Maybe Prelude.Text)
createRoute_target :: Lens' CreateRoute (Maybe Text)
createRoute_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Maybe Text
target :: Maybe Text
$sel:target:CreateRoute' :: CreateRoute -> Maybe Text
target} -> Maybe Text
target) (\s :: CreateRoute
s@CreateRoute' {} Maybe Text
a -> CreateRoute
s {$sel:target:CreateRoute' :: Maybe Text
target = Maybe Text
a} :: CreateRoute)

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

-- | The route key for the route.
createRoute_routeKey :: Lens.Lens' CreateRoute Prelude.Text
createRoute_routeKey :: Lens' CreateRoute Text
createRoute_routeKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRoute' {Text
routeKey :: Text
$sel:routeKey:CreateRoute' :: CreateRoute -> Text
routeKey} -> Text
routeKey) (\s :: CreateRoute
s@CreateRoute' {} Text
a -> CreateRoute
s {$sel:routeKey:CreateRoute' :: Text
routeKey = Text
a} :: CreateRoute)

instance Core.AWSRequest CreateRoute where
  type AWSResponse CreateRoute = CreateRouteResponse'
  request :: (Service -> Service) -> CreateRoute -> Request CreateRoute
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 CreateRoute
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateRoute)))
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 Bool
-> Maybe Bool
-> Maybe [Text]
-> Maybe AuthorizationType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text ParameterConstraints)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateRouteResponse'
CreateRouteResponse''
            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
"apiGatewayManaged")
            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
"apiKeyRequired")
            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
"authorizationScopes"
                            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
"authorizationType")
            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
"modelSelectionExpression")
            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
"operationName")
            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
"requestModels" 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
"requestParameters"
                            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
"routeId")
            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
"routeKey")
            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
"routeResponseSelectionExpression")
            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
"target")
            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 CreateRoute where
  hashWithSalt :: Int -> CreateRoute -> Int
hashWithSalt Int
_salt CreateRoute' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ParameterConstraints)
Maybe AuthorizationType
Text
routeKey :: Text
apiId :: Text
target :: Maybe Text
routeResponseSelectionExpression :: Maybe Text
requestParameters :: Maybe (HashMap Text ParameterConstraints)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
modelSelectionExpression :: Maybe Text
authorizerId :: Maybe Text
authorizationType :: Maybe AuthorizationType
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:routeKey:CreateRoute' :: CreateRoute -> Text
$sel:apiId:CreateRoute' :: CreateRoute -> Text
$sel:target:CreateRoute' :: CreateRoute -> Maybe Text
$sel:routeResponseSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
$sel:requestParameters:CreateRoute' :: CreateRoute -> Maybe (HashMap Text ParameterConstraints)
$sel:requestModels:CreateRoute' :: CreateRoute -> Maybe (HashMap Text Text)
$sel:operationName:CreateRoute' :: CreateRoute -> Maybe Text
$sel:modelSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
$sel:authorizerId:CreateRoute' :: CreateRoute -> Maybe Text
$sel:authorizationType:CreateRoute' :: CreateRoute -> Maybe AuthorizationType
$sel:authorizationScopes:CreateRoute' :: CreateRoute -> Maybe [Text]
$sel:apiKeyRequired:CreateRoute' :: CreateRoute -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
apiKeyRequired
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
authorizationScopes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AuthorizationType
authorizationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorizerId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
modelSelectionExpression
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
operationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
requestModels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ParameterConstraints)
requestParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
routeResponseSelectionExpression
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
target
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
apiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
routeKey

instance Prelude.NFData CreateRoute where
  rnf :: CreateRoute -> ()
rnf CreateRoute' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ParameterConstraints)
Maybe AuthorizationType
Text
routeKey :: Text
apiId :: Text
target :: Maybe Text
routeResponseSelectionExpression :: Maybe Text
requestParameters :: Maybe (HashMap Text ParameterConstraints)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
modelSelectionExpression :: Maybe Text
authorizerId :: Maybe Text
authorizationType :: Maybe AuthorizationType
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:routeKey:CreateRoute' :: CreateRoute -> Text
$sel:apiId:CreateRoute' :: CreateRoute -> Text
$sel:target:CreateRoute' :: CreateRoute -> Maybe Text
$sel:routeResponseSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
$sel:requestParameters:CreateRoute' :: CreateRoute -> Maybe (HashMap Text ParameterConstraints)
$sel:requestModels:CreateRoute' :: CreateRoute -> Maybe (HashMap Text Text)
$sel:operationName:CreateRoute' :: CreateRoute -> Maybe Text
$sel:modelSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
$sel:authorizerId:CreateRoute' :: CreateRoute -> Maybe Text
$sel:authorizationType:CreateRoute' :: CreateRoute -> Maybe AuthorizationType
$sel:authorizationScopes:CreateRoute' :: CreateRoute -> Maybe [Text]
$sel:apiKeyRequired:CreateRoute' :: CreateRoute -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
apiKeyRequired
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
authorizationScopes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AuthorizationType
authorizationType
      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
modelSelectionExpression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
operationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
requestModels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ParameterConstraints)
requestParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
routeResponseSelectionExpression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
target
      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 Text
routeKey

instance Data.ToHeaders CreateRoute where
  toHeaders :: CreateRoute -> 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 CreateRoute where
  toJSON :: CreateRoute -> Value
toJSON CreateRoute' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ParameterConstraints)
Maybe AuthorizationType
Text
routeKey :: Text
apiId :: Text
target :: Maybe Text
routeResponseSelectionExpression :: Maybe Text
requestParameters :: Maybe (HashMap Text ParameterConstraints)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
modelSelectionExpression :: Maybe Text
authorizerId :: Maybe Text
authorizationType :: Maybe AuthorizationType
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:routeKey:CreateRoute' :: CreateRoute -> Text
$sel:apiId:CreateRoute' :: CreateRoute -> Text
$sel:target:CreateRoute' :: CreateRoute -> Maybe Text
$sel:routeResponseSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
$sel:requestParameters:CreateRoute' :: CreateRoute -> Maybe (HashMap Text ParameterConstraints)
$sel:requestModels:CreateRoute' :: CreateRoute -> Maybe (HashMap Text Text)
$sel:operationName:CreateRoute' :: CreateRoute -> Maybe Text
$sel:modelSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
$sel:authorizerId:CreateRoute' :: CreateRoute -> Maybe Text
$sel:authorizationType:CreateRoute' :: CreateRoute -> Maybe AuthorizationType
$sel:authorizationScopes:CreateRoute' :: CreateRoute -> Maybe [Text]
$sel:apiKeyRequired:CreateRoute' :: CreateRoute -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"apiKeyRequired" 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
apiKeyRequired,
            (Key
"authorizationScopes" 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]
authorizationScopes,
            (Key
"authorizationType" 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 AuthorizationType
authorizationType,
            (Key
"authorizerId" 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
authorizerId,
            (Key
"modelSelectionExpression" 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
modelSelectionExpression,
            (Key
"operationName" 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
operationName,
            (Key
"requestModels" 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 (HashMap Text Text)
requestModels,
            (Key
"requestParameters" 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 (HashMap Text ParameterConstraints)
requestParameters,
            (Key
"routeResponseSelectionExpression" 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
routeResponseSelectionExpression,
            (Key
"target" 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
target,
            forall a. a -> Maybe a
Prelude.Just (Key
"routeKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
routeKey)
          ]
      )

instance Data.ToPath CreateRoute where
  toPath :: CreateRoute -> ByteString
toPath CreateRoute' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ParameterConstraints)
Maybe AuthorizationType
Text
routeKey :: Text
apiId :: Text
target :: Maybe Text
routeResponseSelectionExpression :: Maybe Text
requestParameters :: Maybe (HashMap Text ParameterConstraints)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
modelSelectionExpression :: Maybe Text
authorizerId :: Maybe Text
authorizationType :: Maybe AuthorizationType
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:routeKey:CreateRoute' :: CreateRoute -> Text
$sel:apiId:CreateRoute' :: CreateRoute -> Text
$sel:target:CreateRoute' :: CreateRoute -> Maybe Text
$sel:routeResponseSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
$sel:requestParameters:CreateRoute' :: CreateRoute -> Maybe (HashMap Text ParameterConstraints)
$sel:requestModels:CreateRoute' :: CreateRoute -> Maybe (HashMap Text Text)
$sel:operationName:CreateRoute' :: CreateRoute -> Maybe Text
$sel:modelSelectionExpression:CreateRoute' :: CreateRoute -> Maybe Text
$sel:authorizerId:CreateRoute' :: CreateRoute -> Maybe Text
$sel:authorizationType:CreateRoute' :: CreateRoute -> Maybe AuthorizationType
$sel:authorizationScopes:CreateRoute' :: CreateRoute -> Maybe [Text]
$sel:apiKeyRequired:CreateRoute' :: CreateRoute -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v2/apis/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
apiId, ByteString
"/routes"]

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

-- | /See:/ 'newCreateRouteResponse'' smart constructor.
data CreateRouteResponse' = CreateRouteResponse''
  { -- | Specifies whether a route is managed by API Gateway. If you created an
    -- API using quick create, the $default route is managed by API Gateway.
    -- You can\'t modify the $default route key.
    CreateRouteResponse' -> Maybe Bool
apiGatewayManaged :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether an API key is required for this route. Supported only
    -- for WebSocket APIs.
    CreateRouteResponse' -> Maybe Bool
apiKeyRequired :: Prelude.Maybe Prelude.Bool,
    -- | A list of authorization scopes configured on a route. The scopes are
    -- used with a JWT authorizer to authorize the method invocation. The
    -- authorization works by matching the route scopes against the scopes
    -- parsed from the access token in the incoming request. The method
    -- invocation is authorized if any route scope matches a claimed scope in
    -- the access token. Otherwise, the invocation is not authorized. When the
    -- route scope is configured, the client must provide an access token
    -- instead of an identity token for authorization purposes.
    CreateRouteResponse' -> Maybe [Text]
authorizationScopes :: Prelude.Maybe [Prelude.Text],
    -- | The authorization type for the route. For WebSocket APIs, valid values
    -- are NONE for open access, AWS_IAM for using AWS IAM permissions, and
    -- CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are
    -- NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using
    -- AWS IAM permissions, and CUSTOM for using a Lambda authorizer.
    CreateRouteResponse' -> Maybe AuthorizationType
authorizationType :: Prelude.Maybe AuthorizationType,
    -- | The identifier of the Authorizer resource to be associated with this
    -- route. The authorizer identifier is generated by API Gateway when you
    -- created the authorizer.
    CreateRouteResponse' -> Maybe Text
authorizerId :: Prelude.Maybe Prelude.Text,
    -- | The model selection expression for the route. Supported only for
    -- WebSocket APIs.
    CreateRouteResponse' -> Maybe Text
modelSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | The operation name for the route.
    CreateRouteResponse' -> Maybe Text
operationName :: Prelude.Maybe Prelude.Text,
    -- | The request models for the route. Supported only for WebSocket APIs.
    CreateRouteResponse' -> Maybe (HashMap Text Text)
requestModels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The request parameters for the route. Supported only for WebSocket APIs.
    CreateRouteResponse' -> Maybe (HashMap Text ParameterConstraints)
requestParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints),
    -- | The route ID.
    CreateRouteResponse' -> Maybe Text
routeId :: Prelude.Maybe Prelude.Text,
    -- | The route key for the route.
    CreateRouteResponse' -> Maybe Text
routeKey :: Prelude.Maybe Prelude.Text,
    -- | The route response selection expression for the route. Supported only
    -- for WebSocket APIs.
    CreateRouteResponse' -> Maybe Text
routeResponseSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | The target for the route.
    CreateRouteResponse' -> Maybe Text
target :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateRouteResponse' -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateRouteResponse' -> CreateRouteResponse' -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRouteResponse' -> CreateRouteResponse' -> Bool
$c/= :: CreateRouteResponse' -> CreateRouteResponse' -> Bool
== :: CreateRouteResponse' -> CreateRouteResponse' -> Bool
$c== :: CreateRouteResponse' -> CreateRouteResponse' -> Bool
Prelude.Eq, ReadPrec [CreateRouteResponse']
ReadPrec CreateRouteResponse'
Int -> ReadS CreateRouteResponse'
ReadS [CreateRouteResponse']
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRouteResponse']
$creadListPrec :: ReadPrec [CreateRouteResponse']
readPrec :: ReadPrec CreateRouteResponse'
$creadPrec :: ReadPrec CreateRouteResponse'
readList :: ReadS [CreateRouteResponse']
$creadList :: ReadS [CreateRouteResponse']
readsPrec :: Int -> ReadS CreateRouteResponse'
$creadsPrec :: Int -> ReadS CreateRouteResponse'
Prelude.Read, Int -> CreateRouteResponse' -> ShowS
[CreateRouteResponse'] -> ShowS
CreateRouteResponse' -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRouteResponse'] -> ShowS
$cshowList :: [CreateRouteResponse'] -> ShowS
show :: CreateRouteResponse' -> String
$cshow :: CreateRouteResponse' -> String
showsPrec :: Int -> CreateRouteResponse' -> ShowS
$cshowsPrec :: Int -> CreateRouteResponse' -> ShowS
Prelude.Show, forall x. Rep CreateRouteResponse' x -> CreateRouteResponse'
forall x. CreateRouteResponse' -> Rep CreateRouteResponse' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRouteResponse' x -> CreateRouteResponse'
$cfrom :: forall x. CreateRouteResponse' -> Rep CreateRouteResponse' x
Prelude.Generic)

-- |
-- Create a value of 'CreateRouteResponse'' 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:
--
-- 'apiGatewayManaged', 'createRouteResponse'_apiGatewayManaged' - Specifies whether a route is managed by API Gateway. If you created an
-- API using quick create, the $default route is managed by API Gateway.
-- You can\'t modify the $default route key.
--
-- 'apiKeyRequired', 'createRouteResponse'_apiKeyRequired' - Specifies whether an API key is required for this route. Supported only
-- for WebSocket APIs.
--
-- 'authorizationScopes', 'createRouteResponse'_authorizationScopes' - A list of authorization scopes configured on a route. The scopes are
-- used with a JWT authorizer to authorize the method invocation. The
-- authorization works by matching the route scopes against the scopes
-- parsed from the access token in the incoming request. The method
-- invocation is authorized if any route scope matches a claimed scope in
-- the access token. Otherwise, the invocation is not authorized. When the
-- route scope is configured, the client must provide an access token
-- instead of an identity token for authorization purposes.
--
-- 'authorizationType', 'createRouteResponse'_authorizationType' - The authorization type for the route. For WebSocket APIs, valid values
-- are NONE for open access, AWS_IAM for using AWS IAM permissions, and
-- CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are
-- NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using
-- AWS IAM permissions, and CUSTOM for using a Lambda authorizer.
--
-- 'authorizerId', 'createRouteResponse'_authorizerId' - The identifier of the Authorizer resource to be associated with this
-- route. The authorizer identifier is generated by API Gateway when you
-- created the authorizer.
--
-- 'modelSelectionExpression', 'createRouteResponse'_modelSelectionExpression' - The model selection expression for the route. Supported only for
-- WebSocket APIs.
--
-- 'operationName', 'createRouteResponse'_operationName' - The operation name for the route.
--
-- 'requestModels', 'createRouteResponse'_requestModels' - The request models for the route. Supported only for WebSocket APIs.
--
-- 'requestParameters', 'createRouteResponse'_requestParameters' - The request parameters for the route. Supported only for WebSocket APIs.
--
-- 'routeId', 'createRouteResponse'_routeId' - The route ID.
--
-- 'routeKey', 'createRouteResponse'_routeKey' - The route key for the route.
--
-- 'routeResponseSelectionExpression', 'createRouteResponse'_routeResponseSelectionExpression' - The route response selection expression for the route. Supported only
-- for WebSocket APIs.
--
-- 'target', 'createRouteResponse'_target' - The target for the route.
--
-- 'httpStatus', 'createRouteResponse'_httpStatus' - The response's http status code.
newCreateRouteResponse' ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateRouteResponse'
newCreateRouteResponse' :: Int -> CreateRouteResponse'
newCreateRouteResponse' Int
pHttpStatus_ =
  CreateRouteResponse''
    { $sel:apiGatewayManaged:CreateRouteResponse'' :: Maybe Bool
apiGatewayManaged =
        forall a. Maybe a
Prelude.Nothing,
      $sel:apiKeyRequired:CreateRouteResponse'' :: Maybe Bool
apiKeyRequired = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationScopes:CreateRouteResponse'' :: Maybe [Text]
authorizationScopes = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationType:CreateRouteResponse'' :: Maybe AuthorizationType
authorizationType = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerId:CreateRouteResponse'' :: Maybe Text
authorizerId = forall a. Maybe a
Prelude.Nothing,
      $sel:modelSelectionExpression:CreateRouteResponse'' :: Maybe Text
modelSelectionExpression = forall a. Maybe a
Prelude.Nothing,
      $sel:operationName:CreateRouteResponse'' :: Maybe Text
operationName = forall a. Maybe a
Prelude.Nothing,
      $sel:requestModels:CreateRouteResponse'' :: Maybe (HashMap Text Text)
requestModels = forall a. Maybe a
Prelude.Nothing,
      $sel:requestParameters:CreateRouteResponse'' :: Maybe (HashMap Text ParameterConstraints)
requestParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:routeId:CreateRouteResponse'' :: Maybe Text
routeId = forall a. Maybe a
Prelude.Nothing,
      $sel:routeKey:CreateRouteResponse'' :: Maybe Text
routeKey = forall a. Maybe a
Prelude.Nothing,
      $sel:routeResponseSelectionExpression:CreateRouteResponse'' :: Maybe Text
routeResponseSelectionExpression = forall a. Maybe a
Prelude.Nothing,
      $sel:target:CreateRouteResponse'' :: Maybe Text
target = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateRouteResponse'' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Specifies whether a route is managed by API Gateway. If you created an
-- API using quick create, the $default route is managed by API Gateway.
-- You can\'t modify the $default route key.
createRouteResponse'_apiGatewayManaged :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Bool)
createRouteResponse'_apiGatewayManaged :: Lens' CreateRouteResponse' (Maybe Bool)
createRouteResponse'_apiGatewayManaged = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Bool
apiGatewayManaged :: Maybe Bool
$sel:apiGatewayManaged:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Bool
apiGatewayManaged} -> Maybe Bool
apiGatewayManaged) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Bool
a -> CreateRouteResponse'
s {$sel:apiGatewayManaged:CreateRouteResponse'' :: Maybe Bool
apiGatewayManaged = Maybe Bool
a} :: CreateRouteResponse')

-- | Specifies whether an API key is required for this route. Supported only
-- for WebSocket APIs.
createRouteResponse'_apiKeyRequired :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Bool)
createRouteResponse'_apiKeyRequired :: Lens' CreateRouteResponse' (Maybe Bool)
createRouteResponse'_apiKeyRequired = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Bool
apiKeyRequired :: Maybe Bool
$sel:apiKeyRequired:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Bool
apiKeyRequired} -> Maybe Bool
apiKeyRequired) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Bool
a -> CreateRouteResponse'
s {$sel:apiKeyRequired:CreateRouteResponse'' :: Maybe Bool
apiKeyRequired = Maybe Bool
a} :: CreateRouteResponse')

-- | A list of authorization scopes configured on a route. The scopes are
-- used with a JWT authorizer to authorize the method invocation. The
-- authorization works by matching the route scopes against the scopes
-- parsed from the access token in the incoming request. The method
-- invocation is authorized if any route scope matches a claimed scope in
-- the access token. Otherwise, the invocation is not authorized. When the
-- route scope is configured, the client must provide an access token
-- instead of an identity token for authorization purposes.
createRouteResponse'_authorizationScopes :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe [Prelude.Text])
createRouteResponse'_authorizationScopes :: Lens' CreateRouteResponse' (Maybe [Text])
createRouteResponse'_authorizationScopes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe [Text]
authorizationScopes :: Maybe [Text]
$sel:authorizationScopes:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe [Text]
authorizationScopes} -> Maybe [Text]
authorizationScopes) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe [Text]
a -> CreateRouteResponse'
s {$sel:authorizationScopes:CreateRouteResponse'' :: Maybe [Text]
authorizationScopes = Maybe [Text]
a} :: CreateRouteResponse') 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 authorization type for the route. For WebSocket APIs, valid values
-- are NONE for open access, AWS_IAM for using AWS IAM permissions, and
-- CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are
-- NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using
-- AWS IAM permissions, and CUSTOM for using a Lambda authorizer.
createRouteResponse'_authorizationType :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe AuthorizationType)
createRouteResponse'_authorizationType :: Lens' CreateRouteResponse' (Maybe AuthorizationType)
createRouteResponse'_authorizationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe AuthorizationType
authorizationType :: Maybe AuthorizationType
$sel:authorizationType:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe AuthorizationType
authorizationType} -> Maybe AuthorizationType
authorizationType) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe AuthorizationType
a -> CreateRouteResponse'
s {$sel:authorizationType:CreateRouteResponse'' :: Maybe AuthorizationType
authorizationType = Maybe AuthorizationType
a} :: CreateRouteResponse')

-- | The identifier of the Authorizer resource to be associated with this
-- route. The authorizer identifier is generated by API Gateway when you
-- created the authorizer.
createRouteResponse'_authorizerId :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Text)
createRouteResponse'_authorizerId :: Lens' CreateRouteResponse' (Maybe Text)
createRouteResponse'_authorizerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Text
authorizerId :: Maybe Text
$sel:authorizerId:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
authorizerId} -> Maybe Text
authorizerId) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Text
a -> CreateRouteResponse'
s {$sel:authorizerId:CreateRouteResponse'' :: Maybe Text
authorizerId = Maybe Text
a} :: CreateRouteResponse')

-- | The model selection expression for the route. Supported only for
-- WebSocket APIs.
createRouteResponse'_modelSelectionExpression :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Text)
createRouteResponse'_modelSelectionExpression :: Lens' CreateRouteResponse' (Maybe Text)
createRouteResponse'_modelSelectionExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Text
modelSelectionExpression :: Maybe Text
$sel:modelSelectionExpression:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
modelSelectionExpression} -> Maybe Text
modelSelectionExpression) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Text
a -> CreateRouteResponse'
s {$sel:modelSelectionExpression:CreateRouteResponse'' :: Maybe Text
modelSelectionExpression = Maybe Text
a} :: CreateRouteResponse')

-- | The operation name for the route.
createRouteResponse'_operationName :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Text)
createRouteResponse'_operationName :: Lens' CreateRouteResponse' (Maybe Text)
createRouteResponse'_operationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Text
operationName :: Maybe Text
$sel:operationName:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
operationName} -> Maybe Text
operationName) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Text
a -> CreateRouteResponse'
s {$sel:operationName:CreateRouteResponse'' :: Maybe Text
operationName = Maybe Text
a} :: CreateRouteResponse')

-- | The request models for the route. Supported only for WebSocket APIs.
createRouteResponse'_requestModels :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRouteResponse'_requestModels :: Lens' CreateRouteResponse' (Maybe (HashMap Text Text))
createRouteResponse'_requestModels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe (HashMap Text Text)
requestModels :: Maybe (HashMap Text Text)
$sel:requestModels:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe (HashMap Text Text)
requestModels} -> Maybe (HashMap Text Text)
requestModels) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe (HashMap Text Text)
a -> CreateRouteResponse'
s {$sel:requestModels:CreateRouteResponse'' :: Maybe (HashMap Text Text)
requestModels = Maybe (HashMap Text Text)
a} :: CreateRouteResponse') 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 request parameters for the route. Supported only for WebSocket APIs.
createRouteResponse'_requestParameters :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints))
createRouteResponse'_requestParameters :: Lens'
  CreateRouteResponse' (Maybe (HashMap Text ParameterConstraints))
createRouteResponse'_requestParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe (HashMap Text ParameterConstraints)
requestParameters :: Maybe (HashMap Text ParameterConstraints)
$sel:requestParameters:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe (HashMap Text ParameterConstraints)
requestParameters} -> Maybe (HashMap Text ParameterConstraints)
requestParameters) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe (HashMap Text ParameterConstraints)
a -> CreateRouteResponse'
s {$sel:requestParameters:CreateRouteResponse'' :: Maybe (HashMap Text ParameterConstraints)
requestParameters = Maybe (HashMap Text ParameterConstraints)
a} :: CreateRouteResponse') 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 route ID.
createRouteResponse'_routeId :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Text)
createRouteResponse'_routeId :: Lens' CreateRouteResponse' (Maybe Text)
createRouteResponse'_routeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Text
routeId :: Maybe Text
$sel:routeId:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
routeId} -> Maybe Text
routeId) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Text
a -> CreateRouteResponse'
s {$sel:routeId:CreateRouteResponse'' :: Maybe Text
routeId = Maybe Text
a} :: CreateRouteResponse')

-- | The route key for the route.
createRouteResponse'_routeKey :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Text)
createRouteResponse'_routeKey :: Lens' CreateRouteResponse' (Maybe Text)
createRouteResponse'_routeKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Text
routeKey :: Maybe Text
$sel:routeKey:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
routeKey} -> Maybe Text
routeKey) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Text
a -> CreateRouteResponse'
s {$sel:routeKey:CreateRouteResponse'' :: Maybe Text
routeKey = Maybe Text
a} :: CreateRouteResponse')

-- | The route response selection expression for the route. Supported only
-- for WebSocket APIs.
createRouteResponse'_routeResponseSelectionExpression :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Text)
createRouteResponse'_routeResponseSelectionExpression :: Lens' CreateRouteResponse' (Maybe Text)
createRouteResponse'_routeResponseSelectionExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Text
routeResponseSelectionExpression :: Maybe Text
$sel:routeResponseSelectionExpression:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
routeResponseSelectionExpression} -> Maybe Text
routeResponseSelectionExpression) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Text
a -> CreateRouteResponse'
s {$sel:routeResponseSelectionExpression:CreateRouteResponse'' :: Maybe Text
routeResponseSelectionExpression = Maybe Text
a} :: CreateRouteResponse')

-- | The target for the route.
createRouteResponse'_target :: Lens.Lens' CreateRouteResponse' (Prelude.Maybe Prelude.Text)
createRouteResponse'_target :: Lens' CreateRouteResponse' (Maybe Text)
createRouteResponse'_target = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse'' {Maybe Text
target :: Maybe Text
$sel:target:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
target} -> Maybe Text
target) (\s :: CreateRouteResponse'
s@CreateRouteResponse'' {} Maybe Text
a -> CreateRouteResponse'
s {$sel:target:CreateRouteResponse'' :: Maybe Text
target = Maybe Text
a} :: CreateRouteResponse')

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

instance Prelude.NFData CreateRouteResponse' where
  rnf :: CreateRouteResponse' -> ()
rnf CreateRouteResponse'' {Int
Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ParameterConstraints)
Maybe AuthorizationType
httpStatus :: Int
target :: Maybe Text
routeResponseSelectionExpression :: Maybe Text
routeKey :: Maybe Text
routeId :: Maybe Text
requestParameters :: Maybe (HashMap Text ParameterConstraints)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
modelSelectionExpression :: Maybe Text
authorizerId :: Maybe Text
authorizationType :: Maybe AuthorizationType
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
apiGatewayManaged :: Maybe Bool
$sel:httpStatus:CreateRouteResponse'' :: CreateRouteResponse' -> Int
$sel:target:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
$sel:routeResponseSelectionExpression:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
$sel:routeKey:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
$sel:routeId:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
$sel:requestParameters:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe (HashMap Text ParameterConstraints)
$sel:requestModels:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe (HashMap Text Text)
$sel:operationName:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
$sel:modelSelectionExpression:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
$sel:authorizerId:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Text
$sel:authorizationType:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe AuthorizationType
$sel:authorizationScopes:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe [Text]
$sel:apiKeyRequired:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Bool
$sel:apiGatewayManaged:CreateRouteResponse'' :: CreateRouteResponse' -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
apiGatewayManaged
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
apiKeyRequired
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
authorizationScopes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AuthorizationType
authorizationType
      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
modelSelectionExpression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
operationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
requestModels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ParameterConstraints)
requestParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
routeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
routeKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
routeResponseSelectionExpression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
target
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus