{-# 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.CreateRouteResponse
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a RouteResponse for a Route.
module Amazonka.ApiGatewayV2.CreateRouteResponse
  ( -- * Creating a Request
    CreateRouteResponse (..),
    newCreateRouteResponse,

    -- * Request Lenses
    createRouteResponse_modelSelectionExpression,
    createRouteResponse_responseModels,
    createRouteResponse_responseParameters,
    createRouteResponse_apiId,
    createRouteResponse_routeId,
    createRouteResponse_routeResponseKey,

    -- * Destructuring the Response
    CreateRouteResponseResponse (..),
    newCreateRouteResponseResponse,

    -- * Response Lenses
    createRouteResponseResponse_modelSelectionExpression,
    createRouteResponseResponse_responseModels,
    createRouteResponseResponse_routeResponseId,
    createRouteResponseResponse_routeResponseKey,
    createRouteResponseResponse_responseParameters,
    createRouteResponseResponse_httpStatus,
  )
where

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

-- | Creates a new RouteResponse resource to represent a route response.
--
-- /See:/ 'newCreateRouteResponse' smart constructor.
data CreateRouteResponse = CreateRouteResponse'
  { -- | The model selection expression for the route response. Supported only
    -- for WebSocket APIs.
    CreateRouteResponse -> Maybe Text
modelSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | The response models for the route response.
    CreateRouteResponse -> Maybe (HashMap Text Text)
responseModels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The route response parameters.
    CreateRouteResponse -> Maybe (HashMap Text ParameterConstraints)
responseParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints),
    -- | The API identifier.
    CreateRouteResponse -> Text
apiId :: Prelude.Text,
    -- | The route ID.
    CreateRouteResponse -> Text
routeId :: Prelude.Text,
    -- | The route response key.
    CreateRouteResponse -> Text
routeResponseKey :: Prelude.Text
  }
  deriving (CreateRouteResponse -> CreateRouteResponse -> Bool
(CreateRouteResponse -> CreateRouteResponse -> Bool)
-> (CreateRouteResponse -> CreateRouteResponse -> Bool)
-> Eq CreateRouteResponse
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]
(Int -> ReadS CreateRouteResponse)
-> ReadS [CreateRouteResponse]
-> ReadPrec CreateRouteResponse
-> ReadPrec [CreateRouteResponse]
-> Read 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
(Int -> CreateRouteResponse -> ShowS)
-> (CreateRouteResponse -> String)
-> ([CreateRouteResponse] -> ShowS)
-> Show CreateRouteResponse
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. CreateRouteResponse -> Rep CreateRouteResponse x)
-> (forall x. Rep CreateRouteResponse x -> CreateRouteResponse)
-> Generic CreateRouteResponse
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:
--
-- 'modelSelectionExpression', 'createRouteResponse_modelSelectionExpression' - The model selection expression for the route response. Supported only
-- for WebSocket APIs.
--
-- 'responseModels', 'createRouteResponse_responseModels' - The response models for the route response.
--
-- 'responseParameters', 'createRouteResponse_responseParameters' - The route response parameters.
--
-- 'apiId', 'createRouteResponse_apiId' - The API identifier.
--
-- 'routeId', 'createRouteResponse_routeId' - The route ID.
--
-- 'routeResponseKey', 'createRouteResponse_routeResponseKey' - The route response key.
newCreateRouteResponse ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'routeId'
  Prelude.Text ->
  -- | 'routeResponseKey'
  Prelude.Text ->
  CreateRouteResponse
newCreateRouteResponse :: Text -> Text -> Text -> CreateRouteResponse
newCreateRouteResponse
  Text
pApiId_
  Text
pRouteId_
  Text
pRouteResponseKey_ =
    CreateRouteResponse' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text ParameterConstraints)
-> Text
-> Text
-> Text
-> CreateRouteResponse
CreateRouteResponse'
      { $sel:modelSelectionExpression:CreateRouteResponse' :: Maybe Text
modelSelectionExpression =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:responseModels:CreateRouteResponse' :: Maybe (HashMap Text Text)
responseModels = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:responseParameters:CreateRouteResponse' :: Maybe (HashMap Text ParameterConstraints)
responseParameters = Maybe (HashMap Text ParameterConstraints)
forall a. Maybe a
Prelude.Nothing,
        $sel:apiId:CreateRouteResponse' :: Text
apiId = Text
pApiId_,
        $sel:routeId:CreateRouteResponse' :: Text
routeId = Text
pRouteId_,
        $sel:routeResponseKey:CreateRouteResponse' :: Text
routeResponseKey = Text
pRouteResponseKey_
      }

-- | The model selection expression for the route response. Supported only
-- for WebSocket APIs.
createRouteResponse_modelSelectionExpression :: Lens.Lens' CreateRouteResponse (Prelude.Maybe Prelude.Text)
createRouteResponse_modelSelectionExpression :: (Maybe Text -> f (Maybe Text))
-> CreateRouteResponse -> f CreateRouteResponse
createRouteResponse_modelSelectionExpression = (CreateRouteResponse -> Maybe Text)
-> (CreateRouteResponse -> Maybe Text -> CreateRouteResponse)
-> Lens
     CreateRouteResponse CreateRouteResponse (Maybe Text) (Maybe Text)
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 response models for the route response.
createRouteResponse_responseModels :: Lens.Lens' CreateRouteResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRouteResponse_responseModels :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRouteResponse -> f CreateRouteResponse
createRouteResponse_responseModels = (CreateRouteResponse -> Maybe (HashMap Text Text))
-> (CreateRouteResponse
    -> Maybe (HashMap Text Text) -> CreateRouteResponse)
-> Lens
     CreateRouteResponse
     CreateRouteResponse
     (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 (\CreateRouteResponse' {Maybe (HashMap Text Text)
responseModels :: Maybe (HashMap Text Text)
$sel:responseModels:CreateRouteResponse' :: CreateRouteResponse -> Maybe (HashMap Text Text)
responseModels} -> Maybe (HashMap Text Text)
responseModels) (\s :: CreateRouteResponse
s@CreateRouteResponse' {} Maybe (HashMap Text Text)
a -> CreateRouteResponse
s {$sel:responseModels:CreateRouteResponse' :: Maybe (HashMap Text Text)
responseModels = Maybe (HashMap Text Text)
a} :: CreateRouteResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateRouteResponse -> f CreateRouteResponse)
-> ((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)))
-> CreateRouteResponse
-> f CreateRouteResponse
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 parameters.
createRouteResponse_responseParameters :: Lens.Lens' CreateRouteResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints))
createRouteResponse_responseParameters :: (Maybe (HashMap Text ParameterConstraints)
 -> f (Maybe (HashMap Text ParameterConstraints)))
-> CreateRouteResponse -> f CreateRouteResponse
createRouteResponse_responseParameters = (CreateRouteResponse -> Maybe (HashMap Text ParameterConstraints))
-> (CreateRouteResponse
    -> Maybe (HashMap Text ParameterConstraints)
    -> CreateRouteResponse)
-> Lens
     CreateRouteResponse
     CreateRouteResponse
     (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 (\CreateRouteResponse' {Maybe (HashMap Text ParameterConstraints)
responseParameters :: Maybe (HashMap Text ParameterConstraints)
$sel:responseParameters:CreateRouteResponse' :: CreateRouteResponse -> Maybe (HashMap Text ParameterConstraints)
responseParameters} -> Maybe (HashMap Text ParameterConstraints)
responseParameters) (\s :: CreateRouteResponse
s@CreateRouteResponse' {} Maybe (HashMap Text ParameterConstraints)
a -> CreateRouteResponse
s {$sel:responseParameters:CreateRouteResponse' :: Maybe (HashMap Text ParameterConstraints)
responseParameters = Maybe (HashMap Text ParameterConstraints)
a} :: CreateRouteResponse) ((Maybe (HashMap Text ParameterConstraints)
  -> f (Maybe (HashMap Text ParameterConstraints)))
 -> CreateRouteResponse -> f CreateRouteResponse)
-> ((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)))
-> CreateRouteResponse
-> f CreateRouteResponse
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 API identifier.
createRouteResponse_apiId :: Lens.Lens' CreateRouteResponse Prelude.Text
createRouteResponse_apiId :: (Text -> f Text) -> CreateRouteResponse -> f CreateRouteResponse
createRouteResponse_apiId = (CreateRouteResponse -> Text)
-> (CreateRouteResponse -> Text -> CreateRouteResponse)
-> Lens CreateRouteResponse CreateRouteResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse' {Text
apiId :: Text
$sel:apiId:CreateRouteResponse' :: CreateRouteResponse -> Text
apiId} -> Text
apiId) (\s :: CreateRouteResponse
s@CreateRouteResponse' {} Text
a -> CreateRouteResponse
s {$sel:apiId:CreateRouteResponse' :: Text
apiId = Text
a} :: CreateRouteResponse)

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

-- | The route response key.
createRouteResponse_routeResponseKey :: Lens.Lens' CreateRouteResponse Prelude.Text
createRouteResponse_routeResponseKey :: (Text -> f Text) -> CreateRouteResponse -> f CreateRouteResponse
createRouteResponse_routeResponseKey = (CreateRouteResponse -> Text)
-> (CreateRouteResponse -> Text -> CreateRouteResponse)
-> Lens CreateRouteResponse CreateRouteResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponse' {Text
routeResponseKey :: Text
$sel:routeResponseKey:CreateRouteResponse' :: CreateRouteResponse -> Text
routeResponseKey} -> Text
routeResponseKey) (\s :: CreateRouteResponse
s@CreateRouteResponse' {} Text
a -> CreateRouteResponse
s {$sel:routeResponseKey:CreateRouteResponse' :: Text
routeResponseKey = Text
a} :: CreateRouteResponse)

instance Core.AWSRequest CreateRouteResponse where
  type
    AWSResponse CreateRouteResponse =
      CreateRouteResponseResponse
  request :: CreateRouteResponse -> Request CreateRouteResponse
request = Service -> CreateRouteResponse -> Request CreateRouteResponse
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateRouteResponse
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRouteResponse)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateRouteResponse))
-> Logger
-> Service
-> Proxy CreateRouteResponse
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRouteResponse)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text ParameterConstraints)
-> Int
-> CreateRouteResponseResponse
CreateRouteResponseResponse'
            (Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text ParameterConstraints)
 -> Int
 -> CreateRouteResponseResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text ParameterConstraints)
      -> Int
      -> CreateRouteResponseResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"modelSelectionExpression")
            Either
  String
  (Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text ParameterConstraints)
   -> Int
   -> CreateRouteResponseResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text ParameterConstraints)
      -> Int
      -> CreateRouteResponseResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"responseModels" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text ParameterConstraints)
   -> Int
   -> CreateRouteResponseResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe (HashMap Text ParameterConstraints)
      -> Int
      -> CreateRouteResponseResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"routeResponseId")
            Either
  String
  (Maybe Text
   -> Maybe (HashMap Text ParameterConstraints)
   -> Int
   -> CreateRouteResponseResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (HashMap Text ParameterConstraints)
      -> Int -> CreateRouteResponseResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"routeResponseKey")
            Either
  String
  (Maybe (HashMap Text ParameterConstraints)
   -> Int -> CreateRouteResponseResponse)
-> Either String (Maybe (HashMap Text ParameterConstraints))
-> Either String (Int -> CreateRouteResponseResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either
     String (Maybe (Maybe (HashMap Text ParameterConstraints)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"responseParameters"
                            Either String (Maybe (Maybe (HashMap Text ParameterConstraints)))
-> Maybe (HashMap Text ParameterConstraints)
-> Either String (Maybe (HashMap Text ParameterConstraints))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text ParameterConstraints)
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> CreateRouteResponseResponse)
-> Either String Int -> Either String CreateRouteResponseResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateRouteResponse

instance Prelude.NFData CreateRouteResponse

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

instance Core.ToJSON CreateRouteResponse where
  toJSON :: CreateRouteResponse -> Value
toJSON CreateRouteResponse' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ParameterConstraints)
Text
routeResponseKey :: Text
routeId :: Text
apiId :: Text
responseParameters :: Maybe (HashMap Text ParameterConstraints)
responseModels :: Maybe (HashMap Text Text)
modelSelectionExpression :: Maybe Text
$sel:routeResponseKey:CreateRouteResponse' :: CreateRouteResponse -> Text
$sel:routeId:CreateRouteResponse' :: CreateRouteResponse -> Text
$sel:apiId:CreateRouteResponse' :: CreateRouteResponse -> Text
$sel:responseParameters:CreateRouteResponse' :: CreateRouteResponse -> Maybe (HashMap Text ParameterConstraints)
$sel:responseModels:CreateRouteResponse' :: CreateRouteResponse -> Maybe (HashMap Text Text)
$sel:modelSelectionExpression:CreateRouteResponse' :: CreateRouteResponse -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"modelSelectionExpression" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
modelSelectionExpression,
            (Text
"responseModels" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
responseModels,
            (Text
"responseParameters" Text -> HashMap Text ParameterConstraints -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text ParameterConstraints -> Pair)
-> Maybe (HashMap Text ParameterConstraints) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text ParameterConstraints)
responseParameters,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"routeResponseKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
routeResponseKey)
          ]
      )

instance Core.ToPath CreateRouteResponse where
  toPath :: CreateRouteResponse -> ByteString
toPath CreateRouteResponse' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ParameterConstraints)
Text
routeResponseKey :: Text
routeId :: Text
apiId :: Text
responseParameters :: Maybe (HashMap Text ParameterConstraints)
responseModels :: Maybe (HashMap Text Text)
modelSelectionExpression :: Maybe Text
$sel:routeResponseKey:CreateRouteResponse' :: CreateRouteResponse -> Text
$sel:routeId:CreateRouteResponse' :: CreateRouteResponse -> Text
$sel:apiId:CreateRouteResponse' :: CreateRouteResponse -> Text
$sel:responseParameters:CreateRouteResponse' :: CreateRouteResponse -> Maybe (HashMap Text ParameterConstraints)
$sel:responseModels:CreateRouteResponse' :: CreateRouteResponse -> Maybe (HashMap Text Text)
$sel:modelSelectionExpression:CreateRouteResponse' :: CreateRouteResponse -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v2/apis/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiId,
        ByteString
"/routes/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
routeId,
        ByteString
"/routeresponses"
      ]

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

-- | /See:/ 'newCreateRouteResponseResponse' smart constructor.
data CreateRouteResponseResponse = CreateRouteResponseResponse'
  { -- | Represents the model selection expression of a route response. Supported
    -- only for WebSocket APIs.
    CreateRouteResponseResponse -> Maybe Text
modelSelectionExpression :: Prelude.Maybe Prelude.Text,
    -- | Represents the response models of a route response.
    CreateRouteResponseResponse -> Maybe (HashMap Text Text)
responseModels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Represents the identifier of a route response.
    CreateRouteResponseResponse -> Maybe Text
routeResponseId :: Prelude.Maybe Prelude.Text,
    -- | Represents the route response key of a route response.
    CreateRouteResponseResponse -> Maybe Text
routeResponseKey :: Prelude.Maybe Prelude.Text,
    -- | Represents the response parameters of a route response.
    CreateRouteResponseResponse
-> Maybe (HashMap Text ParameterConstraints)
responseParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints),
    -- | The response's http status code.
    CreateRouteResponseResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateRouteResponseResponse -> CreateRouteResponseResponse -> Bool
(CreateRouteResponseResponse
 -> CreateRouteResponseResponse -> Bool)
-> (CreateRouteResponseResponse
    -> CreateRouteResponseResponse -> Bool)
-> Eq CreateRouteResponseResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRouteResponseResponse -> CreateRouteResponseResponse -> Bool
$c/= :: CreateRouteResponseResponse -> CreateRouteResponseResponse -> Bool
== :: CreateRouteResponseResponse -> CreateRouteResponseResponse -> Bool
$c== :: CreateRouteResponseResponse -> CreateRouteResponseResponse -> Bool
Prelude.Eq, ReadPrec [CreateRouteResponseResponse]
ReadPrec CreateRouteResponseResponse
Int -> ReadS CreateRouteResponseResponse
ReadS [CreateRouteResponseResponse]
(Int -> ReadS CreateRouteResponseResponse)
-> ReadS [CreateRouteResponseResponse]
-> ReadPrec CreateRouteResponseResponse
-> ReadPrec [CreateRouteResponseResponse]
-> Read CreateRouteResponseResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRouteResponseResponse]
$creadListPrec :: ReadPrec [CreateRouteResponseResponse]
readPrec :: ReadPrec CreateRouteResponseResponse
$creadPrec :: ReadPrec CreateRouteResponseResponse
readList :: ReadS [CreateRouteResponseResponse]
$creadList :: ReadS [CreateRouteResponseResponse]
readsPrec :: Int -> ReadS CreateRouteResponseResponse
$creadsPrec :: Int -> ReadS CreateRouteResponseResponse
Prelude.Read, Int -> CreateRouteResponseResponse -> ShowS
[CreateRouteResponseResponse] -> ShowS
CreateRouteResponseResponse -> String
(Int -> CreateRouteResponseResponse -> ShowS)
-> (CreateRouteResponseResponse -> String)
-> ([CreateRouteResponseResponse] -> ShowS)
-> Show CreateRouteResponseResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRouteResponseResponse] -> ShowS
$cshowList :: [CreateRouteResponseResponse] -> ShowS
show :: CreateRouteResponseResponse -> String
$cshow :: CreateRouteResponseResponse -> String
showsPrec :: Int -> CreateRouteResponseResponse -> ShowS
$cshowsPrec :: Int -> CreateRouteResponseResponse -> ShowS
Prelude.Show, (forall x.
 CreateRouteResponseResponse -> Rep CreateRouteResponseResponse x)
-> (forall x.
    Rep CreateRouteResponseResponse x -> CreateRouteResponseResponse)
-> Generic CreateRouteResponseResponse
forall x.
Rep CreateRouteResponseResponse x -> CreateRouteResponseResponse
forall x.
CreateRouteResponseResponse -> Rep CreateRouteResponseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRouteResponseResponse x -> CreateRouteResponseResponse
$cfrom :: forall x.
CreateRouteResponseResponse -> Rep CreateRouteResponseResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateRouteResponseResponse' 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:
--
-- 'modelSelectionExpression', 'createRouteResponseResponse_modelSelectionExpression' - Represents the model selection expression of a route response. Supported
-- only for WebSocket APIs.
--
-- 'responseModels', 'createRouteResponseResponse_responseModels' - Represents the response models of a route response.
--
-- 'routeResponseId', 'createRouteResponseResponse_routeResponseId' - Represents the identifier of a route response.
--
-- 'routeResponseKey', 'createRouteResponseResponse_routeResponseKey' - Represents the route response key of a route response.
--
-- 'responseParameters', 'createRouteResponseResponse_responseParameters' - Represents the response parameters of a route response.
--
-- 'httpStatus', 'createRouteResponseResponse_httpStatus' - The response's http status code.
newCreateRouteResponseResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateRouteResponseResponse
newCreateRouteResponseResponse :: Int -> CreateRouteResponseResponse
newCreateRouteResponseResponse Int
pHttpStatus_ =
  CreateRouteResponseResponse' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text ParameterConstraints)
-> Int
-> CreateRouteResponseResponse
CreateRouteResponseResponse'
    { $sel:modelSelectionExpression:CreateRouteResponseResponse' :: Maybe Text
modelSelectionExpression =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:responseModels:CreateRouteResponseResponse' :: Maybe (HashMap Text Text)
responseModels = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:routeResponseId:CreateRouteResponseResponse' :: Maybe Text
routeResponseId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:routeResponseKey:CreateRouteResponseResponse' :: Maybe Text
routeResponseKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:responseParameters:CreateRouteResponseResponse' :: Maybe (HashMap Text ParameterConstraints)
responseParameters = Maybe (HashMap Text ParameterConstraints)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateRouteResponseResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | Represents the response models of a route response.
createRouteResponseResponse_responseModels :: Lens.Lens' CreateRouteResponseResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRouteResponseResponse_responseModels :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRouteResponseResponse -> f CreateRouteResponseResponse
createRouteResponseResponse_responseModels = (CreateRouteResponseResponse -> Maybe (HashMap Text Text))
-> (CreateRouteResponseResponse
    -> Maybe (HashMap Text Text) -> CreateRouteResponseResponse)
-> Lens
     CreateRouteResponseResponse
     CreateRouteResponseResponse
     (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 (\CreateRouteResponseResponse' {Maybe (HashMap Text Text)
responseModels :: Maybe (HashMap Text Text)
$sel:responseModels:CreateRouteResponseResponse' :: CreateRouteResponseResponse -> Maybe (HashMap Text Text)
responseModels} -> Maybe (HashMap Text Text)
responseModels) (\s :: CreateRouteResponseResponse
s@CreateRouteResponseResponse' {} Maybe (HashMap Text Text)
a -> CreateRouteResponseResponse
s {$sel:responseModels:CreateRouteResponseResponse' :: Maybe (HashMap Text Text)
responseModels = Maybe (HashMap Text Text)
a} :: CreateRouteResponseResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateRouteResponseResponse -> f CreateRouteResponseResponse)
-> ((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)))
-> CreateRouteResponseResponse
-> f CreateRouteResponseResponse
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

-- | Represents the identifier of a route response.
createRouteResponseResponse_routeResponseId :: Lens.Lens' CreateRouteResponseResponse (Prelude.Maybe Prelude.Text)
createRouteResponseResponse_routeResponseId :: (Maybe Text -> f (Maybe Text))
-> CreateRouteResponseResponse -> f CreateRouteResponseResponse
createRouteResponseResponse_routeResponseId = (CreateRouteResponseResponse -> Maybe Text)
-> (CreateRouteResponseResponse
    -> Maybe Text -> CreateRouteResponseResponse)
-> Lens
     CreateRouteResponseResponse
     CreateRouteResponseResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponseResponse' {Maybe Text
routeResponseId :: Maybe Text
$sel:routeResponseId:CreateRouteResponseResponse' :: CreateRouteResponseResponse -> Maybe Text
routeResponseId} -> Maybe Text
routeResponseId) (\s :: CreateRouteResponseResponse
s@CreateRouteResponseResponse' {} Maybe Text
a -> CreateRouteResponseResponse
s {$sel:routeResponseId:CreateRouteResponseResponse' :: Maybe Text
routeResponseId = Maybe Text
a} :: CreateRouteResponseResponse)

-- | Represents the route response key of a route response.
createRouteResponseResponse_routeResponseKey :: Lens.Lens' CreateRouteResponseResponse (Prelude.Maybe Prelude.Text)
createRouteResponseResponse_routeResponseKey :: (Maybe Text -> f (Maybe Text))
-> CreateRouteResponseResponse -> f CreateRouteResponseResponse
createRouteResponseResponse_routeResponseKey = (CreateRouteResponseResponse -> Maybe Text)
-> (CreateRouteResponseResponse
    -> Maybe Text -> CreateRouteResponseResponse)
-> Lens
     CreateRouteResponseResponse
     CreateRouteResponseResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponseResponse' {Maybe Text
routeResponseKey :: Maybe Text
$sel:routeResponseKey:CreateRouteResponseResponse' :: CreateRouteResponseResponse -> Maybe Text
routeResponseKey} -> Maybe Text
routeResponseKey) (\s :: CreateRouteResponseResponse
s@CreateRouteResponseResponse' {} Maybe Text
a -> CreateRouteResponseResponse
s {$sel:routeResponseKey:CreateRouteResponseResponse' :: Maybe Text
routeResponseKey = Maybe Text
a} :: CreateRouteResponseResponse)

-- | Represents the response parameters of a route response.
createRouteResponseResponse_responseParameters :: Lens.Lens' CreateRouteResponseResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text ParameterConstraints))
createRouteResponseResponse_responseParameters :: (Maybe (HashMap Text ParameterConstraints)
 -> f (Maybe (HashMap Text ParameterConstraints)))
-> CreateRouteResponseResponse -> f CreateRouteResponseResponse
createRouteResponseResponse_responseParameters = (CreateRouteResponseResponse
 -> Maybe (HashMap Text ParameterConstraints))
-> (CreateRouteResponseResponse
    -> Maybe (HashMap Text ParameterConstraints)
    -> CreateRouteResponseResponse)
-> Lens
     CreateRouteResponseResponse
     CreateRouteResponseResponse
     (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 (\CreateRouteResponseResponse' {Maybe (HashMap Text ParameterConstraints)
responseParameters :: Maybe (HashMap Text ParameterConstraints)
$sel:responseParameters:CreateRouteResponseResponse' :: CreateRouteResponseResponse
-> Maybe (HashMap Text ParameterConstraints)
responseParameters} -> Maybe (HashMap Text ParameterConstraints)
responseParameters) (\s :: CreateRouteResponseResponse
s@CreateRouteResponseResponse' {} Maybe (HashMap Text ParameterConstraints)
a -> CreateRouteResponseResponse
s {$sel:responseParameters:CreateRouteResponseResponse' :: Maybe (HashMap Text ParameterConstraints)
responseParameters = Maybe (HashMap Text ParameterConstraints)
a} :: CreateRouteResponseResponse) ((Maybe (HashMap Text ParameterConstraints)
  -> f (Maybe (HashMap Text ParameterConstraints)))
 -> CreateRouteResponseResponse -> f CreateRouteResponseResponse)
-> ((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)))
-> CreateRouteResponseResponse
-> f CreateRouteResponseResponse
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 response's http status code.
createRouteResponseResponse_httpStatus :: Lens.Lens' CreateRouteResponseResponse Prelude.Int
createRouteResponseResponse_httpStatus :: (Int -> f Int)
-> CreateRouteResponseResponse -> f CreateRouteResponseResponse
createRouteResponseResponse_httpStatus = (CreateRouteResponseResponse -> Int)
-> (CreateRouteResponseResponse
    -> Int -> CreateRouteResponseResponse)
-> Lens
     CreateRouteResponseResponse CreateRouteResponseResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteResponseResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateRouteResponseResponse' :: CreateRouteResponseResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateRouteResponseResponse
s@CreateRouteResponseResponse' {} Int
a -> CreateRouteResponseResponse
s {$sel:httpStatus:CreateRouteResponseResponse' :: Int
httpStatus = Int
a} :: CreateRouteResponseResponse)

instance Prelude.NFData CreateRouteResponseResponse