{-# 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.Method
-- 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.Method where

import Amazonka.APIGateway.Types.Integration
import Amazonka.APIGateway.Types.MethodResponse
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a client-facing interface by which the client calls the API
-- to access back-end resources. A __Method__ resource is integrated with
-- an Integration resource. Both consist of a request and one or more
-- responses. The method request takes the client input that is passed to
-- the back end through the integration request. A method response returns
-- the output from the back end to the client through an integration
-- response. A method request is embodied in a __Method__ resource, whereas
-- an integration request is embodied in an Integration resource. On the
-- other hand, a method response is represented by a MethodResponse
-- resource, whereas an integration response is represented by an
-- IntegrationResponse resource.
--
-- ==== Example: Retrive the GET method on a specified resource
--
-- ===== Request
--
-- The following example request retrieves the information about the GET
-- method on an API resource (@3kzxbg5sa2@) of an API (@fugvjdxtri@).
--
-- > GET /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 20160603T210259Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160603/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- The successful response returns a @200 OK@ status code and a payload
-- similar to the following:
--
-- > { "_links": { "curies": [ { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html", "name": "integration", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-{rel}.html", "name": "method", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html", "name": "methodresponse", "templated": true } ], "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET", "name": "GET", "title": "GET" }, "integration:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "method:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "method:integration": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "method:responses": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": "200", "title": "200" }, "method:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "methodresponse:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/{status_code}", "templated": true } }, "apiKeyRequired": true, "authorizationType": "NONE", "httpMethod": "GET", "_embedded": { "method:integration": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integration:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integration:responses": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integration:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, "integrationresponse:put": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/{status_code}", "templated": true } }, "cacheKeyParameters": [], "cacheNamespace": "3kzxbg5sa2", "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod": "POST", "passthroughBehavior": "WHEN_NO_MATCH", "requestParameters": { "integration.request.header.Content-Type": "'application/x-amz-json-1.1'" }, "requestTemplates": { "application/json": "{\n}" }, "type": "AWS", "uri": "arn:aws:apigateway:us-east-1:kinesis:action/ListStreams", "_embedded": { "integration:responses": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", "name": "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%23foreach(%24stream%20in%20%24input.path(%27%24.StreamNames%27))%3Cstream%3E%3Cname%3E%24stream%3C%2Fname%3E%3C%2Fstream%3E%23end%3C%2FkinesisStreams%3E\")" }, "statusCode": "200" } } }, "method:responses": { "_links": { "self": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": "200", "title": "200" }, "methodresponse:delete": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" }, "methodresponse:update": { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" } }, "responseModels": { "application/json": "Empty" }, "responseParameters": { "method.response.header.Content-Type": false }, "statusCode": "200" } } }
--
-- In the example above, the response template for the @200 OK@ response
-- maps the JSON output from the @ListStreams@ action in the back end to an
-- XML output. The mapping template is URL-encoded as
-- @%3CkinesisStreams%3E%23foreach(%24stream%20in%20%24input.path(%27%24.StreamNames%27))%3Cstream%3E%3Cname%3E%24stream%3C%2Fname%3E%3C%2Fstream%3E%23end%3C%2FkinesisStreams%3E@
-- and the output is decoded using the
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#util-templat-reference $util.urlDecode()>
-- helper function.
--
-- MethodResponse, Integration, IntegrationResponse, Resource,
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-method-settings.html Set up an API\'s method>
--
-- /See:/ 'newMethod' smart constructor.
data Method = Method'
  { -- | Gets a method response associated with a given HTTP status code.
    --
    -- The collection of method responses are encapsulated in a key-value map,
    -- where the key is a response\'s HTTP status code and the value is a
    -- MethodResponse resource that specifies the response returned to the
    -- caller from the back end through the integration response.
    --
    -- ==== Example: Get a 200 OK response of a GET method
    --
    -- ===== Request
    --
    -- > GET /restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200 HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com Content-Length: 117 X-Amz-Date: 20160613T215008Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160613/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
    --
    -- ===== Response
    --
    -- The successful response returns a @200 OK@ status code and a payload
    -- similar to the following:
    --
    -- > { "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html", "name": "methodresponse", "templated": true }, "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200", "title": "200" }, "methodresponse:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200" }, "methodresponse:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200" } }, "responseModels": { "application/json": "Empty" }, "responseParameters": { "method.response.header.operator": false, "method.response.header.operand_2": false, "method.response.header.operand_1": false }, "statusCode": "200" }
    --
    -- <https://docs.aws.amazon.com/cli/latest/reference/apigateway/get-method-response.html AWS CLI>
    Method -> Maybe (HashMap Text MethodResponse)
methodResponses :: Prelude.Maybe (Prelude.HashMap Prelude.Text MethodResponse),
    -- | The method\'s HTTP verb.
    Method -> Maybe Text
httpMethod :: Prelude.Maybe Prelude.Text,
    -- | A list of authorization scopes configured on the method. The scopes are
    -- used with a @COGNITO_USER_POOLS@ authorizer to authorize the method
    -- invocation. The authorization works by matching the method scopes
    -- against the scopes parsed from the access token in the incoming request.
    -- The method invocation is authorized if any method scopes matches a
    -- claimed scope in the access token. Otherwise, the invocation is not
    -- authorized. When the method scope is configured, the client must provide
    -- an access token instead of an identity token for authorization purposes.
    Method -> Maybe [Text]
authorizationScopes :: Prelude.Maybe [Prelude.Text],
    -- | The identifier of a RequestValidator for request validation.
    Method -> Maybe Text
requestValidatorId :: Prelude.Maybe Prelude.Text,
    -- | A key-value map specifying data schemas, represented by Model resources,
    -- (as the mapped value) of the request payloads of given content types (as
    -- the mapping key).
    Method -> Maybe (HashMap Text Text)
requestModels :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A key-value map defining required or optional method request parameters
    -- that can be accepted by API Gateway. A key is a method request parameter
    -- name matching the pattern of @method.request.{location}.{name}@, where
    -- @location@ is @querystring@, @path@, or @header@ and @name@ is a valid
    -- and unique parameter name. The value associated with the key is a
    -- Boolean flag indicating whether the parameter is required (@true@) or
    -- optional (@false@). The method request parameter names defined here are
    -- available in Integration to be mapped to integration request parameters
    -- or templates.
    Method -> Maybe (HashMap Text Bool)
requestParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool),
    -- | The identifier of an Authorizer to use on this method. The
    -- @authorizationType@ must be @CUSTOM@.
    Method -> Maybe Text
authorizerId :: Prelude.Maybe Prelude.Text,
    -- | A human-friendly operation identifier for the method. For example, you
    -- can assign the @operationName@ of @ListPets@ for the @GET \/pets@ method
    -- in the @PetStore@ example.
    Method -> Maybe Text
operationName :: Prelude.Maybe Prelude.Text,
    -- | The method\'s authorization type. Valid values are @NONE@ for open
    -- access, @AWS_IAM@ for using AWS IAM permissions, @CUSTOM@ for using a
    -- custom authorizer, or @COGNITO_USER_POOLS@ for using a Cognito user
    -- pool.
    Method -> Maybe Text
authorizationType :: Prelude.Maybe Prelude.Text,
    -- | A boolean flag specifying whether a valid ApiKey is required to invoke
    -- this method.
    Method -> Maybe Bool
apiKeyRequired :: Prelude.Maybe Prelude.Bool,
    -- | Gets the method\'s integration responsible for passing the
    -- client-submitted request to the back end and performing necessary
    -- transformations to make the request compliant with the back end.
    --
    -- ==== Example:
    --
    -- ===== Request
    --
    -- > GET /restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com Content-Length: 117 X-Amz-Date: 20160613T213210Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160613/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
    --
    -- ===== Response
    --
    -- The successful response returns a @200 OK@ status code and a payload
    -- similar to the following:
    --
    -- > { "_links": { "curies": [ { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html", "name": "integration", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true } ], "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integration:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integration:responses": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integration:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integrationresponse:put": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/{status_code}", "templated": true } }, "cacheKeyParameters": [], "cacheNamespace": "0cjtch", "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod": "POST", "passthroughBehavior": "WHEN_NO_MATCH", "requestTemplates": { "application/json": "{\n \"a\": \"$input.params('operand1')\",\n \"b\": \"$input.params('operand2')\", \n \"op\": \"$input.params('operator')\" \n}" }, "type": "AWS", "uri": "arn:aws:apigateway:us-west-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-west-2:123456789012:function:Calc/invocations", "_embedded": { "integration:responses": { "_links": { "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.operator": "integration.response.body.op", "method.response.header.operand_2": "integration.response.body.b", "method.response.header.operand_1": "integration.response.body.a" }, "responseTemplates": { "application/json": "#set($res = $input.path('$'))\n{\n \"result\": \"$res.a, $res.b, $res.op => $res.c\",\n \"a\" : \"$res.a\",\n \"b\" : \"$res.b\",\n \"op\" : \"$res.op\",\n \"c\" : \"$res.c\"\n}" }, "selectionPattern": "", "statusCode": "200" } } }
    --
    -- <https://docs.aws.amazon.com/cli/latest/reference/apigateway/get-integration.html AWS CLI>
    Method -> Maybe Integration
methodIntegration :: Prelude.Maybe Integration
  }
  deriving (Method -> Method -> Bool
(Method -> Method -> Bool)
-> (Method -> Method -> Bool) -> Eq Method
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Method -> Method -> Bool
$c/= :: Method -> Method -> Bool
== :: Method -> Method -> Bool
$c== :: Method -> Method -> Bool
Prelude.Eq, ReadPrec [Method]
ReadPrec Method
Int -> ReadS Method
ReadS [Method]
(Int -> ReadS Method)
-> ReadS [Method]
-> ReadPrec Method
-> ReadPrec [Method]
-> Read Method
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Method]
$creadListPrec :: ReadPrec [Method]
readPrec :: ReadPrec Method
$creadPrec :: ReadPrec Method
readList :: ReadS [Method]
$creadList :: ReadS [Method]
readsPrec :: Int -> ReadS Method
$creadsPrec :: Int -> ReadS Method
Prelude.Read, Int -> Method -> ShowS
[Method] -> ShowS
Method -> String
(Int -> Method -> ShowS)
-> (Method -> String) -> ([Method] -> ShowS) -> Show Method
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Method] -> ShowS
$cshowList :: [Method] -> ShowS
show :: Method -> String
$cshow :: Method -> String
showsPrec :: Int -> Method -> ShowS
$cshowsPrec :: Int -> Method -> ShowS
Prelude.Show, (forall x. Method -> Rep Method x)
-> (forall x. Rep Method x -> Method) -> Generic Method
forall x. Rep Method x -> Method
forall x. Method -> Rep Method x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Method x -> Method
$cfrom :: forall x. Method -> Rep Method x
Prelude.Generic)

-- |
-- Create a value of 'Method' 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:
--
-- 'methodResponses', 'method_methodResponses' - Gets a method response associated with a given HTTP status code.
--
-- The collection of method responses are encapsulated in a key-value map,
-- where the key is a response\'s HTTP status code and the value is a
-- MethodResponse resource that specifies the response returned to the
-- caller from the back end through the integration response.
--
-- ==== Example: Get a 200 OK response of a GET method
--
-- ===== Request
--
-- > GET /restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200 HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com Content-Length: 117 X-Amz-Date: 20160613T215008Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160613/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- The successful response returns a @200 OK@ status code and a payload
-- similar to the following:
--
-- > { "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html", "name": "methodresponse", "templated": true }, "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200", "title": "200" }, "methodresponse:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200" }, "methodresponse:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200" } }, "responseModels": { "application/json": "Empty" }, "responseParameters": { "method.response.header.operator": false, "method.response.header.operand_2": false, "method.response.header.operand_1": false }, "statusCode": "200" }
--
-- <https://docs.aws.amazon.com/cli/latest/reference/apigateway/get-method-response.html AWS CLI>
--
-- 'httpMethod', 'method_httpMethod' - The method\'s HTTP verb.
--
-- 'authorizationScopes', 'method_authorizationScopes' - A list of authorization scopes configured on the method. The scopes are
-- used with a @COGNITO_USER_POOLS@ authorizer to authorize the method
-- invocation. The authorization works by matching the method scopes
-- against the scopes parsed from the access token in the incoming request.
-- The method invocation is authorized if any method scopes matches a
-- claimed scope in the access token. Otherwise, the invocation is not
-- authorized. When the method scope is configured, the client must provide
-- an access token instead of an identity token for authorization purposes.
--
-- 'requestValidatorId', 'method_requestValidatorId' - The identifier of a RequestValidator for request validation.
--
-- 'requestModels', 'method_requestModels' - A key-value map specifying data schemas, represented by Model resources,
-- (as the mapped value) of the request payloads of given content types (as
-- the mapping key).
--
-- 'requestParameters', 'method_requestParameters' - A key-value map defining required or optional method request parameters
-- that can be accepted by API Gateway. A key is a method request parameter
-- name matching the pattern of @method.request.{location}.{name}@, where
-- @location@ is @querystring@, @path@, or @header@ and @name@ is a valid
-- and unique parameter name. The value associated with the key is a
-- Boolean flag indicating whether the parameter is required (@true@) or
-- optional (@false@). The method request parameter names defined here are
-- available in Integration to be mapped to integration request parameters
-- or templates.
--
-- 'authorizerId', 'method_authorizerId' - The identifier of an Authorizer to use on this method. The
-- @authorizationType@ must be @CUSTOM@.
--
-- 'operationName', 'method_operationName' - A human-friendly operation identifier for the method. For example, you
-- can assign the @operationName@ of @ListPets@ for the @GET \/pets@ method
-- in the @PetStore@ example.
--
-- 'authorizationType', 'method_authorizationType' - The method\'s authorization type. Valid values are @NONE@ for open
-- access, @AWS_IAM@ for using AWS IAM permissions, @CUSTOM@ for using a
-- custom authorizer, or @COGNITO_USER_POOLS@ for using a Cognito user
-- pool.
--
-- 'apiKeyRequired', 'method_apiKeyRequired' - A boolean flag specifying whether a valid ApiKey is required to invoke
-- this method.
--
-- 'methodIntegration', 'method_methodIntegration' - Gets the method\'s integration responsible for passing the
-- client-submitted request to the back end and performing necessary
-- transformations to make the request compliant with the back end.
--
-- ==== Example:
--
-- ===== Request
--
-- > GET /restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com Content-Length: 117 X-Amz-Date: 20160613T213210Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160613/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- The successful response returns a @200 OK@ status code and a payload
-- similar to the following:
--
-- > { "_links": { "curies": [ { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html", "name": "integration", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true } ], "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integration:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integration:responses": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integration:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integrationresponse:put": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/{status_code}", "templated": true } }, "cacheKeyParameters": [], "cacheNamespace": "0cjtch", "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod": "POST", "passthroughBehavior": "WHEN_NO_MATCH", "requestTemplates": { "application/json": "{\n \"a\": \"$input.params('operand1')\",\n \"b\": \"$input.params('operand2')\", \n \"op\": \"$input.params('operator')\" \n}" }, "type": "AWS", "uri": "arn:aws:apigateway:us-west-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-west-2:123456789012:function:Calc/invocations", "_embedded": { "integration:responses": { "_links": { "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.operator": "integration.response.body.op", "method.response.header.operand_2": "integration.response.body.b", "method.response.header.operand_1": "integration.response.body.a" }, "responseTemplates": { "application/json": "#set($res = $input.path('$'))\n{\n \"result\": \"$res.a, $res.b, $res.op => $res.c\",\n \"a\" : \"$res.a\",\n \"b\" : \"$res.b\",\n \"op\" : \"$res.op\",\n \"c\" : \"$res.c\"\n}" }, "selectionPattern": "", "statusCode": "200" } } }
--
-- <https://docs.aws.amazon.com/cli/latest/reference/apigateway/get-integration.html AWS CLI>
newMethod ::
  Method
newMethod :: Method
newMethod =
  Method' :: Maybe (HashMap Text MethodResponse)
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text Bool)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Integration
-> Method
Method'
    { $sel:methodResponses:Method' :: Maybe (HashMap Text MethodResponse)
methodResponses = Maybe (HashMap Text MethodResponse)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpMethod:Method' :: Maybe Text
httpMethod = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationScopes:Method' :: Maybe [Text]
authorizationScopes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:requestValidatorId:Method' :: Maybe Text
requestValidatorId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:requestModels:Method' :: Maybe (HashMap Text Text)
requestModels = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:requestParameters:Method' :: Maybe (HashMap Text Bool)
requestParameters = Maybe (HashMap Text Bool)
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerId:Method' :: Maybe Text
authorizerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operationName:Method' :: Maybe Text
operationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationType:Method' :: Maybe Text
authorizationType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:apiKeyRequired:Method' :: Maybe Bool
apiKeyRequired = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:methodIntegration:Method' :: Maybe Integration
methodIntegration = Maybe Integration
forall a. Maybe a
Prelude.Nothing
    }

-- | Gets a method response associated with a given HTTP status code.
--
-- The collection of method responses are encapsulated in a key-value map,
-- where the key is a response\'s HTTP status code and the value is a
-- MethodResponse resource that specifies the response returned to the
-- caller from the back end through the integration response.
--
-- ==== Example: Get a 200 OK response of a GET method
--
-- ===== Request
--
-- > GET /restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200 HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com Content-Length: 117 X-Amz-Date: 20160613T215008Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160613/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- The successful response returns a @200 OK@ status code and a payload
-- similar to the following:
--
-- > { "_links": { "curies": { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html", "name": "methodresponse", "templated": true }, "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200", "title": "200" }, "methodresponse:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200" }, "methodresponse:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/responses/200" } }, "responseModels": { "application/json": "Empty" }, "responseParameters": { "method.response.header.operator": false, "method.response.header.operand_2": false, "method.response.header.operand_1": false }, "statusCode": "200" }
--
-- <https://docs.aws.amazon.com/cli/latest/reference/apigateway/get-method-response.html AWS CLI>
method_methodResponses :: Lens.Lens' Method (Prelude.Maybe (Prelude.HashMap Prelude.Text MethodResponse))
method_methodResponses :: (Maybe (HashMap Text MethodResponse)
 -> f (Maybe (HashMap Text MethodResponse)))
-> Method -> f Method
method_methodResponses = (Method -> Maybe (HashMap Text MethodResponse))
-> (Method -> Maybe (HashMap Text MethodResponse) -> Method)
-> Lens
     Method
     Method
     (Maybe (HashMap Text MethodResponse))
     (Maybe (HashMap Text MethodResponse))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe (HashMap Text MethodResponse)
methodResponses :: Maybe (HashMap Text MethodResponse)
$sel:methodResponses:Method' :: Method -> Maybe (HashMap Text MethodResponse)
methodResponses} -> Maybe (HashMap Text MethodResponse)
methodResponses) (\s :: Method
s@Method' {} Maybe (HashMap Text MethodResponse)
a -> Method
s {$sel:methodResponses:Method' :: Maybe (HashMap Text MethodResponse)
methodResponses = Maybe (HashMap Text MethodResponse)
a} :: Method) ((Maybe (HashMap Text MethodResponse)
  -> f (Maybe (HashMap Text MethodResponse)))
 -> Method -> f Method)
-> ((Maybe (HashMap Text MethodResponse)
     -> f (Maybe (HashMap Text MethodResponse)))
    -> Maybe (HashMap Text MethodResponse)
    -> f (Maybe (HashMap Text MethodResponse)))
-> (Maybe (HashMap Text MethodResponse)
    -> f (Maybe (HashMap Text MethodResponse)))
-> Method
-> f Method
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text MethodResponse)
  (HashMap Text MethodResponse)
  (HashMap Text MethodResponse)
  (HashMap Text MethodResponse)
-> Iso
     (Maybe (HashMap Text MethodResponse))
     (Maybe (HashMap Text MethodResponse))
     (Maybe (HashMap Text MethodResponse))
     (Maybe (HashMap Text MethodResponse))
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 MethodResponse)
  (HashMap Text MethodResponse)
  (HashMap Text MethodResponse)
  (HashMap Text MethodResponse)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The method\'s HTTP verb.
method_httpMethod :: Lens.Lens' Method (Prelude.Maybe Prelude.Text)
method_httpMethod :: (Maybe Text -> f (Maybe Text)) -> Method -> f Method
method_httpMethod = (Method -> Maybe Text)
-> (Method -> Maybe Text -> Method)
-> Lens Method Method (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe Text
httpMethod :: Maybe Text
$sel:httpMethod:Method' :: Method -> Maybe Text
httpMethod} -> Maybe Text
httpMethod) (\s :: Method
s@Method' {} Maybe Text
a -> Method
s {$sel:httpMethod:Method' :: Maybe Text
httpMethod = Maybe Text
a} :: Method)

-- | A list of authorization scopes configured on the method. The scopes are
-- used with a @COGNITO_USER_POOLS@ authorizer to authorize the method
-- invocation. The authorization works by matching the method scopes
-- against the scopes parsed from the access token in the incoming request.
-- The method invocation is authorized if any method scopes matches a
-- claimed scope in the access token. Otherwise, the invocation is not
-- authorized. When the method scope is configured, the client must provide
-- an access token instead of an identity token for authorization purposes.
method_authorizationScopes :: Lens.Lens' Method (Prelude.Maybe [Prelude.Text])
method_authorizationScopes :: (Maybe [Text] -> f (Maybe [Text])) -> Method -> f Method
method_authorizationScopes = (Method -> Maybe [Text])
-> (Method -> Maybe [Text] -> Method)
-> Lens Method Method (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe [Text]
authorizationScopes :: Maybe [Text]
$sel:authorizationScopes:Method' :: Method -> Maybe [Text]
authorizationScopes} -> Maybe [Text]
authorizationScopes) (\s :: Method
s@Method' {} Maybe [Text]
a -> Method
s {$sel:authorizationScopes:Method' :: Maybe [Text]
authorizationScopes = Maybe [Text]
a} :: Method) ((Maybe [Text] -> f (Maybe [Text])) -> Method -> f Method)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Method
-> f Method
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of a RequestValidator for request validation.
method_requestValidatorId :: Lens.Lens' Method (Prelude.Maybe Prelude.Text)
method_requestValidatorId :: (Maybe Text -> f (Maybe Text)) -> Method -> f Method
method_requestValidatorId = (Method -> Maybe Text)
-> (Method -> Maybe Text -> Method)
-> Lens Method Method (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe Text
requestValidatorId :: Maybe Text
$sel:requestValidatorId:Method' :: Method -> Maybe Text
requestValidatorId} -> Maybe Text
requestValidatorId) (\s :: Method
s@Method' {} Maybe Text
a -> Method
s {$sel:requestValidatorId:Method' :: Maybe Text
requestValidatorId = Maybe Text
a} :: Method)

-- | A key-value map specifying data schemas, represented by Model resources,
-- (as the mapped value) of the request payloads of given content types (as
-- the mapping key).
method_requestModels :: Lens.Lens' Method (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
method_requestModels :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Method -> f Method
method_requestModels = (Method -> Maybe (HashMap Text Text))
-> (Method -> Maybe (HashMap Text Text) -> Method)
-> Lens
     Method
     Method
     (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 (\Method' {Maybe (HashMap Text Text)
requestModels :: Maybe (HashMap Text Text)
$sel:requestModels:Method' :: Method -> Maybe (HashMap Text Text)
requestModels} -> Maybe (HashMap Text Text)
requestModels) (\s :: Method
s@Method' {} Maybe (HashMap Text Text)
a -> Method
s {$sel:requestModels:Method' :: Maybe (HashMap Text Text)
requestModels = Maybe (HashMap Text Text)
a} :: Method) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> Method -> f Method)
-> ((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)))
-> Method
-> f Method
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

-- | A key-value map defining required or optional method request parameters
-- that can be accepted by API Gateway. A key is a method request parameter
-- name matching the pattern of @method.request.{location}.{name}@, where
-- @location@ is @querystring@, @path@, or @header@ and @name@ is a valid
-- and unique parameter name. The value associated with the key is a
-- Boolean flag indicating whether the parameter is required (@true@) or
-- optional (@false@). The method request parameter names defined here are
-- available in Integration to be mapped to integration request parameters
-- or templates.
method_requestParameters :: Lens.Lens' Method (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool))
method_requestParameters :: (Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> Method -> f Method
method_requestParameters = (Method -> Maybe (HashMap Text Bool))
-> (Method -> Maybe (HashMap Text Bool) -> Method)
-> Lens
     Method
     Method
     (Maybe (HashMap Text Bool))
     (Maybe (HashMap Text Bool))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe (HashMap Text Bool)
requestParameters :: Maybe (HashMap Text Bool)
$sel:requestParameters:Method' :: Method -> Maybe (HashMap Text Bool)
requestParameters} -> Maybe (HashMap Text Bool)
requestParameters) (\s :: Method
s@Method' {} Maybe (HashMap Text Bool)
a -> Method
s {$sel:requestParameters:Method' :: Maybe (HashMap Text Bool)
requestParameters = Maybe (HashMap Text Bool)
a} :: Method) ((Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
 -> Method -> f Method)
-> ((Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
    -> Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> (Maybe (HashMap Text Bool) -> f (Maybe (HashMap Text Bool)))
-> Method
-> f Method
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Bool)
  (HashMap Text Bool)
  (HashMap Text Bool)
  (HashMap Text Bool)
-> Iso
     (Maybe (HashMap Text Bool))
     (Maybe (HashMap Text Bool))
     (Maybe (HashMap Text Bool))
     (Maybe (HashMap Text Bool))
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 Bool)
  (HashMap Text Bool)
  (HashMap Text Bool)
  (HashMap Text Bool)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of an Authorizer to use on this method. The
-- @authorizationType@ must be @CUSTOM@.
method_authorizerId :: Lens.Lens' Method (Prelude.Maybe Prelude.Text)
method_authorizerId :: (Maybe Text -> f (Maybe Text)) -> Method -> f Method
method_authorizerId = (Method -> Maybe Text)
-> (Method -> Maybe Text -> Method)
-> Lens Method Method (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe Text
authorizerId :: Maybe Text
$sel:authorizerId:Method' :: Method -> Maybe Text
authorizerId} -> Maybe Text
authorizerId) (\s :: Method
s@Method' {} Maybe Text
a -> Method
s {$sel:authorizerId:Method' :: Maybe Text
authorizerId = Maybe Text
a} :: Method)

-- | A human-friendly operation identifier for the method. For example, you
-- can assign the @operationName@ of @ListPets@ for the @GET \/pets@ method
-- in the @PetStore@ example.
method_operationName :: Lens.Lens' Method (Prelude.Maybe Prelude.Text)
method_operationName :: (Maybe Text -> f (Maybe Text)) -> Method -> f Method
method_operationName = (Method -> Maybe Text)
-> (Method -> Maybe Text -> Method)
-> Lens Method Method (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe Text
operationName :: Maybe Text
$sel:operationName:Method' :: Method -> Maybe Text
operationName} -> Maybe Text
operationName) (\s :: Method
s@Method' {} Maybe Text
a -> Method
s {$sel:operationName:Method' :: Maybe Text
operationName = Maybe Text
a} :: Method)

-- | The method\'s authorization type. Valid values are @NONE@ for open
-- access, @AWS_IAM@ for using AWS IAM permissions, @CUSTOM@ for using a
-- custom authorizer, or @COGNITO_USER_POOLS@ for using a Cognito user
-- pool.
method_authorizationType :: Lens.Lens' Method (Prelude.Maybe Prelude.Text)
method_authorizationType :: (Maybe Text -> f (Maybe Text)) -> Method -> f Method
method_authorizationType = (Method -> Maybe Text)
-> (Method -> Maybe Text -> Method)
-> Lens Method Method (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe Text
authorizationType :: Maybe Text
$sel:authorizationType:Method' :: Method -> Maybe Text
authorizationType} -> Maybe Text
authorizationType) (\s :: Method
s@Method' {} Maybe Text
a -> Method
s {$sel:authorizationType:Method' :: Maybe Text
authorizationType = Maybe Text
a} :: Method)

-- | A boolean flag specifying whether a valid ApiKey is required to invoke
-- this method.
method_apiKeyRequired :: Lens.Lens' Method (Prelude.Maybe Prelude.Bool)
method_apiKeyRequired :: (Maybe Bool -> f (Maybe Bool)) -> Method -> f Method
method_apiKeyRequired = (Method -> Maybe Bool)
-> (Method -> Maybe Bool -> Method)
-> Lens Method Method (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe Bool
apiKeyRequired :: Maybe Bool
$sel:apiKeyRequired:Method' :: Method -> Maybe Bool
apiKeyRequired} -> Maybe Bool
apiKeyRequired) (\s :: Method
s@Method' {} Maybe Bool
a -> Method
s {$sel:apiKeyRequired:Method' :: Maybe Bool
apiKeyRequired = Maybe Bool
a} :: Method)

-- | Gets the method\'s integration responsible for passing the
-- client-submitted request to the back end and performing necessary
-- transformations to make the request compliant with the back end.
--
-- ==== Example:
--
-- ===== Request
--
-- > GET /restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com Content-Length: 117 X-Amz-Date: 20160613T213210Z Authorization: AWS4-HMAC-SHA256 Credential={access_key_ID}/20160613/us-east-1/apigateway/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
--
-- ===== Response
--
-- The successful response returns a @200 OK@ status code and a payload
-- similar to the following:
--
-- > { "_links": { "curies": [ { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html", "name": "integration", "templated": true }, { "href": "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", "name": "integrationresponse", "templated": true } ], "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integration:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integration:responses": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integration:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration" }, "integrationresponse:put": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/{status_code}", "templated": true } }, "cacheKeyParameters": [], "cacheNamespace": "0cjtch", "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod": "POST", "passthroughBehavior": "WHEN_NO_MATCH", "requestTemplates": { "application/json": "{\n \"a\": \"$input.params('operand1')\",\n \"b\": \"$input.params('operand2')\", \n \"op\": \"$input.params('operator')\" \n}" }, "type": "AWS", "uri": "arn:aws:apigateway:us-west-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-west-2:123456789012:function:Calc/invocations", "_embedded": { "integration:responses": { "_links": { "self": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200", "name": "200", "title": "200" }, "integrationresponse:delete": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200" }, "integrationresponse:update": { "href": "/restapis/uojnr9hd57/resources/0cjtch/methods/GET/integration/responses/200" } }, "responseParameters": { "method.response.header.operator": "integration.response.body.op", "method.response.header.operand_2": "integration.response.body.b", "method.response.header.operand_1": "integration.response.body.a" }, "responseTemplates": { "application/json": "#set($res = $input.path('$'))\n{\n \"result\": \"$res.a, $res.b, $res.op => $res.c\",\n \"a\" : \"$res.a\",\n \"b\" : \"$res.b\",\n \"op\" : \"$res.op\",\n \"c\" : \"$res.c\"\n}" }, "selectionPattern": "", "statusCode": "200" } } }
--
-- <https://docs.aws.amazon.com/cli/latest/reference/apigateway/get-integration.html AWS CLI>
method_methodIntegration :: Lens.Lens' Method (Prelude.Maybe Integration)
method_methodIntegration :: (Maybe Integration -> f (Maybe Integration)) -> Method -> f Method
method_methodIntegration = (Method -> Maybe Integration)
-> (Method -> Maybe Integration -> Method)
-> Lens Method Method (Maybe Integration) (Maybe Integration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Method' {Maybe Integration
methodIntegration :: Maybe Integration
$sel:methodIntegration:Method' :: Method -> Maybe Integration
methodIntegration} -> Maybe Integration
methodIntegration) (\s :: Method
s@Method' {} Maybe Integration
a -> Method
s {$sel:methodIntegration:Method' :: Maybe Integration
methodIntegration = Maybe Integration
a} :: Method)

instance Core.FromJSON Method where
  parseJSON :: Value -> Parser Method
parseJSON =
    String -> (Object -> Parser Method) -> Value -> Parser Method
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Method"
      ( \Object
x ->
          Maybe (HashMap Text MethodResponse)
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text Bool)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Integration
-> Method
Method'
            (Maybe (HashMap Text MethodResponse)
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe (HashMap Text Bool)
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Integration
 -> Method)
-> Parser (Maybe (HashMap Text MethodResponse))
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe (HashMap Text Bool)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Integration
      -> Method)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Parser (Maybe (Maybe (HashMap Text MethodResponse)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"methodResponses"
                            Parser (Maybe (Maybe (HashMap Text MethodResponse)))
-> Maybe (HashMap Text MethodResponse)
-> Parser (Maybe (HashMap Text MethodResponse))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text MethodResponse)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe (HashMap Text Bool)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Integration
   -> Method)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe (HashMap Text Bool)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Integration
      -> Method)
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
"httpMethod")
            Parser
  (Maybe [Text]
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe (HashMap Text Bool)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Integration
   -> Method)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe (HashMap Text Bool)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Integration
      -> Method)
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
"authorizationScopes"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe (HashMap Text Bool)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Integration
   -> Method)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe (HashMap Text Bool)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Integration
      -> Method)
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
"requestValidatorId")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe (HashMap Text Bool)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Integration
   -> Method)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe (HashMap Text Bool)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Integration
      -> Method)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"requestModels" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe (HashMap Text Bool)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Integration
   -> Method)
-> Parser (Maybe (HashMap Text Bool))
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Integration
      -> Method)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Bool)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"requestParameters"
                            Parser (Maybe (Maybe (HashMap Text Bool)))
-> Maybe (HashMap Text Bool) -> Parser (Maybe (HashMap Text Bool))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Bool)
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Integration
   -> Method)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Bool -> Maybe Integration -> Method)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"authorizerId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Bool -> Maybe Integration -> Method)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Bool -> Maybe Integration -> Method)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"operationName")
            Parser (Maybe Text -> Maybe Bool -> Maybe Integration -> Method)
-> Parser (Maybe Text)
-> Parser (Maybe Bool -> Maybe Integration -> Method)
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
"authorizationType")
            Parser (Maybe Bool -> Maybe Integration -> Method)
-> Parser (Maybe Bool) -> Parser (Maybe Integration -> Method)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"apiKeyRequired")
            Parser (Maybe Integration -> Method)
-> Parser (Maybe Integration) -> Parser Method
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"methodIntegration")
      )

instance Prelude.Hashable Method

instance Prelude.NFData Method