{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.Route
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ApiGatewayV2.Types.Route where

import Amazonka.ApiGatewayV2.Types.AuthorizationType
import Amazonka.ApiGatewayV2.Types.ParameterConstraints
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a route.
--
-- /See:/ 'newRoute' smart constructor.
data Route = Route'
  { -- | 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.
    Route -> Maybe [Text]
authorizationScopes :: Prelude.Maybe [Prelude.Text],
    -- | The model selection expression for the route. Supported only for
    -- WebSocket APIs.
    Route -> Maybe Text
modelSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | The request models for the route. Supported only for WebSocket APIs.
    Route -> Maybe (HashMap Text Text)
requestModels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The route response selection expression for the route. Supported only
    -- for WebSocket APIs.
    Route -> Maybe Text
routeResponseSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | The request parameters for the route. Supported only for WebSocket APIs.
    Route -> Maybe (HashMap Text ParameterConstraints)
requestParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints),
    -- | The route ID.
    Route -> Maybe Text
routeId :: Prelude.Maybe Prelude.Text,
    -- | 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.
    Route -> Maybe Text
authorizerId :: Prelude.Maybe Prelude.Text,
    -- | The operation name for the route.
    Route -> Maybe Text
operationName :: Prelude.Maybe Prelude.Text,
    -- | 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.
    Route -> Maybe Bool
apiGatewayManaged :: Prelude.Maybe Prelude.Bool,
    -- | 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.
    Route -> Maybe AuthorizationType
authorizationType :: Prelude.Maybe AuthorizationType,
    -- | Specifies whether an API key is required for this route. Supported only
    -- for WebSocket APIs.
    Route -> Maybe Bool
apiKeyRequired :: Prelude.Maybe Prelude.Bool,
    -- | The target for the route.
    Route -> Maybe Text
target :: Prelude.Maybe Prelude.Text,
    -- | The route key for the route.
    Route -> Text
routeKey :: Prelude.Text
  }
  deriving (Route -> Route -> Bool
(Route -> Route -> Bool) -> (Route -> Route -> Bool) -> Eq Route
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Route -> Route -> Bool
$c/= :: Route -> Route -> Bool
== :: Route -> Route -> Bool
$c== :: Route -> Route -> Bool
Prelude.Eq, ReadPrec [Route]
ReadPrec Route
Int -> ReadS Route
ReadS [Route]
(Int -> ReadS Route)
-> ReadS [Route]
-> ReadPrec Route
-> ReadPrec [Route]
-> Read Route
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Route]
$creadListPrec :: ReadPrec [Route]
readPrec :: ReadPrec Route
$creadPrec :: ReadPrec Route
readList :: ReadS [Route]
$creadList :: ReadS [Route]
readsPrec :: Int -> ReadS Route
$creadsPrec :: Int -> ReadS Route
Prelude.Read, Int -> Route -> ShowS
[Route] -> ShowS
Route -> String
(Int -> Route -> ShowS)
-> (Route -> String) -> ([Route] -> ShowS) -> Show Route
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Route] -> ShowS
$cshowList :: [Route] -> ShowS
show :: Route -> String
$cshow :: Route -> String
showsPrec :: Int -> Route -> ShowS
$cshowsPrec :: Int -> Route -> ShowS
Prelude.Show, (forall x. Route -> Rep Route x)
-> (forall x. Rep Route x -> Route) -> Generic Route
forall x. Rep Route x -> Route
forall x. Route -> Rep Route x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Route x -> Route
$cfrom :: forall x. Route -> Rep Route x
Prelude.Generic)

-- |
-- Create a value of 'Route' 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:
--
-- 'authorizationScopes', 'route_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.
--
-- 'modelSelectionExpression', 'route_modelSelectionExpression' - The model selection expression for the route. Supported only for
-- WebSocket APIs.
--
-- 'requestModels', 'route_requestModels' - The request models for the route. Supported only for WebSocket APIs.
--
-- 'routeResponseSelectionExpression', 'route_routeResponseSelectionExpression' - The route response selection expression for the route. Supported only
-- for WebSocket APIs.
--
-- 'requestParameters', 'route_requestParameters' - The request parameters for the route. Supported only for WebSocket APIs.
--
-- 'routeId', 'route_routeId' - The route ID.
--
-- 'authorizerId', 'route_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.
--
-- 'operationName', 'route_operationName' - The operation name for the route.
--
-- 'apiGatewayManaged', 'route_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.
--
-- 'authorizationType', 'route_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.
--
-- 'apiKeyRequired', 'route_apiKeyRequired' - Specifies whether an API key is required for this route. Supported only
-- for WebSocket APIs.
--
-- 'target', 'route_target' - The target for the route.
--
-- 'routeKey', 'route_routeKey' - The route key for the route.
newRoute ::
  -- | 'routeKey'
  Prelude.Text ->
  Route
newRoute :: Text -> Route
newRoute Text
pRouteKey_ =
  Route' :: Maybe [Text]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe (HashMap Text ParameterConstraints)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe AuthorizationType
-> Maybe Bool
-> Maybe Text
-> Text
-> Route
Route'
    { $sel:authorizationScopes:Route' :: Maybe [Text]
authorizationScopes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:modelSelectionExpression:Route' :: Maybe Text
modelSelectionExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:requestModels:Route' :: Maybe (HashMap Text Text)
requestModels = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:routeResponseSelectionExpression:Route' :: Maybe Text
routeResponseSelectionExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:requestParameters:Route' :: Maybe (HashMap Text ParameterConstraints)
requestParameters = Maybe (HashMap Text ParameterConstraints)
forall a. Maybe a
Prelude.Nothing,
      $sel:routeId:Route' :: Maybe Text
routeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerId:Route' :: Maybe Text
authorizerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operationName:Route' :: Maybe Text
operationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:apiGatewayManaged:Route' :: Maybe Bool
apiGatewayManaged = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationType:Route' :: Maybe AuthorizationType
authorizationType = Maybe AuthorizationType
forall a. Maybe a
Prelude.Nothing,
      $sel:apiKeyRequired:Route' :: Maybe Bool
apiKeyRequired = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:target:Route' :: Maybe Text
target = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routeKey:Route' :: Text
routeKey = Text
pRouteKey_
    }

-- | 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.
route_authorizationScopes :: Lens.Lens' Route (Prelude.Maybe [Prelude.Text])
route_authorizationScopes :: (Maybe [Text] -> f (Maybe [Text])) -> Route -> f Route
route_authorizationScopes = (Route -> Maybe [Text])
-> (Route -> Maybe [Text] -> Route)
-> Lens Route Route (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe [Text]
authorizationScopes :: Maybe [Text]
$sel:authorizationScopes:Route' :: Route -> Maybe [Text]
authorizationScopes} -> Maybe [Text]
authorizationScopes) (\s :: Route
s@Route' {} Maybe [Text]
a -> Route
s {$sel:authorizationScopes:Route' :: Maybe [Text]
authorizationScopes = Maybe [Text]
a} :: Route) ((Maybe [Text] -> f (Maybe [Text])) -> Route -> f Route)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Route
-> f Route
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The request models for the route. Supported only for WebSocket APIs.
route_requestModels :: Lens.Lens' Route (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
route_requestModels :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Route -> f Route
route_requestModels = (Route -> Maybe (HashMap Text Text))
-> (Route -> Maybe (HashMap Text Text) -> Route)
-> Lens
     Route Route (Maybe (HashMap Text Text)) (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe (HashMap Text Text)
requestModels :: Maybe (HashMap Text Text)
$sel:requestModels:Route' :: Route -> Maybe (HashMap Text Text)
requestModels} -> Maybe (HashMap Text Text)
requestModels) (\s :: Route
s@Route' {} Maybe (HashMap Text Text)
a -> Route
s {$sel:requestModels:Route' :: Maybe (HashMap Text Text)
requestModels = Maybe (HashMap Text Text)
a} :: Route) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Route -> f Route)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Route
-> f Route
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The request parameters for the route. Supported only for WebSocket APIs.
route_requestParameters :: Lens.Lens' Route (Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints))
route_requestParameters :: (Maybe (HashMap Text ParameterConstraints)
 -> f (Maybe (HashMap Text ParameterConstraints)))
-> Route -> f Route
route_requestParameters = (Route -> Maybe (HashMap Text ParameterConstraints))
-> (Route -> Maybe (HashMap Text ParameterConstraints) -> Route)
-> Lens
     Route
     Route
     (Maybe (HashMap Text ParameterConstraints))
     (Maybe (HashMap Text ParameterConstraints))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe (HashMap Text ParameterConstraints)
requestParameters :: Maybe (HashMap Text ParameterConstraints)
$sel:requestParameters:Route' :: Route -> Maybe (HashMap Text ParameterConstraints)
requestParameters} -> Maybe (HashMap Text ParameterConstraints)
requestParameters) (\s :: Route
s@Route' {} Maybe (HashMap Text ParameterConstraints)
a -> Route
s {$sel:requestParameters:Route' :: Maybe (HashMap Text ParameterConstraints)
requestParameters = Maybe (HashMap Text ParameterConstraints)
a} :: Route) ((Maybe (HashMap Text ParameterConstraints)
  -> f (Maybe (HashMap Text ParameterConstraints)))
 -> Route -> f Route)
-> ((Maybe (HashMap Text ParameterConstraints)
     -> f (Maybe (HashMap Text ParameterConstraints)))
    -> Maybe (HashMap Text ParameterConstraints)
    -> f (Maybe (HashMap Text ParameterConstraints)))
-> (Maybe (HashMap Text ParameterConstraints)
    -> f (Maybe (HashMap Text ParameterConstraints)))
-> Route
-> f Route
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text ParameterConstraints)
  (HashMap Text ParameterConstraints)
  (HashMap Text ParameterConstraints)
  (HashMap Text ParameterConstraints)
-> Iso
     (Maybe (HashMap Text ParameterConstraints))
     (Maybe (HashMap Text ParameterConstraints))
     (Maybe (HashMap Text ParameterConstraints))
     (Maybe (HashMap Text ParameterConstraints))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text ParameterConstraints)
  (HashMap Text ParameterConstraints)
  (HashMap Text ParameterConstraints)
  (HashMap Text ParameterConstraints)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The route ID.
route_routeId :: Lens.Lens' Route (Prelude.Maybe Prelude.Text)
route_routeId :: (Maybe Text -> f (Maybe Text)) -> Route -> f Route
route_routeId = (Route -> Maybe Text)
-> (Route -> Maybe Text -> Route)
-> Lens Route Route (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe Text
routeId :: Maybe Text
$sel:routeId:Route' :: Route -> Maybe Text
routeId} -> Maybe Text
routeId) (\s :: Route
s@Route' {} Maybe Text
a -> Route
s {$sel:routeId:Route' :: Maybe Text
routeId = Maybe Text
a} :: Route)

-- | 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.
route_authorizerId :: Lens.Lens' Route (Prelude.Maybe Prelude.Text)
route_authorizerId :: (Maybe Text -> f (Maybe Text)) -> Route -> f Route
route_authorizerId = (Route -> Maybe Text)
-> (Route -> Maybe Text -> Route)
-> Lens Route Route (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe Text
authorizerId :: Maybe Text
$sel:authorizerId:Route' :: Route -> Maybe Text
authorizerId} -> Maybe Text
authorizerId) (\s :: Route
s@Route' {} Maybe Text
a -> Route
s {$sel:authorizerId:Route' :: Maybe Text
authorizerId = Maybe Text
a} :: Route)

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

-- | 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.
route_apiGatewayManaged :: Lens.Lens' Route (Prelude.Maybe Prelude.Bool)
route_apiGatewayManaged :: (Maybe Bool -> f (Maybe Bool)) -> Route -> f Route
route_apiGatewayManaged = (Route -> Maybe Bool)
-> (Route -> Maybe Bool -> Route)
-> Lens Route Route (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe Bool
apiGatewayManaged :: Maybe Bool
$sel:apiGatewayManaged:Route' :: Route -> Maybe Bool
apiGatewayManaged} -> Maybe Bool
apiGatewayManaged) (\s :: Route
s@Route' {} Maybe Bool
a -> Route
s {$sel:apiGatewayManaged:Route' :: Maybe Bool
apiGatewayManaged = Maybe Bool
a} :: Route)

-- | 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.
route_authorizationType :: Lens.Lens' Route (Prelude.Maybe AuthorizationType)
route_authorizationType :: (Maybe AuthorizationType -> f (Maybe AuthorizationType))
-> Route -> f Route
route_authorizationType = (Route -> Maybe AuthorizationType)
-> (Route -> Maybe AuthorizationType -> Route)
-> Lens
     Route Route (Maybe AuthorizationType) (Maybe AuthorizationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Route' {Maybe AuthorizationType
authorizationType :: Maybe AuthorizationType
$sel:authorizationType:Route' :: Route -> Maybe AuthorizationType
authorizationType} -> Maybe AuthorizationType
authorizationType) (\s :: Route
s@Route' {} Maybe AuthorizationType
a -> Route
s {$sel:authorizationType:Route' :: Maybe AuthorizationType
authorizationType = Maybe AuthorizationType
a} :: Route)

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

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

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

instance Core.FromJSON Route where
  parseJSON :: Value -> Parser Route
parseJSON =
    String -> (Object -> Parser Route) -> Value -> Parser Route
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Route"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe (HashMap Text ParameterConstraints)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe AuthorizationType
-> Maybe Bool
-> Maybe Text
-> Text
-> Route
Route'
            (Maybe [Text]
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe (HashMap Text ParameterConstraints)
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe AuthorizationType
 -> Maybe Bool
 -> Maybe Text
 -> Text
 -> Route)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe (HashMap Text ParameterConstraints)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe AuthorizationType
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Route)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"authorizationScopes"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe (HashMap Text ParameterConstraints)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe AuthorizationType
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Route)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe (HashMap Text ParameterConstraints)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe AuthorizationType
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"modelSelectionExpression")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe (HashMap Text ParameterConstraints)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe AuthorizationType
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Route)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text ParameterConstraints)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe AuthorizationType
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"requestModels" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe (HashMap Text ParameterConstraints)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe AuthorizationType
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Route)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text ParameterConstraints)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe AuthorizationType
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"routeResponseSelectionExpression")
            Parser
  (Maybe (HashMap Text ParameterConstraints)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe AuthorizationType
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Route)
-> Parser (Maybe (HashMap Text ParameterConstraints))
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe AuthorizationType
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe (HashMap Text ParameterConstraints)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"requestParameters"
                            Parser (Maybe (Maybe (HashMap Text ParameterConstraints)))
-> Maybe (HashMap Text ParameterConstraints)
-> Parser (Maybe (HashMap Text ParameterConstraints))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text ParameterConstraints)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe AuthorizationType
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Route)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe AuthorizationType
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"routeId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe AuthorizationType
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Route)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe AuthorizationType
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"authorizerId")
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe AuthorizationType
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Route)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe AuthorizationType
      -> Maybe Bool
      -> Maybe Text
      -> Text
      -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"operationName")
            Parser
  (Maybe Bool
   -> Maybe AuthorizationType
   -> Maybe Bool
   -> Maybe Text
   -> Text
   -> Route)
-> Parser (Maybe Bool)
-> Parser
     (Maybe AuthorizationType
      -> Maybe Bool -> Maybe Text -> Text -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"apiGatewayManaged")
            Parser
  (Maybe AuthorizationType
   -> Maybe Bool -> Maybe Text -> Text -> Route)
-> Parser (Maybe AuthorizationType)
-> Parser (Maybe Bool -> Maybe Text -> Text -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AuthorizationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"authorizationType")
            Parser (Maybe Bool -> Maybe Text -> Text -> Route)
-> Parser (Maybe Bool) -> Parser (Maybe Text -> Text -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"apiKeyRequired")
            Parser (Maybe Text -> Text -> Route)
-> Parser (Maybe Text) -> Parser (Text -> Route)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"target")
            Parser (Text -> Route) -> Parser Text -> Parser Route
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"routeKey")
      )

instance Prelude.Hashable Route

instance Prelude.NFData Route