{-# 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.APIGateway.PutIntegrationResponse
-- 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)
--
-- Represents a put integration.
module Amazonka.APIGateway.PutIntegrationResponse
  ( -- * Creating a Request
    PutIntegrationResponse (..),
    newPutIntegrationResponse,

    -- * Request Lenses
    putIntegrationResponse_contentHandling,
    putIntegrationResponse_responseTemplates,
    putIntegrationResponse_selectionPattern,
    putIntegrationResponse_responseParameters,
    putIntegrationResponse_restApiId,
    putIntegrationResponse_resourceId,
    putIntegrationResponse_httpMethod,
    putIntegrationResponse_statusCode,

    -- * Destructuring the Response
    IntegrationResponse (..),
    newIntegrationResponse,

    -- * Response Lenses
    integrationResponse_contentHandling,
    integrationResponse_responseTemplates,
    integrationResponse_selectionPattern,
    integrationResponse_statusCode,
    integrationResponse_responseParameters,
  )
where

import Amazonka.APIGateway.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

-- | Represents a put integration response request.
--
-- /See:/ 'newPutIntegrationResponse' smart constructor.
data PutIntegrationResponse = PutIntegrationResponse'
  { -- | Specifies how to handle response payload content type conversions.
    -- Supported values are @CONVERT_TO_BINARY@ and @CONVERT_TO_TEXT@, with the
    -- following behaviors:
    --
    -- -   @CONVERT_TO_BINARY@: Converts a response payload from a
    --     Base64-encoded string to the corresponding binary blob.
    --
    -- -   @CONVERT_TO_TEXT@: Converts a response payload from a binary blob to
    --     a Base64-encoded string.
    --
    -- If this property is not defined, the response payload will be passed
    -- through from the integration response to the method response without
    -- modification.
    PutIntegrationResponse -> Maybe ContentHandlingStrategy
contentHandling :: Prelude.Maybe ContentHandlingStrategy,
    -- | Specifies a put integration response\'s templates.
    PutIntegrationResponse -> Maybe (HashMap Text Text)
responseTemplates :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Specifies the selection pattern of a put integration response.
    PutIntegrationResponse -> Maybe Text
selectionPattern :: Prelude.Maybe Prelude.Text,
    -- | A key-value map specifying response parameters that are passed to the
    -- method response from the back end. The key is a method response header
    -- parameter name and the mapped value is an integration response header
    -- value, a static value enclosed within a pair of single quotes, or a JSON
    -- expression from the integration response body. The mapping key must
    -- match the pattern of @method.response.header.{name}@, where @name@ is a
    -- valid and unique header name. The mapped non-static value must match the
    -- pattern of @integration.response.header.{name}@ or
    -- @integration.response.body.{JSON-expression}@, where @name@ must be a
    -- valid and unique response header name and @JSON-expression@ a valid JSON
    -- expression without the @$@ prefix.
    PutIntegrationResponse -> Maybe (HashMap Text Text)
responseParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | [Required] The string identifier of the associated RestApi.
    PutIntegrationResponse -> Text
restApiId :: Prelude.Text,
    -- | [Required] Specifies a put integration response request\'s resource
    -- identifier.
    PutIntegrationResponse -> Text
resourceId :: Prelude.Text,
    -- | [Required] Specifies a put integration response request\'s HTTP method.
    PutIntegrationResponse -> Text
httpMethod :: Prelude.Text,
    -- | [Required] Specifies the status code that is used to map the integration
    -- response to an existing MethodResponse.
    PutIntegrationResponse -> Text
statusCode :: Prelude.Text
  }
  deriving (PutIntegrationResponse -> PutIntegrationResponse -> Bool
(PutIntegrationResponse -> PutIntegrationResponse -> Bool)
-> (PutIntegrationResponse -> PutIntegrationResponse -> Bool)
-> Eq PutIntegrationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutIntegrationResponse -> PutIntegrationResponse -> Bool
$c/= :: PutIntegrationResponse -> PutIntegrationResponse -> Bool
== :: PutIntegrationResponse -> PutIntegrationResponse -> Bool
$c== :: PutIntegrationResponse -> PutIntegrationResponse -> Bool
Prelude.Eq, ReadPrec [PutIntegrationResponse]
ReadPrec PutIntegrationResponse
Int -> ReadS PutIntegrationResponse
ReadS [PutIntegrationResponse]
(Int -> ReadS PutIntegrationResponse)
-> ReadS [PutIntegrationResponse]
-> ReadPrec PutIntegrationResponse
-> ReadPrec [PutIntegrationResponse]
-> Read PutIntegrationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutIntegrationResponse]
$creadListPrec :: ReadPrec [PutIntegrationResponse]
readPrec :: ReadPrec PutIntegrationResponse
$creadPrec :: ReadPrec PutIntegrationResponse
readList :: ReadS [PutIntegrationResponse]
$creadList :: ReadS [PutIntegrationResponse]
readsPrec :: Int -> ReadS PutIntegrationResponse
$creadsPrec :: Int -> ReadS PutIntegrationResponse
Prelude.Read, Int -> PutIntegrationResponse -> ShowS
[PutIntegrationResponse] -> ShowS
PutIntegrationResponse -> String
(Int -> PutIntegrationResponse -> ShowS)
-> (PutIntegrationResponse -> String)
-> ([PutIntegrationResponse] -> ShowS)
-> Show PutIntegrationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutIntegrationResponse] -> ShowS
$cshowList :: [PutIntegrationResponse] -> ShowS
show :: PutIntegrationResponse -> String
$cshow :: PutIntegrationResponse -> String
showsPrec :: Int -> PutIntegrationResponse -> ShowS
$cshowsPrec :: Int -> PutIntegrationResponse -> ShowS
Prelude.Show, (forall x. PutIntegrationResponse -> Rep PutIntegrationResponse x)
-> (forall x.
    Rep PutIntegrationResponse x -> PutIntegrationResponse)
-> Generic PutIntegrationResponse
forall x. Rep PutIntegrationResponse x -> PutIntegrationResponse
forall x. PutIntegrationResponse -> Rep PutIntegrationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutIntegrationResponse x -> PutIntegrationResponse
$cfrom :: forall x. PutIntegrationResponse -> Rep PutIntegrationResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutIntegrationResponse' 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:
--
-- 'contentHandling', 'putIntegrationResponse_contentHandling' - Specifies how to handle response payload content type conversions.
-- Supported values are @CONVERT_TO_BINARY@ and @CONVERT_TO_TEXT@, with the
-- following behaviors:
--
-- -   @CONVERT_TO_BINARY@: Converts a response payload from a
--     Base64-encoded string to the corresponding binary blob.
--
-- -   @CONVERT_TO_TEXT@: Converts a response payload from a binary blob to
--     a Base64-encoded string.
--
-- If this property is not defined, the response payload will be passed
-- through from the integration response to the method response without
-- modification.
--
-- 'responseTemplates', 'putIntegrationResponse_responseTemplates' - Specifies a put integration response\'s templates.
--
-- 'selectionPattern', 'putIntegrationResponse_selectionPattern' - Specifies the selection pattern of a put integration response.
--
-- 'responseParameters', 'putIntegrationResponse_responseParameters' - A key-value map specifying response parameters that are passed to the
-- method response from the back end. The key is a method response header
-- parameter name and the mapped value is an integration response header
-- value, a static value enclosed within a pair of single quotes, or a JSON
-- expression from the integration response body. The mapping key must
-- match the pattern of @method.response.header.{name}@, where @name@ is a
-- valid and unique header name. The mapped non-static value must match the
-- pattern of @integration.response.header.{name}@ or
-- @integration.response.body.{JSON-expression}@, where @name@ must be a
-- valid and unique response header name and @JSON-expression@ a valid JSON
-- expression without the @$@ prefix.
--
-- 'restApiId', 'putIntegrationResponse_restApiId' - [Required] The string identifier of the associated RestApi.
--
-- 'resourceId', 'putIntegrationResponse_resourceId' - [Required] Specifies a put integration response request\'s resource
-- identifier.
--
-- 'httpMethod', 'putIntegrationResponse_httpMethod' - [Required] Specifies a put integration response request\'s HTTP method.
--
-- 'statusCode', 'putIntegrationResponse_statusCode' - [Required] Specifies the status code that is used to map the integration
-- response to an existing MethodResponse.
newPutIntegrationResponse ::
  -- | 'restApiId'
  Prelude.Text ->
  -- | 'resourceId'
  Prelude.Text ->
  -- | 'httpMethod'
  Prelude.Text ->
  -- | 'statusCode'
  Prelude.Text ->
  PutIntegrationResponse
newPutIntegrationResponse :: Text -> Text -> Text -> Text -> PutIntegrationResponse
newPutIntegrationResponse
  Text
pRestApiId_
  Text
pResourceId_
  Text
pHttpMethod_
  Text
pStatusCode_ =
    PutIntegrationResponse' :: Maybe ContentHandlingStrategy
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> Text
-> PutIntegrationResponse
PutIntegrationResponse'
      { $sel:contentHandling:PutIntegrationResponse' :: Maybe ContentHandlingStrategy
contentHandling =
          Maybe ContentHandlingStrategy
forall a. Maybe a
Prelude.Nothing,
        $sel:responseTemplates:PutIntegrationResponse' :: Maybe (HashMap Text Text)
responseTemplates = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:selectionPattern:PutIntegrationResponse' :: Maybe Text
selectionPattern = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:responseParameters:PutIntegrationResponse' :: Maybe (HashMap Text Text)
responseParameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:restApiId:PutIntegrationResponse' :: Text
restApiId = Text
pRestApiId_,
        $sel:resourceId:PutIntegrationResponse' :: Text
resourceId = Text
pResourceId_,
        $sel:httpMethod:PutIntegrationResponse' :: Text
httpMethod = Text
pHttpMethod_,
        $sel:statusCode:PutIntegrationResponse' :: Text
statusCode = Text
pStatusCode_
      }

-- | Specifies how to handle response payload content type conversions.
-- Supported values are @CONVERT_TO_BINARY@ and @CONVERT_TO_TEXT@, with the
-- following behaviors:
--
-- -   @CONVERT_TO_BINARY@: Converts a response payload from a
--     Base64-encoded string to the corresponding binary blob.
--
-- -   @CONVERT_TO_TEXT@: Converts a response payload from a binary blob to
--     a Base64-encoded string.
--
-- If this property is not defined, the response payload will be passed
-- through from the integration response to the method response without
-- modification.
putIntegrationResponse_contentHandling :: Lens.Lens' PutIntegrationResponse (Prelude.Maybe ContentHandlingStrategy)
putIntegrationResponse_contentHandling :: (Maybe ContentHandlingStrategy
 -> f (Maybe ContentHandlingStrategy))
-> PutIntegrationResponse -> f PutIntegrationResponse
putIntegrationResponse_contentHandling = (PutIntegrationResponse -> Maybe ContentHandlingStrategy)
-> (PutIntegrationResponse
    -> Maybe ContentHandlingStrategy -> PutIntegrationResponse)
-> Lens
     PutIntegrationResponse
     PutIntegrationResponse
     (Maybe ContentHandlingStrategy)
     (Maybe ContentHandlingStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutIntegrationResponse' {Maybe ContentHandlingStrategy
contentHandling :: Maybe ContentHandlingStrategy
$sel:contentHandling:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe ContentHandlingStrategy
contentHandling} -> Maybe ContentHandlingStrategy
contentHandling) (\s :: PutIntegrationResponse
s@PutIntegrationResponse' {} Maybe ContentHandlingStrategy
a -> PutIntegrationResponse
s {$sel:contentHandling:PutIntegrationResponse' :: Maybe ContentHandlingStrategy
contentHandling = Maybe ContentHandlingStrategy
a} :: PutIntegrationResponse)

-- | Specifies a put integration response\'s templates.
putIntegrationResponse_responseTemplates :: Lens.Lens' PutIntegrationResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
putIntegrationResponse_responseTemplates :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PutIntegrationResponse -> f PutIntegrationResponse
putIntegrationResponse_responseTemplates = (PutIntegrationResponse -> Maybe (HashMap Text Text))
-> (PutIntegrationResponse
    -> Maybe (HashMap Text Text) -> PutIntegrationResponse)
-> Lens
     PutIntegrationResponse
     PutIntegrationResponse
     (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 (\PutIntegrationResponse' {Maybe (HashMap Text Text)
responseTemplates :: Maybe (HashMap Text Text)
$sel:responseTemplates:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe (HashMap Text Text)
responseTemplates} -> Maybe (HashMap Text Text)
responseTemplates) (\s :: PutIntegrationResponse
s@PutIntegrationResponse' {} Maybe (HashMap Text Text)
a -> PutIntegrationResponse
s {$sel:responseTemplates:PutIntegrationResponse' :: Maybe (HashMap Text Text)
responseTemplates = Maybe (HashMap Text Text)
a} :: PutIntegrationResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> PutIntegrationResponse -> f PutIntegrationResponse)
-> ((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)))
-> PutIntegrationResponse
-> f PutIntegrationResponse
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

-- | Specifies the selection pattern of a put integration response.
putIntegrationResponse_selectionPattern :: Lens.Lens' PutIntegrationResponse (Prelude.Maybe Prelude.Text)
putIntegrationResponse_selectionPattern :: (Maybe Text -> f (Maybe Text))
-> PutIntegrationResponse -> f PutIntegrationResponse
putIntegrationResponse_selectionPattern = (PutIntegrationResponse -> Maybe Text)
-> (PutIntegrationResponse -> Maybe Text -> PutIntegrationResponse)
-> Lens
     PutIntegrationResponse
     PutIntegrationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutIntegrationResponse' {Maybe Text
selectionPattern :: Maybe Text
$sel:selectionPattern:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe Text
selectionPattern} -> Maybe Text
selectionPattern) (\s :: PutIntegrationResponse
s@PutIntegrationResponse' {} Maybe Text
a -> PutIntegrationResponse
s {$sel:selectionPattern:PutIntegrationResponse' :: Maybe Text
selectionPattern = Maybe Text
a} :: PutIntegrationResponse)

-- | A key-value map specifying response parameters that are passed to the
-- method response from the back end. The key is a method response header
-- parameter name and the mapped value is an integration response header
-- value, a static value enclosed within a pair of single quotes, or a JSON
-- expression from the integration response body. The mapping key must
-- match the pattern of @method.response.header.{name}@, where @name@ is a
-- valid and unique header name. The mapped non-static value must match the
-- pattern of @integration.response.header.{name}@ or
-- @integration.response.body.{JSON-expression}@, where @name@ must be a
-- valid and unique response header name and @JSON-expression@ a valid JSON
-- expression without the @$@ prefix.
putIntegrationResponse_responseParameters :: Lens.Lens' PutIntegrationResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
putIntegrationResponse_responseParameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> PutIntegrationResponse -> f PutIntegrationResponse
putIntegrationResponse_responseParameters = (PutIntegrationResponse -> Maybe (HashMap Text Text))
-> (PutIntegrationResponse
    -> Maybe (HashMap Text Text) -> PutIntegrationResponse)
-> Lens
     PutIntegrationResponse
     PutIntegrationResponse
     (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 (\PutIntegrationResponse' {Maybe (HashMap Text Text)
responseParameters :: Maybe (HashMap Text Text)
$sel:responseParameters:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe (HashMap Text Text)
responseParameters} -> Maybe (HashMap Text Text)
responseParameters) (\s :: PutIntegrationResponse
s@PutIntegrationResponse' {} Maybe (HashMap Text Text)
a -> PutIntegrationResponse
s {$sel:responseParameters:PutIntegrationResponse' :: Maybe (HashMap Text Text)
responseParameters = Maybe (HashMap Text Text)
a} :: PutIntegrationResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> PutIntegrationResponse -> f PutIntegrationResponse)
-> ((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)))
-> PutIntegrationResponse
-> f PutIntegrationResponse
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

-- | [Required] The string identifier of the associated RestApi.
putIntegrationResponse_restApiId :: Lens.Lens' PutIntegrationResponse Prelude.Text
putIntegrationResponse_restApiId :: (Text -> f Text)
-> PutIntegrationResponse -> f PutIntegrationResponse
putIntegrationResponse_restApiId = (PutIntegrationResponse -> Text)
-> (PutIntegrationResponse -> Text -> PutIntegrationResponse)
-> Lens PutIntegrationResponse PutIntegrationResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutIntegrationResponse' {Text
restApiId :: Text
$sel:restApiId:PutIntegrationResponse' :: PutIntegrationResponse -> Text
restApiId} -> Text
restApiId) (\s :: PutIntegrationResponse
s@PutIntegrationResponse' {} Text
a -> PutIntegrationResponse
s {$sel:restApiId:PutIntegrationResponse' :: Text
restApiId = Text
a} :: PutIntegrationResponse)

-- | [Required] Specifies a put integration response request\'s resource
-- identifier.
putIntegrationResponse_resourceId :: Lens.Lens' PutIntegrationResponse Prelude.Text
putIntegrationResponse_resourceId :: (Text -> f Text)
-> PutIntegrationResponse -> f PutIntegrationResponse
putIntegrationResponse_resourceId = (PutIntegrationResponse -> Text)
-> (PutIntegrationResponse -> Text -> PutIntegrationResponse)
-> Lens PutIntegrationResponse PutIntegrationResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutIntegrationResponse' {Text
resourceId :: Text
$sel:resourceId:PutIntegrationResponse' :: PutIntegrationResponse -> Text
resourceId} -> Text
resourceId) (\s :: PutIntegrationResponse
s@PutIntegrationResponse' {} Text
a -> PutIntegrationResponse
s {$sel:resourceId:PutIntegrationResponse' :: Text
resourceId = Text
a} :: PutIntegrationResponse)

-- | [Required] Specifies a put integration response request\'s HTTP method.
putIntegrationResponse_httpMethod :: Lens.Lens' PutIntegrationResponse Prelude.Text
putIntegrationResponse_httpMethod :: (Text -> f Text)
-> PutIntegrationResponse -> f PutIntegrationResponse
putIntegrationResponse_httpMethod = (PutIntegrationResponse -> Text)
-> (PutIntegrationResponse -> Text -> PutIntegrationResponse)
-> Lens PutIntegrationResponse PutIntegrationResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutIntegrationResponse' {Text
httpMethod :: Text
$sel:httpMethod:PutIntegrationResponse' :: PutIntegrationResponse -> Text
httpMethod} -> Text
httpMethod) (\s :: PutIntegrationResponse
s@PutIntegrationResponse' {} Text
a -> PutIntegrationResponse
s {$sel:httpMethod:PutIntegrationResponse' :: Text
httpMethod = Text
a} :: PutIntegrationResponse)

-- | [Required] Specifies the status code that is used to map the integration
-- response to an existing MethodResponse.
putIntegrationResponse_statusCode :: Lens.Lens' PutIntegrationResponse Prelude.Text
putIntegrationResponse_statusCode :: (Text -> f Text)
-> PutIntegrationResponse -> f PutIntegrationResponse
putIntegrationResponse_statusCode = (PutIntegrationResponse -> Text)
-> (PutIntegrationResponse -> Text -> PutIntegrationResponse)
-> Lens PutIntegrationResponse PutIntegrationResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutIntegrationResponse' {Text
statusCode :: Text
$sel:statusCode:PutIntegrationResponse' :: PutIntegrationResponse -> Text
statusCode} -> Text
statusCode) (\s :: PutIntegrationResponse
s@PutIntegrationResponse' {} Text
a -> PutIntegrationResponse
s {$sel:statusCode:PutIntegrationResponse' :: Text
statusCode = Text
a} :: PutIntegrationResponse)

instance Core.AWSRequest PutIntegrationResponse where
  type
    AWSResponse PutIntegrationResponse =
      IntegrationResponse
  request :: PutIntegrationResponse -> Request PutIntegrationResponse
request = Service -> PutIntegrationResponse -> Request PutIntegrationResponse
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutIntegrationResponse
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutIntegrationResponse)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutIntegrationResponse))
-> Logger
-> Service
-> Proxy PutIntegrationResponse
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutIntegrationResponse)))
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 -> Object -> Either String IntegrationResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable PutIntegrationResponse

instance Prelude.NFData PutIntegrationResponse

instance Core.ToHeaders PutIntegrationResponse where
  toHeaders :: PutIntegrationResponse -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutIntegrationResponse -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

instance Core.ToJSON PutIntegrationResponse where
  toJSON :: PutIntegrationResponse -> Value
toJSON PutIntegrationResponse' {Maybe Text
Maybe (HashMap Text Text)
Maybe ContentHandlingStrategy
Text
statusCode :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
responseParameters :: Maybe (HashMap Text Text)
selectionPattern :: Maybe Text
responseTemplates :: Maybe (HashMap Text Text)
contentHandling :: Maybe ContentHandlingStrategy
$sel:statusCode:PutIntegrationResponse' :: PutIntegrationResponse -> Text
$sel:httpMethod:PutIntegrationResponse' :: PutIntegrationResponse -> Text
$sel:resourceId:PutIntegrationResponse' :: PutIntegrationResponse -> Text
$sel:restApiId:PutIntegrationResponse' :: PutIntegrationResponse -> Text
$sel:responseParameters:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe (HashMap Text Text)
$sel:selectionPattern:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe Text
$sel:responseTemplates:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe (HashMap Text Text)
$sel:contentHandling:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe ContentHandlingStrategy
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"contentHandling" Text -> ContentHandlingStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ContentHandlingStrategy -> Pair)
-> Maybe ContentHandlingStrategy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContentHandlingStrategy
contentHandling,
            (Text
"responseTemplates" 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)
responseTemplates,
            (Text
"selectionPattern" 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
selectionPattern,
            (Text
"responseParameters" 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)
responseParameters
          ]
      )

instance Core.ToPath PutIntegrationResponse where
  toPath :: PutIntegrationResponse -> ByteString
toPath PutIntegrationResponse' {Maybe Text
Maybe (HashMap Text Text)
Maybe ContentHandlingStrategy
Text
statusCode :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
responseParameters :: Maybe (HashMap Text Text)
selectionPattern :: Maybe Text
responseTemplates :: Maybe (HashMap Text Text)
contentHandling :: Maybe ContentHandlingStrategy
$sel:statusCode:PutIntegrationResponse' :: PutIntegrationResponse -> Text
$sel:httpMethod:PutIntegrationResponse' :: PutIntegrationResponse -> Text
$sel:resourceId:PutIntegrationResponse' :: PutIntegrationResponse -> Text
$sel:restApiId:PutIntegrationResponse' :: PutIntegrationResponse -> Text
$sel:responseParameters:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe (HashMap Text Text)
$sel:selectionPattern:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe Text
$sel:responseTemplates:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe (HashMap Text Text)
$sel:contentHandling:PutIntegrationResponse' :: PutIntegrationResponse -> Maybe ContentHandlingStrategy
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/restapis/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId,
        ByteString
"/resources/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceId,
        ByteString
"/methods/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
httpMethod,
        ByteString
"/integration/responses/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
statusCode
      ]

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