{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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.
--
-- /See:/ 'newMethod' smart constructor.
data Method = Method'
  { -- | A boolean flag specifying whether a valid ApiKey is required to invoke
    -- this method.
    Method -> Maybe Bool
apiKeyRequired :: Prelude.Maybe Prelude.Bool,
    -- | 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 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,
    -- | The identifier of an Authorizer to use on this method. The
    -- @authorizationType@ must be @CUSTOM@.
    Method -> Maybe Text
authorizerId :: Prelude.Maybe Prelude.Text,
    -- | The method\'s HTTP verb.
    Method -> Maybe Text
httpMethod :: Prelude.Maybe Prelude.Text,
    -- | 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.
    Method -> Maybe Integration
methodIntegration :: Prelude.Maybe Integration,
    -- | Gets a method response associated with a given HTTP status code.
    Method -> Maybe (HashMap Text MethodResponse)
methodResponses :: Prelude.Maybe (Prelude.HashMap Prelude.Text MethodResponse),
    -- | 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,
    -- | 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 a RequestValidator for request validation.
    Method -> Maybe Text
requestValidatorId :: Prelude.Maybe Prelude.Text
  }
  deriving (Method -> Method -> Bool
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]
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
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. 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:
--
-- 'apiKeyRequired', 'method_apiKeyRequired' - A boolean flag specifying whether a valid ApiKey is required to invoke
-- this method.
--
-- '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.
--
-- '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.
--
-- 'authorizerId', 'method_authorizerId' - The identifier of an Authorizer to use on this method. The
-- @authorizationType@ must be @CUSTOM@.
--
-- 'httpMethod', 'method_httpMethod' - The method\'s HTTP verb.
--
-- '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.
--
-- 'methodResponses', 'method_methodResponses' - Gets a method response associated with a given HTTP status code.
--
-- '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.
--
-- '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.
--
-- 'requestValidatorId', 'method_requestValidatorId' - The identifier of a RequestValidator for request validation.
newMethod ::
  Method
newMethod :: Method
newMethod =
  Method'
    { $sel:apiKeyRequired:Method' :: Maybe Bool
apiKeyRequired = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationScopes:Method' :: Maybe [Text]
authorizationScopes = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizationType:Method' :: Maybe Text
authorizationType = forall a. Maybe a
Prelude.Nothing,
      $sel:authorizerId:Method' :: Maybe Text
authorizerId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpMethod:Method' :: Maybe Text
httpMethod = forall a. Maybe a
Prelude.Nothing,
      $sel:methodIntegration:Method' :: Maybe Integration
methodIntegration = forall a. Maybe a
Prelude.Nothing,
      $sel:methodResponses:Method' :: Maybe (HashMap Text MethodResponse)
methodResponses = forall a. Maybe a
Prelude.Nothing,
      $sel:operationName:Method' :: Maybe Text
operationName = forall a. Maybe a
Prelude.Nothing,
      $sel:requestModels:Method' :: Maybe (HashMap Text Text)
requestModels = forall a. Maybe a
Prelude.Nothing,
      $sel:requestParameters:Method' :: Maybe (HashMap Text Bool)
requestParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:requestValidatorId:Method' :: Maybe Text
requestValidatorId = forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: Lens' Method (Maybe Bool)
method_apiKeyRequired = 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)

-- | 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 :: Lens' Method (Maybe [Text])
method_authorizationScopes = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' Method (Maybe Text)
method_authorizationType = 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)

-- | 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 :: Lens' Method (Maybe Text)
method_authorizerId = 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)

-- | The method\'s HTTP verb.
method_httpMethod :: Lens.Lens' Method (Prelude.Maybe Prelude.Text)
method_httpMethod :: Lens' Method (Maybe Text)
method_httpMethod = 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)

-- | 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.
method_methodIntegration :: Lens.Lens' Method (Prelude.Maybe Integration)
method_methodIntegration :: Lens' Method (Maybe Integration)
method_methodIntegration = 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)

-- | Gets a method response associated with a given HTTP status code.
method_methodResponses :: Lens.Lens' Method (Prelude.Maybe (Prelude.HashMap Prelude.Text MethodResponse))
method_methodResponses :: Lens' Method (Maybe (HashMap Text MethodResponse))
method_methodResponses = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' Method (Maybe Text)
method_operationName = 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)

-- | 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 :: Lens' Method (Maybe (HashMap Text Text))
method_requestModels = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' Method (Maybe (HashMap Text Bool))
method_requestParameters = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' Method (Maybe Text)
method_requestValidatorId = 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)

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

instance Prelude.Hashable Method where
  hashWithSalt :: Int -> Method -> Int
hashWithSalt Int
_salt Method' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
Maybe (HashMap Text MethodResponse)
Maybe Integration
requestValidatorId :: Maybe Text
requestParameters :: Maybe (HashMap Text Bool)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
methodResponses :: Maybe (HashMap Text MethodResponse)
methodIntegration :: Maybe Integration
httpMethod :: Maybe Text
authorizerId :: Maybe Text
authorizationType :: Maybe Text
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:requestValidatorId:Method' :: Method -> Maybe Text
$sel:requestParameters:Method' :: Method -> Maybe (HashMap Text Bool)
$sel:requestModels:Method' :: Method -> Maybe (HashMap Text Text)
$sel:operationName:Method' :: Method -> Maybe Text
$sel:methodResponses:Method' :: Method -> Maybe (HashMap Text MethodResponse)
$sel:methodIntegration:Method' :: Method -> Maybe Integration
$sel:httpMethod:Method' :: Method -> Maybe Text
$sel:authorizerId:Method' :: Method -> Maybe Text
$sel:authorizationType:Method' :: Method -> Maybe Text
$sel:authorizationScopes:Method' :: Method -> Maybe [Text]
$sel:apiKeyRequired:Method' :: Method -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
apiKeyRequired
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
authorizationScopes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorizationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorizerId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
httpMethod
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integration
methodIntegration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text MethodResponse)
methodResponses
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
operationName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
requestModels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Bool)
requestParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
requestValidatorId

instance Prelude.NFData Method where
  rnf :: Method -> ()
rnf Method' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
Maybe (HashMap Text MethodResponse)
Maybe Integration
requestValidatorId :: Maybe Text
requestParameters :: Maybe (HashMap Text Bool)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
methodResponses :: Maybe (HashMap Text MethodResponse)
methodIntegration :: Maybe Integration
httpMethod :: Maybe Text
authorizerId :: Maybe Text
authorizationType :: Maybe Text
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:requestValidatorId:Method' :: Method -> Maybe Text
$sel:requestParameters:Method' :: Method -> Maybe (HashMap Text Bool)
$sel:requestModels:Method' :: Method -> Maybe (HashMap Text Text)
$sel:operationName:Method' :: Method -> Maybe Text
$sel:methodResponses:Method' :: Method -> Maybe (HashMap Text MethodResponse)
$sel:methodIntegration:Method' :: Method -> Maybe Integration
$sel:httpMethod:Method' :: Method -> Maybe Text
$sel:authorizerId:Method' :: Method -> Maybe Text
$sel:authorizationType:Method' :: Method -> Maybe Text
$sel:authorizationScopes:Method' :: Method -> Maybe [Text]
$sel:apiKeyRequired:Method' :: Method -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
apiKeyRequired
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
authorizationScopes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorizerId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
httpMethod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integration
methodIntegration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text MethodResponse)
methodResponses
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
operationName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
requestModels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Bool)
requestParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestValidatorId