{-# 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.APIGateway.Types.Integration
-- 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.APIGateway.Types.Integration where

import Amazonka.APIGateway.Types.ConnectionType
import Amazonka.APIGateway.Types.ContentHandlingStrategy
import Amazonka.APIGateway.Types.IntegrationResponse
import Amazonka.APIGateway.Types.IntegrationType
import Amazonka.APIGateway.Types.TlsConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents an HTTP, HTTP_PROXY, AWS, AWS_PROXY, or Mock integration.
--
-- In the API Gateway console, the built-in Lambda integration is an AWS
-- integration.
--
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html Creating an API>
--
-- /See:/ 'newIntegration' smart constructor.
data Integration = Integration'
  { -- | Specifies the integration\'s HTTP method type.
    Integration -> Maybe Text
httpMethod :: Prelude.Maybe Prelude.Text,
    -- | Represents a map of Velocity templates that are applied on the request
    -- payload based on the value of the Content-Type header sent by the
    -- client. The content type value is the key in this map, and the template
    -- (as a String) is the value.
    Integration -> Maybe (HashMap Text Text)
requestTemplates :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Specifies the credentials required for the integration, if any. For AWS
    -- integrations, three options are available. To specify an IAM Role for
    -- API Gateway to assume, use the role\'s Amazon Resource Name (ARN). To
    -- require that the caller\'s identity be passed through from the request,
    -- specify the string @arn:aws:iam::\\*:user\/\\*@. To use resource-based
    -- permissions on supported AWS services, specify null.
    Integration -> Maybe Text
credentials :: Prelude.Maybe Prelude.Text,
    -- | The
    -- (<https://docs.aws.amazon.com/apigateway/api-reference/resource/vpc-link/#id id>)
    -- of the VpcLink used for the integration when @connectionType=VPC_LINK@
    -- and undefined, otherwise.
    Integration -> Maybe Text
connectionId :: Prelude.Maybe Prelude.Text,
    -- | A key-value map specifying request parameters that are passed from the
    -- method request to the back end. The key is an integration request
    -- parameter name and the associated value is a method request parameter
    -- value or static value that must be enclosed within single quotes and
    -- pre-encoded as required by the back end. The method request parameter
    -- value must match the pattern of @method.request.{location}.{name}@,
    -- where @location@ is @querystring@, @path@, or @header@ and @name@ must
    -- be a valid and unique method request parameter name.
    Integration -> Maybe (HashMap Text Text)
requestParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Specifies how to handle request payload content type conversions.
    -- Supported values are @CONVERT_TO_BINARY@ and @CONVERT_TO_TEXT@, with the
    -- following behaviors:
    --
    -- -   @CONVERT_TO_BINARY@: Converts a request payload from a
    --     Base64-encoded string to the corresponding binary blob.
    --
    -- -   @CONVERT_TO_TEXT@: Converts a request payload from a binary blob to
    --     a Base64-encoded string.
    --
    -- If this property is not defined, the request payload will be passed
    -- through from the method request to integration request without
    -- modification, provided that the @passthroughBehavior@ is configured to
    -- support payload pass-through.
    Integration -> Maybe ContentHandlingStrategy
contentHandling :: Prelude.Maybe ContentHandlingStrategy,
    -- | Specifies how the method request body of an unmapped content type will
    -- be passed through the integration request to the back end without
    -- transformation. A content type is unmapped if no mapping template is
    -- defined in the integration or the content type does not match any of the
    -- mapped content types, as specified in @requestTemplates@. The valid
    -- value is one of the following:
    --
    -- -   @WHEN_NO_MATCH@: passes the method request body through the
    --     integration request to the back end without transformation when the
    --     method request content type does not match any content type
    --     associated with the mapping templates defined in the integration
    --     request.
    -- -   @WHEN_NO_TEMPLATES@: passes the method request body through the
    --     integration request to the back end without transformation when no
    --     mapping template is defined in the integration request. If a
    --     template is defined when this option is selected, the method request
    --     of an unmapped content-type will be rejected with an HTTP
    --     @415 Unsupported Media Type@ response.
    -- -   @NEVER@: rejects the method request with an HTTP
    --     @415 Unsupported Media Type@ response when either the method request
    --     content type does not match any content type associated with the
    --     mapping templates defined in the integration request or no mapping
    --     template is defined in the integration request.
    Integration -> Maybe Text
passthroughBehavior :: Prelude.Maybe Prelude.Text,
    -- | Specifies Uniform Resource Identifier (URI) of the integration endpoint.
    --
    -- -   For @HTTP@ or @HTTP_PROXY@ integrations, the URI must be a fully
    --     formed, encoded HTTP(S) URL according to the
    --     <https://en.wikipedia.org/wiki/Uniform_Resource_Identifier RFC-3986 specification>,
    --     for either standard integration, where @connectionType@ is not
    --     @VPC_LINK@, or private integration, where @connectionType@ is
    --     @VPC_LINK@. For a private HTTP integration, the URI is not used for
    --     routing.
    --
    -- -   For @AWS@ or @AWS_PROXY@ integrations, the URI is of the form
    --     @arn:aws:apigateway:{region}:{subdomain.service|service}:path|action\/{service_api}@.
    --     Here, @{Region}@ is the API Gateway region (e.g., @us-east-1@);
    --     @{service}@ is the name of the integrated AWS service (e.g., @s3@);
    --     and @{subdomain}@ is a designated subdomain supported by certain AWS
    --     service for fast host-name lookup. @action@ can be used for an AWS
    --     service action-based API, using an
    --     @Action={name}&{p1}={v1}&p2={v2}...@ query string. The ensuing
    --     @{service_api}@ refers to a supported action @{name}@ plus any
    --     required input parameters. Alternatively, @path@ can be used for an
    --     AWS service path-based API. The ensuing @service_api@ refers to the
    --     path to an AWS service resource, including the region of the
    --     integrated AWS service, if applicable. For example, for integration
    --     with the S3 API of @GetObject@, the @uri@ can be either
    --     @arn:aws:apigateway:us-west-2:s3:action\/GetObject&Bucket={bucket}&Key={key}@
    --     or @arn:aws:apigateway:us-west-2:s3:path\/{bucket}\/{key}@
    Integration -> Maybe Text
uri :: Prelude.Maybe Prelude.Text,
    -- | Specifies the integration\'s responses.
    --
    -- ==== Example: Get integration responses of a method
    --
    -- ===== Request
    --
    -- > GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200 HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160607T191449Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160607/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
    --
    -- ===== Response
    --
    -- The successful response returns @200 OK@ status and a payload as
    -- follows:
    --
    -- > { "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true }, "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.Content-Type": "'application/xml'" }, "responseTemplates": { "application/json": "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n" }, "statusCode": "200" }
    --
    -- <https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html Creating an API>
    Integration -> Maybe (HashMap Text IntegrationResponse)
integrationResponses :: Prelude.Maybe (Prelude.HashMap Prelude.Text IntegrationResponse),
    -- | Specifies the TLS configuration for an integration.
    Integration -> Maybe TlsConfig
tlsConfig :: Prelude.Maybe TlsConfig,
    -- | Specifies a group of related cached parameters. By default, API Gateway
    -- uses the resource ID as the @cacheNamespace@. You can specify the same
    -- @cacheNamespace@ across resources to return the same cached data for
    -- requests to different resources.
    Integration -> Maybe Text
cacheNamespace :: Prelude.Maybe Prelude.Text,
    -- | Custom timeout between 50 and 29,000 milliseconds. The default value is
    -- 29,000 milliseconds or 29 seconds.
    Integration -> Maybe Int
timeoutInMillis :: Prelude.Maybe Prelude.Int,
    -- | Specifies an API method integration type. The valid value is one of the
    -- following:
    --
    -- -   @AWS@: for integrating the API method request with an AWS service
    --     action, including the Lambda function-invoking action. With the
    --     Lambda function-invoking action, this is referred to as the Lambda
    --     custom integration. With any other AWS service action, this is known
    --     as AWS integration.
    -- -   @AWS_PROXY@: for integrating the API method request with the Lambda
    --     function-invoking action with the client request passed through
    --     as-is. This integration is also referred to as the Lambda proxy
    --     integration.
    -- -   @HTTP@: for integrating the API method request with an HTTP
    --     endpoint, including a private HTTP endpoint within a VPC. This
    --     integration is also referred to as the HTTP custom integration.
    -- -   @HTTP_PROXY@: for integrating the API method request with an HTTP
    --     endpoint, including a private HTTP endpoint within a VPC, with the
    --     client request passed through as-is. This is also referred to as the
    --     HTTP proxy integration.
    -- -   @MOCK@: for integrating the API method request with API Gateway as a
    --     \"loop-back\" endpoint without invoking any backend.
    --
    -- For the HTTP and HTTP proxy integrations, each integration can specify a
    -- protocol (@http\/https@), port and path. Standard 80 and 443 ports are
    -- supported as well as custom ports above 1024. An HTTP or HTTP proxy
    -- integration with a @connectionType@ of @VPC_LINK@ is referred to as a
    -- private integration and uses a VpcLink to connect API Gateway to a
    -- network load balancer of a VPC.
    Integration -> Maybe IntegrationType
type' :: Prelude.Maybe IntegrationType,
    -- | The type of the network connection to the integration endpoint. The
    -- valid value is @INTERNET@ for connections through the public routable
    -- internet or @VPC_LINK@ for private connections between API Gateway and a
    -- network load balancer in a VPC. The default value is @INTERNET@.
    Integration -> Maybe ConnectionType
connectionType :: Prelude.Maybe ConnectionType,
    -- | A list of request parameters whose values API Gateway caches. To be
    -- valid values for @cacheKeyParameters@, these parameters must also be
    -- specified for Method @requestParameters@.
    Integration -> Maybe [Text]
cacheKeyParameters :: Prelude.Maybe [Prelude.Text]
  }
  deriving (Integration -> Integration -> Bool
(Integration -> Integration -> Bool)
-> (Integration -> Integration -> Bool) -> Eq Integration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Integration -> Integration -> Bool
$c/= :: Integration -> Integration -> Bool
== :: Integration -> Integration -> Bool
$c== :: Integration -> Integration -> Bool
Prelude.Eq, ReadPrec [Integration]
ReadPrec Integration
Int -> ReadS Integration
ReadS [Integration]
(Int -> ReadS Integration)
-> ReadS [Integration]
-> ReadPrec Integration
-> ReadPrec [Integration]
-> Read Integration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Integration]
$creadListPrec :: ReadPrec [Integration]
readPrec :: ReadPrec Integration
$creadPrec :: ReadPrec Integration
readList :: ReadS [Integration]
$creadList :: ReadS [Integration]
readsPrec :: Int -> ReadS Integration
$creadsPrec :: Int -> ReadS Integration
Prelude.Read, Int -> Integration -> ShowS
[Integration] -> ShowS
Integration -> String
(Int -> Integration -> ShowS)
-> (Integration -> String)
-> ([Integration] -> ShowS)
-> Show Integration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Integration] -> ShowS
$cshowList :: [Integration] -> ShowS
show :: Integration -> String
$cshow :: Integration -> String
showsPrec :: Int -> Integration -> ShowS
$cshowsPrec :: Int -> Integration -> ShowS
Prelude.Show, (forall x. Integration -> Rep Integration x)
-> (forall x. Rep Integration x -> Integration)
-> Generic Integration
forall x. Rep Integration x -> Integration
forall x. Integration -> Rep Integration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Integration x -> Integration
$cfrom :: forall x. Integration -> Rep Integration x
Prelude.Generic)

-- |
-- Create a value of 'Integration' 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:
--
-- 'httpMethod', 'integration_httpMethod' - Specifies the integration\'s HTTP method type.
--
-- 'requestTemplates', 'integration_requestTemplates' - Represents a map of Velocity templates that are applied on the request
-- payload based on the value of the Content-Type header sent by the
-- client. The content type value is the key in this map, and the template
-- (as a String) is the value.
--
-- 'credentials', 'integration_credentials' - Specifies the credentials required for the integration, if any. For AWS
-- integrations, three options are available. To specify an IAM Role for
-- API Gateway to assume, use the role\'s Amazon Resource Name (ARN). To
-- require that the caller\'s identity be passed through from the request,
-- specify the string @arn:aws:iam::\\*:user\/\\*@. To use resource-based
-- permissions on supported AWS services, specify null.
--
-- 'connectionId', 'integration_connectionId' - The
-- (<https://docs.aws.amazon.com/apigateway/api-reference/resource/vpc-link/#id id>)
-- of the VpcLink used for the integration when @connectionType=VPC_LINK@
-- and undefined, otherwise.
--
-- 'requestParameters', 'integration_requestParameters' - A key-value map specifying request parameters that are passed from the
-- method request to the back end. The key is an integration request
-- parameter name and the associated value is a method request parameter
-- value or static value that must be enclosed within single quotes and
-- pre-encoded as required by the back end. The method request parameter
-- value must match the pattern of @method.request.{location}.{name}@,
-- where @location@ is @querystring@, @path@, or @header@ and @name@ must
-- be a valid and unique method request parameter name.
--
-- 'contentHandling', 'integration_contentHandling' - Specifies how to handle request payload content type conversions.
-- Supported values are @CONVERT_TO_BINARY@ and @CONVERT_TO_TEXT@, with the
-- following behaviors:
--
-- -   @CONVERT_TO_BINARY@: Converts a request payload from a
--     Base64-encoded string to the corresponding binary blob.
--
-- -   @CONVERT_TO_TEXT@: Converts a request payload from a binary blob to
--     a Base64-encoded string.
--
-- If this property is not defined, the request payload will be passed
-- through from the method request to integration request without
-- modification, provided that the @passthroughBehavior@ is configured to
-- support payload pass-through.
--
-- 'passthroughBehavior', 'integration_passthroughBehavior' - Specifies how the method request body of an unmapped content type will
-- be passed through the integration request to the back end without
-- transformation. A content type is unmapped if no mapping template is
-- defined in the integration or the content type does not match any of the
-- mapped content types, as specified in @requestTemplates@. The valid
-- value is one of the following:
--
-- -   @WHEN_NO_MATCH@: passes the method request body through the
--     integration request to the back end without transformation when the
--     method request content type does not match any content type
--     associated with the mapping templates defined in the integration
--     request.
-- -   @WHEN_NO_TEMPLATES@: passes the method request body through the
--     integration request to the back end without transformation when no
--     mapping template is defined in the integration request. If a
--     template is defined when this option is selected, the method request
--     of an unmapped content-type will be rejected with an HTTP
--     @415 Unsupported Media Type@ response.
-- -   @NEVER@: rejects the method request with an HTTP
--     @415 Unsupported Media Type@ response when either the method request
--     content type does not match any content type associated with the
--     mapping templates defined in the integration request or no mapping
--     template is defined in the integration request.
--
-- 'uri', 'integration_uri' - Specifies Uniform Resource Identifier (URI) of the integration endpoint.
--
-- -   For @HTTP@ or @HTTP_PROXY@ integrations, the URI must be a fully
--     formed, encoded HTTP(S) URL according to the
--     <https://en.wikipedia.org/wiki/Uniform_Resource_Identifier RFC-3986 specification>,
--     for either standard integration, where @connectionType@ is not
--     @VPC_LINK@, or private integration, where @connectionType@ is
--     @VPC_LINK@. For a private HTTP integration, the URI is not used for
--     routing.
--
-- -   For @AWS@ or @AWS_PROXY@ integrations, the URI is of the form
--     @arn:aws:apigateway:{region}:{subdomain.service|service}:path|action\/{service_api}@.
--     Here, @{Region}@ is the API Gateway region (e.g., @us-east-1@);
--     @{service}@ is the name of the integrated AWS service (e.g., @s3@);
--     and @{subdomain}@ is a designated subdomain supported by certain AWS
--     service for fast host-name lookup. @action@ can be used for an AWS
--     service action-based API, using an
--     @Action={name}&{p1}={v1}&p2={v2}...@ query string. The ensuing
--     @{service_api}@ refers to a supported action @{name}@ plus any
--     required input parameters. Alternatively, @path@ can be used for an
--     AWS service path-based API. The ensuing @service_api@ refers to the
--     path to an AWS service resource, including the region of the
--     integrated AWS service, if applicable. For example, for integration
--     with the S3 API of @GetObject@, the @uri@ can be either
--     @arn:aws:apigateway:us-west-2:s3:action\/GetObject&Bucket={bucket}&Key={key}@
--     or @arn:aws:apigateway:us-west-2:s3:path\/{bucket}\/{key}@
--
-- 'integrationResponses', 'integration_integrationResponses' - Specifies the integration\'s responses.
--
-- ==== Example: Get integration responses of a method
--
-- ===== Request
--
-- > GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200 HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160607T191449Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160607/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- The successful response returns @200 OK@ status and a payload as
-- follows:
--
-- > { "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true }, "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.Content-Type": "'application/xml'" }, "responseTemplates": { "application/json": "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n" }, "statusCode": "200" }
--
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html Creating an API>
--
-- 'tlsConfig', 'integration_tlsConfig' - Specifies the TLS configuration for an integration.
--
-- 'cacheNamespace', 'integration_cacheNamespace' - Specifies a group of related cached parameters. By default, API Gateway
-- uses the resource ID as the @cacheNamespace@. You can specify the same
-- @cacheNamespace@ across resources to return the same cached data for
-- requests to different resources.
--
-- 'timeoutInMillis', 'integration_timeoutInMillis' - Custom timeout between 50 and 29,000 milliseconds. The default value is
-- 29,000 milliseconds or 29 seconds.
--
-- 'type'', 'integration_type' - Specifies an API method integration type. The valid value is one of the
-- following:
--
-- -   @AWS@: for integrating the API method request with an AWS service
--     action, including the Lambda function-invoking action. With the
--     Lambda function-invoking action, this is referred to as the Lambda
--     custom integration. With any other AWS service action, this is known
--     as AWS integration.
-- -   @AWS_PROXY@: for integrating the API method request with the Lambda
--     function-invoking action with the client request passed through
--     as-is. This integration is also referred to as the Lambda proxy
--     integration.
-- -   @HTTP@: for integrating the API method request with an HTTP
--     endpoint, including a private HTTP endpoint within a VPC. This
--     integration is also referred to as the HTTP custom integration.
-- -   @HTTP_PROXY@: for integrating the API method request with an HTTP
--     endpoint, including a private HTTP endpoint within a VPC, with the
--     client request passed through as-is. This is also referred to as the
--     HTTP proxy integration.
-- -   @MOCK@: for integrating the API method request with API Gateway as a
--     \"loop-back\" endpoint without invoking any backend.
--
-- For the HTTP and HTTP proxy integrations, each integration can specify a
-- protocol (@http\/https@), port and path. Standard 80 and 443 ports are
-- supported as well as custom ports above 1024. An HTTP or HTTP proxy
-- integration with a @connectionType@ of @VPC_LINK@ is referred to as a
-- private integration and uses a VpcLink to connect API Gateway to a
-- network load balancer of a VPC.
--
-- 'connectionType', 'integration_connectionType' - The type of the network connection to the integration endpoint. The
-- valid value is @INTERNET@ for connections through the public routable
-- internet or @VPC_LINK@ for private connections between API Gateway and a
-- network load balancer in a VPC. The default value is @INTERNET@.
--
-- 'cacheKeyParameters', 'integration_cacheKeyParameters' - A list of request parameters whose values API Gateway caches. To be
-- valid values for @cacheKeyParameters@, these parameters must also be
-- specified for Method @requestParameters@.
newIntegration ::
  Integration
newIntegration :: Integration
newIntegration =
  Integration' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe ContentHandlingStrategy
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text IntegrationResponse)
-> Maybe TlsConfig
-> Maybe Text
-> Maybe Int
-> Maybe IntegrationType
-> Maybe ConnectionType
-> Maybe [Text]
-> Integration
Integration'
    { $sel:httpMethod:Integration' :: Maybe Text
httpMethod = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:requestTemplates:Integration' :: Maybe (HashMap Text Text)
requestTemplates = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:credentials:Integration' :: Maybe Text
credentials = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionId:Integration' :: Maybe Text
connectionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:requestParameters:Integration' :: Maybe (HashMap Text Text)
requestParameters = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:contentHandling:Integration' :: Maybe ContentHandlingStrategy
contentHandling = Maybe ContentHandlingStrategy
forall a. Maybe a
Prelude.Nothing,
      $sel:passthroughBehavior:Integration' :: Maybe Text
passthroughBehavior = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:uri:Integration' :: Maybe Text
uri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:integrationResponses:Integration' :: Maybe (HashMap Text IntegrationResponse)
integrationResponses = Maybe (HashMap Text IntegrationResponse)
forall a. Maybe a
Prelude.Nothing,
      $sel:tlsConfig:Integration' :: Maybe TlsConfig
tlsConfig = Maybe TlsConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheNamespace:Integration' :: Maybe Text
cacheNamespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeoutInMillis:Integration' :: Maybe Int
timeoutInMillis = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:type':Integration' :: Maybe IntegrationType
type' = Maybe IntegrationType
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionType:Integration' :: Maybe ConnectionType
connectionType = Maybe ConnectionType
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheKeyParameters:Integration' :: Maybe [Text]
cacheKeyParameters = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the integration\'s HTTP method type.
integration_httpMethod :: Lens.Lens' Integration (Prelude.Maybe Prelude.Text)
integration_httpMethod :: (Maybe Text -> f (Maybe Text)) -> Integration -> f Integration
integration_httpMethod = (Integration -> Maybe Text)
-> (Integration -> Maybe Text -> Integration)
-> Lens Integration Integration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe Text
httpMethod :: Maybe Text
$sel:httpMethod:Integration' :: Integration -> Maybe Text
httpMethod} -> Maybe Text
httpMethod) (\s :: Integration
s@Integration' {} Maybe Text
a -> Integration
s {$sel:httpMethod:Integration' :: Maybe Text
httpMethod = Maybe Text
a} :: Integration)

-- | Represents a map of Velocity templates that are applied on the request
-- payload based on the value of the Content-Type header sent by the
-- client. The content type value is the key in this map, and the template
-- (as a String) is the value.
integration_requestTemplates :: Lens.Lens' Integration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
integration_requestTemplates :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Integration -> f Integration
integration_requestTemplates = (Integration -> Maybe (HashMap Text Text))
-> (Integration -> Maybe (HashMap Text Text) -> Integration)
-> Lens
     Integration
     Integration
     (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 (\Integration' {Maybe (HashMap Text Text)
requestTemplates :: Maybe (HashMap Text Text)
$sel:requestTemplates:Integration' :: Integration -> Maybe (HashMap Text Text)
requestTemplates} -> Maybe (HashMap Text Text)
requestTemplates) (\s :: Integration
s@Integration' {} Maybe (HashMap Text Text)
a -> Integration
s {$sel:requestTemplates:Integration' :: Maybe (HashMap Text Text)
requestTemplates = Maybe (HashMap Text Text)
a} :: Integration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Integration -> f Integration)
-> ((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)))
-> Integration
-> f Integration
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 credentials required for the integration, if any. For AWS
-- integrations, three options are available. To specify an IAM Role for
-- API Gateway to assume, use the role\'s Amazon Resource Name (ARN). To
-- require that the caller\'s identity be passed through from the request,
-- specify the string @arn:aws:iam::\\*:user\/\\*@. To use resource-based
-- permissions on supported AWS services, specify null.
integration_credentials :: Lens.Lens' Integration (Prelude.Maybe Prelude.Text)
integration_credentials :: (Maybe Text -> f (Maybe Text)) -> Integration -> f Integration
integration_credentials = (Integration -> Maybe Text)
-> (Integration -> Maybe Text -> Integration)
-> Lens Integration Integration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe Text
credentials :: Maybe Text
$sel:credentials:Integration' :: Integration -> Maybe Text
credentials} -> Maybe Text
credentials) (\s :: Integration
s@Integration' {} Maybe Text
a -> Integration
s {$sel:credentials:Integration' :: Maybe Text
credentials = Maybe Text
a} :: Integration)

-- | The
-- (<https://docs.aws.amazon.com/apigateway/api-reference/resource/vpc-link/#id id>)
-- of the VpcLink used for the integration when @connectionType=VPC_LINK@
-- and undefined, otherwise.
integration_connectionId :: Lens.Lens' Integration (Prelude.Maybe Prelude.Text)
integration_connectionId :: (Maybe Text -> f (Maybe Text)) -> Integration -> f Integration
integration_connectionId = (Integration -> Maybe Text)
-> (Integration -> Maybe Text -> Integration)
-> Lens Integration Integration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe Text
connectionId :: Maybe Text
$sel:connectionId:Integration' :: Integration -> Maybe Text
connectionId} -> Maybe Text
connectionId) (\s :: Integration
s@Integration' {} Maybe Text
a -> Integration
s {$sel:connectionId:Integration' :: Maybe Text
connectionId = Maybe Text
a} :: Integration)

-- | A key-value map specifying request parameters that are passed from the
-- method request to the back end. The key is an integration request
-- parameter name and the associated value is a method request parameter
-- value or static value that must be enclosed within single quotes and
-- pre-encoded as required by the back end. The method request parameter
-- value must match the pattern of @method.request.{location}.{name}@,
-- where @location@ is @querystring@, @path@, or @header@ and @name@ must
-- be a valid and unique method request parameter name.
integration_requestParameters :: Lens.Lens' Integration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
integration_requestParameters :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Integration -> f Integration
integration_requestParameters = (Integration -> Maybe (HashMap Text Text))
-> (Integration -> Maybe (HashMap Text Text) -> Integration)
-> Lens
     Integration
     Integration
     (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 (\Integration' {Maybe (HashMap Text Text)
requestParameters :: Maybe (HashMap Text Text)
$sel:requestParameters:Integration' :: Integration -> Maybe (HashMap Text Text)
requestParameters} -> Maybe (HashMap Text Text)
requestParameters) (\s :: Integration
s@Integration' {} Maybe (HashMap Text Text)
a -> Integration
s {$sel:requestParameters:Integration' :: Maybe (HashMap Text Text)
requestParameters = Maybe (HashMap Text Text)
a} :: Integration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Integration -> f Integration)
-> ((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)))
-> Integration
-> f Integration
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 how to handle request payload content type conversions.
-- Supported values are @CONVERT_TO_BINARY@ and @CONVERT_TO_TEXT@, with the
-- following behaviors:
--
-- -   @CONVERT_TO_BINARY@: Converts a request payload from a
--     Base64-encoded string to the corresponding binary blob.
--
-- -   @CONVERT_TO_TEXT@: Converts a request payload from a binary blob to
--     a Base64-encoded string.
--
-- If this property is not defined, the request payload will be passed
-- through from the method request to integration request without
-- modification, provided that the @passthroughBehavior@ is configured to
-- support payload pass-through.
integration_contentHandling :: Lens.Lens' Integration (Prelude.Maybe ContentHandlingStrategy)
integration_contentHandling :: (Maybe ContentHandlingStrategy
 -> f (Maybe ContentHandlingStrategy))
-> Integration -> f Integration
integration_contentHandling = (Integration -> Maybe ContentHandlingStrategy)
-> (Integration -> Maybe ContentHandlingStrategy -> Integration)
-> Lens
     Integration
     Integration
     (Maybe ContentHandlingStrategy)
     (Maybe ContentHandlingStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe ContentHandlingStrategy
contentHandling :: Maybe ContentHandlingStrategy
$sel:contentHandling:Integration' :: Integration -> Maybe ContentHandlingStrategy
contentHandling} -> Maybe ContentHandlingStrategy
contentHandling) (\s :: Integration
s@Integration' {} Maybe ContentHandlingStrategy
a -> Integration
s {$sel:contentHandling:Integration' :: Maybe ContentHandlingStrategy
contentHandling = Maybe ContentHandlingStrategy
a} :: Integration)

-- | Specifies how the method request body of an unmapped content type will
-- be passed through the integration request to the back end without
-- transformation. A content type is unmapped if no mapping template is
-- defined in the integration or the content type does not match any of the
-- mapped content types, as specified in @requestTemplates@. The valid
-- value is one of the following:
--
-- -   @WHEN_NO_MATCH@: passes the method request body through the
--     integration request to the back end without transformation when the
--     method request content type does not match any content type
--     associated with the mapping templates defined in the integration
--     request.
-- -   @WHEN_NO_TEMPLATES@: passes the method request body through the
--     integration request to the back end without transformation when no
--     mapping template is defined in the integration request. If a
--     template is defined when this option is selected, the method request
--     of an unmapped content-type will be rejected with an HTTP
--     @415 Unsupported Media Type@ response.
-- -   @NEVER@: rejects the method request with an HTTP
--     @415 Unsupported Media Type@ response when either the method request
--     content type does not match any content type associated with the
--     mapping templates defined in the integration request or no mapping
--     template is defined in the integration request.
integration_passthroughBehavior :: Lens.Lens' Integration (Prelude.Maybe Prelude.Text)
integration_passthroughBehavior :: (Maybe Text -> f (Maybe Text)) -> Integration -> f Integration
integration_passthroughBehavior = (Integration -> Maybe Text)
-> (Integration -> Maybe Text -> Integration)
-> Lens Integration Integration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe Text
passthroughBehavior :: Maybe Text
$sel:passthroughBehavior:Integration' :: Integration -> Maybe Text
passthroughBehavior} -> Maybe Text
passthroughBehavior) (\s :: Integration
s@Integration' {} Maybe Text
a -> Integration
s {$sel:passthroughBehavior:Integration' :: Maybe Text
passthroughBehavior = Maybe Text
a} :: Integration)

-- | Specifies Uniform Resource Identifier (URI) of the integration endpoint.
--
-- -   For @HTTP@ or @HTTP_PROXY@ integrations, the URI must be a fully
--     formed, encoded HTTP(S) URL according to the
--     <https://en.wikipedia.org/wiki/Uniform_Resource_Identifier RFC-3986 specification>,
--     for either standard integration, where @connectionType@ is not
--     @VPC_LINK@, or private integration, where @connectionType@ is
--     @VPC_LINK@. For a private HTTP integration, the URI is not used for
--     routing.
--
-- -   For @AWS@ or @AWS_PROXY@ integrations, the URI is of the form
--     @arn:aws:apigateway:{region}:{subdomain.service|service}:path|action\/{service_api}@.
--     Here, @{Region}@ is the API Gateway region (e.g., @us-east-1@);
--     @{service}@ is the name of the integrated AWS service (e.g., @s3@);
--     and @{subdomain}@ is a designated subdomain supported by certain AWS
--     service for fast host-name lookup. @action@ can be used for an AWS
--     service action-based API, using an
--     @Action={name}&{p1}={v1}&p2={v2}...@ query string. The ensuing
--     @{service_api}@ refers to a supported action @{name}@ plus any
--     required input parameters. Alternatively, @path@ can be used for an
--     AWS service path-based API. The ensuing @service_api@ refers to the
--     path to an AWS service resource, including the region of the
--     integrated AWS service, if applicable. For example, for integration
--     with the S3 API of @GetObject@, the @uri@ can be either
--     @arn:aws:apigateway:us-west-2:s3:action\/GetObject&Bucket={bucket}&Key={key}@
--     or @arn:aws:apigateway:us-west-2:s3:path\/{bucket}\/{key}@
integration_uri :: Lens.Lens' Integration (Prelude.Maybe Prelude.Text)
integration_uri :: (Maybe Text -> f (Maybe Text)) -> Integration -> f Integration
integration_uri = (Integration -> Maybe Text)
-> (Integration -> Maybe Text -> Integration)
-> Lens Integration Integration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe Text
uri :: Maybe Text
$sel:uri:Integration' :: Integration -> Maybe Text
uri} -> Maybe Text
uri) (\s :: Integration
s@Integration' {} Maybe Text
a -> Integration
s {$sel:uri:Integration' :: Maybe Text
uri = Maybe Text
a} :: Integration)

-- | Specifies the integration\'s responses.
--
-- ==== Example: Get integration responses of a method
--
-- ===== Request
--
-- > GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200 HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160607T191449Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160607/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- The successful response returns @200 OK@ status and a payload as
-- follows:
--
-- > { "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true }, "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.Content-Type": "'application/xml'" }, "responseTemplates": { "application/json": "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n" }, "statusCode": "200" }
--
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html Creating an API>
integration_integrationResponses :: Lens.Lens' Integration (Prelude.Maybe (Prelude.HashMap Prelude.Text IntegrationResponse))
integration_integrationResponses :: (Maybe (HashMap Text IntegrationResponse)
 -> f (Maybe (HashMap Text IntegrationResponse)))
-> Integration -> f Integration
integration_integrationResponses = (Integration -> Maybe (HashMap Text IntegrationResponse))
-> (Integration
    -> Maybe (HashMap Text IntegrationResponse) -> Integration)
-> Lens
     Integration
     Integration
     (Maybe (HashMap Text IntegrationResponse))
     (Maybe (HashMap Text IntegrationResponse))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe (HashMap Text IntegrationResponse)
integrationResponses :: Maybe (HashMap Text IntegrationResponse)
$sel:integrationResponses:Integration' :: Integration -> Maybe (HashMap Text IntegrationResponse)
integrationResponses} -> Maybe (HashMap Text IntegrationResponse)
integrationResponses) (\s :: Integration
s@Integration' {} Maybe (HashMap Text IntegrationResponse)
a -> Integration
s {$sel:integrationResponses:Integration' :: Maybe (HashMap Text IntegrationResponse)
integrationResponses = Maybe (HashMap Text IntegrationResponse)
a} :: Integration) ((Maybe (HashMap Text IntegrationResponse)
  -> f (Maybe (HashMap Text IntegrationResponse)))
 -> Integration -> f Integration)
-> ((Maybe (HashMap Text IntegrationResponse)
     -> f (Maybe (HashMap Text IntegrationResponse)))
    -> Maybe (HashMap Text IntegrationResponse)
    -> f (Maybe (HashMap Text IntegrationResponse)))
-> (Maybe (HashMap Text IntegrationResponse)
    -> f (Maybe (HashMap Text IntegrationResponse)))
-> Integration
-> f Integration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text IntegrationResponse)
  (HashMap Text IntegrationResponse)
  (HashMap Text IntegrationResponse)
  (HashMap Text IntegrationResponse)
-> Iso
     (Maybe (HashMap Text IntegrationResponse))
     (Maybe (HashMap Text IntegrationResponse))
     (Maybe (HashMap Text IntegrationResponse))
     (Maybe (HashMap Text IntegrationResponse))
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 IntegrationResponse)
  (HashMap Text IntegrationResponse)
  (HashMap Text IntegrationResponse)
  (HashMap Text IntegrationResponse)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the TLS configuration for an integration.
integration_tlsConfig :: Lens.Lens' Integration (Prelude.Maybe TlsConfig)
integration_tlsConfig :: (Maybe TlsConfig -> f (Maybe TlsConfig))
-> Integration -> f Integration
integration_tlsConfig = (Integration -> Maybe TlsConfig)
-> (Integration -> Maybe TlsConfig -> Integration)
-> Lens Integration Integration (Maybe TlsConfig) (Maybe TlsConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe TlsConfig
tlsConfig :: Maybe TlsConfig
$sel:tlsConfig:Integration' :: Integration -> Maybe TlsConfig
tlsConfig} -> Maybe TlsConfig
tlsConfig) (\s :: Integration
s@Integration' {} Maybe TlsConfig
a -> Integration
s {$sel:tlsConfig:Integration' :: Maybe TlsConfig
tlsConfig = Maybe TlsConfig
a} :: Integration)

-- | Specifies a group of related cached parameters. By default, API Gateway
-- uses the resource ID as the @cacheNamespace@. You can specify the same
-- @cacheNamespace@ across resources to return the same cached data for
-- requests to different resources.
integration_cacheNamespace :: Lens.Lens' Integration (Prelude.Maybe Prelude.Text)
integration_cacheNamespace :: (Maybe Text -> f (Maybe Text)) -> Integration -> f Integration
integration_cacheNamespace = (Integration -> Maybe Text)
-> (Integration -> Maybe Text -> Integration)
-> Lens Integration Integration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe Text
cacheNamespace :: Maybe Text
$sel:cacheNamespace:Integration' :: Integration -> Maybe Text
cacheNamespace} -> Maybe Text
cacheNamespace) (\s :: Integration
s@Integration' {} Maybe Text
a -> Integration
s {$sel:cacheNamespace:Integration' :: Maybe Text
cacheNamespace = Maybe Text
a} :: Integration)

-- | Custom timeout between 50 and 29,000 milliseconds. The default value is
-- 29,000 milliseconds or 29 seconds.
integration_timeoutInMillis :: Lens.Lens' Integration (Prelude.Maybe Prelude.Int)
integration_timeoutInMillis :: (Maybe Int -> f (Maybe Int)) -> Integration -> f Integration
integration_timeoutInMillis = (Integration -> Maybe Int)
-> (Integration -> Maybe Int -> Integration)
-> Lens Integration Integration (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe Int
timeoutInMillis :: Maybe Int
$sel:timeoutInMillis:Integration' :: Integration -> Maybe Int
timeoutInMillis} -> Maybe Int
timeoutInMillis) (\s :: Integration
s@Integration' {} Maybe Int
a -> Integration
s {$sel:timeoutInMillis:Integration' :: Maybe Int
timeoutInMillis = Maybe Int
a} :: Integration)

-- | Specifies an API method integration type. The valid value is one of the
-- following:
--
-- -   @AWS@: for integrating the API method request with an AWS service
--     action, including the Lambda function-invoking action. With the
--     Lambda function-invoking action, this is referred to as the Lambda
--     custom integration. With any other AWS service action, this is known
--     as AWS integration.
-- -   @AWS_PROXY@: for integrating the API method request with the Lambda
--     function-invoking action with the client request passed through
--     as-is. This integration is also referred to as the Lambda proxy
--     integration.
-- -   @HTTP@: for integrating the API method request with an HTTP
--     endpoint, including a private HTTP endpoint within a VPC. This
--     integration is also referred to as the HTTP custom integration.
-- -   @HTTP_PROXY@: for integrating the API method request with an HTTP
--     endpoint, including a private HTTP endpoint within a VPC, with the
--     client request passed through as-is. This is also referred to as the
--     HTTP proxy integration.
-- -   @MOCK@: for integrating the API method request with API Gateway as a
--     \"loop-back\" endpoint without invoking any backend.
--
-- For the HTTP and HTTP proxy integrations, each integration can specify a
-- protocol (@http\/https@), port and path. Standard 80 and 443 ports are
-- supported as well as custom ports above 1024. An HTTP or HTTP proxy
-- integration with a @connectionType@ of @VPC_LINK@ is referred to as a
-- private integration and uses a VpcLink to connect API Gateway to a
-- network load balancer of a VPC.
integration_type :: Lens.Lens' Integration (Prelude.Maybe IntegrationType)
integration_type :: (Maybe IntegrationType -> f (Maybe IntegrationType))
-> Integration -> f Integration
integration_type = (Integration -> Maybe IntegrationType)
-> (Integration -> Maybe IntegrationType -> Integration)
-> Lens
     Integration
     Integration
     (Maybe IntegrationType)
     (Maybe IntegrationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe IntegrationType
type' :: Maybe IntegrationType
$sel:type':Integration' :: Integration -> Maybe IntegrationType
type'} -> Maybe IntegrationType
type') (\s :: Integration
s@Integration' {} Maybe IntegrationType
a -> Integration
s {$sel:type':Integration' :: Maybe IntegrationType
type' = Maybe IntegrationType
a} :: Integration)

-- | The type of the network connection to the integration endpoint. The
-- valid value is @INTERNET@ for connections through the public routable
-- internet or @VPC_LINK@ for private connections between API Gateway and a
-- network load balancer in a VPC. The default value is @INTERNET@.
integration_connectionType :: Lens.Lens' Integration (Prelude.Maybe ConnectionType)
integration_connectionType :: (Maybe ConnectionType -> f (Maybe ConnectionType))
-> Integration -> f Integration
integration_connectionType = (Integration -> Maybe ConnectionType)
-> (Integration -> Maybe ConnectionType -> Integration)
-> Lens
     Integration
     Integration
     (Maybe ConnectionType)
     (Maybe ConnectionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe ConnectionType
connectionType :: Maybe ConnectionType
$sel:connectionType:Integration' :: Integration -> Maybe ConnectionType
connectionType} -> Maybe ConnectionType
connectionType) (\s :: Integration
s@Integration' {} Maybe ConnectionType
a -> Integration
s {$sel:connectionType:Integration' :: Maybe ConnectionType
connectionType = Maybe ConnectionType
a} :: Integration)

-- | A list of request parameters whose values API Gateway caches. To be
-- valid values for @cacheKeyParameters@, these parameters must also be
-- specified for Method @requestParameters@.
integration_cacheKeyParameters :: Lens.Lens' Integration (Prelude.Maybe [Prelude.Text])
integration_cacheKeyParameters :: (Maybe [Text] -> f (Maybe [Text])) -> Integration -> f Integration
integration_cacheKeyParameters = (Integration -> Maybe [Text])
-> (Integration -> Maybe [Text] -> Integration)
-> Lens Integration Integration (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Integration' {Maybe [Text]
cacheKeyParameters :: Maybe [Text]
$sel:cacheKeyParameters:Integration' :: Integration -> Maybe [Text]
cacheKeyParameters} -> Maybe [Text]
cacheKeyParameters) (\s :: Integration
s@Integration' {} Maybe [Text]
a -> Integration
s {$sel:cacheKeyParameters:Integration' :: Maybe [Text]
cacheKeyParameters = Maybe [Text]
a} :: Integration) ((Maybe [Text] -> f (Maybe [Text]))
 -> Integration -> f Integration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Integration
-> f Integration
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

instance Core.FromJSON Integration where
  parseJSON :: Value -> Parser Integration
parseJSON =
    String
-> (Object -> Parser Integration) -> Value -> Parser Integration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Integration"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe ContentHandlingStrategy
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text IntegrationResponse)
-> Maybe TlsConfig
-> Maybe Text
-> Maybe Int
-> Maybe IntegrationType
-> Maybe ConnectionType
-> Maybe [Text]
-> Integration
Integration'
            (Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe ContentHandlingStrategy
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text IntegrationResponse)
 -> Maybe TlsConfig
 -> Maybe Text
 -> Maybe Int
 -> Maybe IntegrationType
 -> Maybe ConnectionType
 -> Maybe [Text]
 -> Integration)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe ContentHandlingStrategy
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text IntegrationResponse)
      -> Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
forall (f :: * -> *) a b. Functor 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
"httpMethod")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe ContentHandlingStrategy
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text IntegrationResponse)
   -> Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe ContentHandlingStrategy
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text IntegrationResponse)
      -> Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
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
"requestTemplates"
                            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 Text
   -> Maybe (HashMap Text Text)
   -> Maybe ContentHandlingStrategy
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text IntegrationResponse)
   -> Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe ContentHandlingStrategy
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text IntegrationResponse)
      -> Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
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
"credentials")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe ContentHandlingStrategy
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text IntegrationResponse)
   -> Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe ContentHandlingStrategy
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text IntegrationResponse)
      -> Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
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
"connectionId")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe ContentHandlingStrategy
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text IntegrationResponse)
   -> Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe ContentHandlingStrategy
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text IntegrationResponse)
      -> Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
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
"requestParameters"
                            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 ContentHandlingStrategy
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text IntegrationResponse)
   -> Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe ContentHandlingStrategy)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text IntegrationResponse)
      -> Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ContentHandlingStrategy)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"contentHandling")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text IntegrationResponse)
   -> Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text IntegrationResponse)
      -> Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
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
"passthroughBehavior")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text IntegrationResponse)
   -> Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text IntegrationResponse)
      -> Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
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
"uri")
            Parser
  (Maybe (HashMap Text IntegrationResponse)
   -> Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe (HashMap Text IntegrationResponse))
-> Parser
     (Maybe TlsConfig
      -> Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Parser (Maybe (Maybe (HashMap Text IntegrationResponse)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"integrationResponses"
                            Parser (Maybe (Maybe (HashMap Text IntegrationResponse)))
-> Maybe (HashMap Text IntegrationResponse)
-> Parser (Maybe (HashMap Text IntegrationResponse))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text IntegrationResponse)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe TlsConfig
   -> Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe TlsConfig)
-> Parser
     (Maybe Text
      -> Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TlsConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tlsConfig")
            Parser
  (Maybe Text
   -> Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe Text)
-> Parser
     (Maybe Int
      -> Maybe IntegrationType
      -> Maybe ConnectionType
      -> Maybe [Text]
      -> Integration)
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
"cacheNamespace")
            Parser
  (Maybe Int
   -> Maybe IntegrationType
   -> Maybe ConnectionType
   -> Maybe [Text]
   -> Integration)
-> Parser (Maybe Int)
-> Parser
     (Maybe IntegrationType
      -> Maybe ConnectionType -> Maybe [Text] -> Integration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"timeoutInMillis")
            Parser
  (Maybe IntegrationType
   -> Maybe ConnectionType -> Maybe [Text] -> Integration)
-> Parser (Maybe IntegrationType)
-> Parser (Maybe ConnectionType -> Maybe [Text] -> Integration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IntegrationType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
            Parser (Maybe ConnectionType -> Maybe [Text] -> Integration)
-> Parser (Maybe ConnectionType)
-> Parser (Maybe [Text] -> Integration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConnectionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"connectionType")
            Parser (Maybe [Text] -> Integration)
-> Parser (Maybe [Text]) -> Parser Integration
forall (f :: * -> *) a b. Applicative f => 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
"cacheKeyParameters"
                            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
                        )
      )

instance Prelude.Hashable Integration

instance Prelude.NFData Integration