{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.APIGateway.PutMethod
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Add a method to an existing Resource resource.
module Amazonka.APIGateway.PutMethod
  ( -- * Creating a Request
    PutMethod (..),
    newPutMethod,

    -- * Request Lenses
    putMethod_apiKeyRequired,
    putMethod_authorizationScopes,
    putMethod_authorizerId,
    putMethod_operationName,
    putMethod_requestModels,
    putMethod_requestParameters,
    putMethod_requestValidatorId,
    putMethod_restApiId,
    putMethod_resourceId,
    putMethod_httpMethod,
    putMethod_authorizationType,

    -- * Destructuring the Response
    Method (..),
    newMethod,

    -- * Response Lenses
    method_apiKeyRequired,
    method_authorizationScopes,
    method_authorizationType,
    method_authorizerId,
    method_httpMethod,
    method_methodIntegration,
    method_methodResponses,
    method_operationName,
    method_requestModels,
    method_requestParameters,
    method_requestValidatorId,
  )
where

import Amazonka.APIGateway.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Request to add a method to an existing Resource resource.
--
-- /See:/ 'newPutMethod' smart constructor.
data PutMethod = PutMethod'
  { -- | Specifies whether the method required a valid ApiKey.
    PutMethod -> 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.
    PutMethod -> Maybe [Text]
authorizationScopes :: Prelude.Maybe [Prelude.Text],
    -- | Specifies the identifier of an Authorizer to use on this Method, if the
    -- type is CUSTOM or COGNITO_USER_POOLS. The authorizer identifier is
    -- generated by API Gateway when you created the authorizer.
    PutMethod -> 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.
    PutMethod -> Maybe Text
operationName :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Model resources used for the request\'s content type.
    -- Request models are represented as a key\/value map, with a content type
    -- as the key and a Model name as the value.
    PutMethod -> 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 defines 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 body-mapping templates.
    PutMethod -> Maybe (HashMap Text Bool)
requestParameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool),
    -- | The identifier of a RequestValidator for validating the method request.
    PutMethod -> Maybe Text
requestValidatorId :: Prelude.Maybe Prelude.Text,
    -- | The string identifier of the associated RestApi.
    PutMethod -> Text
restApiId :: Prelude.Text,
    -- | The Resource identifier for the new Method resource.
    PutMethod -> Text
resourceId :: Prelude.Text,
    -- | Specifies the method request\'s HTTP method type.
    PutMethod -> Text
httpMethod :: 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.
    PutMethod -> Text
authorizationType :: Prelude.Text
  }
  deriving (PutMethod -> PutMethod -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutMethod -> PutMethod -> Bool
$c/= :: PutMethod -> PutMethod -> Bool
== :: PutMethod -> PutMethod -> Bool
$c== :: PutMethod -> PutMethod -> Bool
Prelude.Eq, ReadPrec [PutMethod]
ReadPrec PutMethod
Int -> ReadS PutMethod
ReadS [PutMethod]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutMethod]
$creadListPrec :: ReadPrec [PutMethod]
readPrec :: ReadPrec PutMethod
$creadPrec :: ReadPrec PutMethod
readList :: ReadS [PutMethod]
$creadList :: ReadS [PutMethod]
readsPrec :: Int -> ReadS PutMethod
$creadsPrec :: Int -> ReadS PutMethod
Prelude.Read, Int -> PutMethod -> ShowS
[PutMethod] -> ShowS
PutMethod -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutMethod] -> ShowS
$cshowList :: [PutMethod] -> ShowS
show :: PutMethod -> String
$cshow :: PutMethod -> String
showsPrec :: Int -> PutMethod -> ShowS
$cshowsPrec :: Int -> PutMethod -> ShowS
Prelude.Show, forall x. Rep PutMethod x -> PutMethod
forall x. PutMethod -> Rep PutMethod x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutMethod x -> PutMethod
$cfrom :: forall x. PutMethod -> Rep PutMethod x
Prelude.Generic)

-- |
-- Create a value of 'PutMethod' 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', 'putMethod_apiKeyRequired' - Specifies whether the method required a valid ApiKey.
--
-- 'authorizationScopes', 'putMethod_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.
--
-- 'authorizerId', 'putMethod_authorizerId' - Specifies the identifier of an Authorizer to use on this Method, if the
-- type is CUSTOM or COGNITO_USER_POOLS. The authorizer identifier is
-- generated by API Gateway when you created the authorizer.
--
-- 'operationName', 'putMethod_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', 'putMethod_requestModels' - Specifies the Model resources used for the request\'s content type.
-- Request models are represented as a key\/value map, with a content type
-- as the key and a Model name as the value.
--
-- 'requestParameters', 'putMethod_requestParameters' - A key-value map defining required or optional method request parameters
-- that can be accepted by API Gateway. A key defines 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 body-mapping templates.
--
-- 'requestValidatorId', 'putMethod_requestValidatorId' - The identifier of a RequestValidator for validating the method request.
--
-- 'restApiId', 'putMethod_restApiId' - The string identifier of the associated RestApi.
--
-- 'resourceId', 'putMethod_resourceId' - The Resource identifier for the new Method resource.
--
-- 'httpMethod', 'putMethod_httpMethod' - Specifies the method request\'s HTTP method type.
--
-- 'authorizationType', 'putMethod_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.
newPutMethod ::
  -- | 'restApiId'
  Prelude.Text ->
  -- | 'resourceId'
  Prelude.Text ->
  -- | 'httpMethod'
  Prelude.Text ->
  -- | 'authorizationType'
  Prelude.Text ->
  PutMethod
newPutMethod :: Text -> Text -> Text -> Text -> PutMethod
newPutMethod
  Text
pRestApiId_
  Text
pResourceId_
  Text
pHttpMethod_
  Text
pAuthorizationType_ =
    PutMethod'
      { $sel:apiKeyRequired:PutMethod' :: Maybe Bool
apiKeyRequired = forall a. Maybe a
Prelude.Nothing,
        $sel:authorizationScopes:PutMethod' :: Maybe [Text]
authorizationScopes = forall a. Maybe a
Prelude.Nothing,
        $sel:authorizerId:PutMethod' :: Maybe Text
authorizerId = forall a. Maybe a
Prelude.Nothing,
        $sel:operationName:PutMethod' :: Maybe Text
operationName = forall a. Maybe a
Prelude.Nothing,
        $sel:requestModels:PutMethod' :: Maybe (HashMap Text Text)
requestModels = forall a. Maybe a
Prelude.Nothing,
        $sel:requestParameters:PutMethod' :: Maybe (HashMap Text Bool)
requestParameters = forall a. Maybe a
Prelude.Nothing,
        $sel:requestValidatorId:PutMethod' :: Maybe Text
requestValidatorId = forall a. Maybe a
Prelude.Nothing,
        $sel:restApiId:PutMethod' :: Text
restApiId = Text
pRestApiId_,
        $sel:resourceId:PutMethod' :: Text
resourceId = Text
pResourceId_,
        $sel:httpMethod:PutMethod' :: Text
httpMethod = Text
pHttpMethod_,
        $sel:authorizationType:PutMethod' :: Text
authorizationType = Text
pAuthorizationType_
      }

-- | Specifies whether the method required a valid ApiKey.
putMethod_apiKeyRequired :: Lens.Lens' PutMethod (Prelude.Maybe Prelude.Bool)
putMethod_apiKeyRequired :: Lens' PutMethod (Maybe Bool)
putMethod_apiKeyRequired = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Maybe Bool
apiKeyRequired :: Maybe Bool
$sel:apiKeyRequired:PutMethod' :: PutMethod -> Maybe Bool
apiKeyRequired} -> Maybe Bool
apiKeyRequired) (\s :: PutMethod
s@PutMethod' {} Maybe Bool
a -> PutMethod
s {$sel:apiKeyRequired:PutMethod' :: Maybe Bool
apiKeyRequired = Maybe Bool
a} :: PutMethod)

-- | 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.
putMethod_authorizationScopes :: Lens.Lens' PutMethod (Prelude.Maybe [Prelude.Text])
putMethod_authorizationScopes :: Lens' PutMethod (Maybe [Text])
putMethod_authorizationScopes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Maybe [Text]
authorizationScopes :: Maybe [Text]
$sel:authorizationScopes:PutMethod' :: PutMethod -> Maybe [Text]
authorizationScopes} -> Maybe [Text]
authorizationScopes) (\s :: PutMethod
s@PutMethod' {} Maybe [Text]
a -> PutMethod
s {$sel:authorizationScopes:PutMethod' :: Maybe [Text]
authorizationScopes = Maybe [Text]
a} :: PutMethod) 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

-- | Specifies the identifier of an Authorizer to use on this Method, if the
-- type is CUSTOM or COGNITO_USER_POOLS. The authorizer identifier is
-- generated by API Gateway when you created the authorizer.
putMethod_authorizerId :: Lens.Lens' PutMethod (Prelude.Maybe Prelude.Text)
putMethod_authorizerId :: Lens' PutMethod (Maybe Text)
putMethod_authorizerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Maybe Text
authorizerId :: Maybe Text
$sel:authorizerId:PutMethod' :: PutMethod -> Maybe Text
authorizerId} -> Maybe Text
authorizerId) (\s :: PutMethod
s@PutMethod' {} Maybe Text
a -> PutMethod
s {$sel:authorizerId:PutMethod' :: Maybe Text
authorizerId = Maybe Text
a} :: PutMethod)

-- | 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.
putMethod_operationName :: Lens.Lens' PutMethod (Prelude.Maybe Prelude.Text)
putMethod_operationName :: Lens' PutMethod (Maybe Text)
putMethod_operationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Maybe Text
operationName :: Maybe Text
$sel:operationName:PutMethod' :: PutMethod -> Maybe Text
operationName} -> Maybe Text
operationName) (\s :: PutMethod
s@PutMethod' {} Maybe Text
a -> PutMethod
s {$sel:operationName:PutMethod' :: Maybe Text
operationName = Maybe Text
a} :: PutMethod)

-- | Specifies the Model resources used for the request\'s content type.
-- Request models are represented as a key\/value map, with a content type
-- as the key and a Model name as the value.
putMethod_requestModels :: Lens.Lens' PutMethod (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
putMethod_requestModels :: Lens' PutMethod (Maybe (HashMap Text Text))
putMethod_requestModels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Maybe (HashMap Text Text)
requestModels :: Maybe (HashMap Text Text)
$sel:requestModels:PutMethod' :: PutMethod -> Maybe (HashMap Text Text)
requestModels} -> Maybe (HashMap Text Text)
requestModels) (\s :: PutMethod
s@PutMethod' {} Maybe (HashMap Text Text)
a -> PutMethod
s {$sel:requestModels:PutMethod' :: Maybe (HashMap Text Text)
requestModels = Maybe (HashMap Text Text)
a} :: PutMethod) 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 defines 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 body-mapping templates.
putMethod_requestParameters :: Lens.Lens' PutMethod (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Bool))
putMethod_requestParameters :: Lens' PutMethod (Maybe (HashMap Text Bool))
putMethod_requestParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Maybe (HashMap Text Bool)
requestParameters :: Maybe (HashMap Text Bool)
$sel:requestParameters:PutMethod' :: PutMethod -> Maybe (HashMap Text Bool)
requestParameters} -> Maybe (HashMap Text Bool)
requestParameters) (\s :: PutMethod
s@PutMethod' {} Maybe (HashMap Text Bool)
a -> PutMethod
s {$sel:requestParameters:PutMethod' :: Maybe (HashMap Text Bool)
requestParameters = Maybe (HashMap Text Bool)
a} :: PutMethod) 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 validating the method request.
putMethod_requestValidatorId :: Lens.Lens' PutMethod (Prelude.Maybe Prelude.Text)
putMethod_requestValidatorId :: Lens' PutMethod (Maybe Text)
putMethod_requestValidatorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Maybe Text
requestValidatorId :: Maybe Text
$sel:requestValidatorId:PutMethod' :: PutMethod -> Maybe Text
requestValidatorId} -> Maybe Text
requestValidatorId) (\s :: PutMethod
s@PutMethod' {} Maybe Text
a -> PutMethod
s {$sel:requestValidatorId:PutMethod' :: Maybe Text
requestValidatorId = Maybe Text
a} :: PutMethod)

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

-- | The Resource identifier for the new Method resource.
putMethod_resourceId :: Lens.Lens' PutMethod Prelude.Text
putMethod_resourceId :: Lens' PutMethod Text
putMethod_resourceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Text
resourceId :: Text
$sel:resourceId:PutMethod' :: PutMethod -> Text
resourceId} -> Text
resourceId) (\s :: PutMethod
s@PutMethod' {} Text
a -> PutMethod
s {$sel:resourceId:PutMethod' :: Text
resourceId = Text
a} :: PutMethod)

-- | Specifies the method request\'s HTTP method type.
putMethod_httpMethod :: Lens.Lens' PutMethod Prelude.Text
putMethod_httpMethod :: Lens' PutMethod Text
putMethod_httpMethod = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Text
httpMethod :: Text
$sel:httpMethod:PutMethod' :: PutMethod -> Text
httpMethod} -> Text
httpMethod) (\s :: PutMethod
s@PutMethod' {} Text
a -> PutMethod
s {$sel:httpMethod:PutMethod' :: Text
httpMethod = Text
a} :: PutMethod)

-- | 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.
putMethod_authorizationType :: Lens.Lens' PutMethod Prelude.Text
putMethod_authorizationType :: Lens' PutMethod Text
putMethod_authorizationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutMethod' {Text
authorizationType :: Text
$sel:authorizationType:PutMethod' :: PutMethod -> Text
authorizationType} -> Text
authorizationType) (\s :: PutMethod
s@PutMethod' {} Text
a -> PutMethod
s {$sel:authorizationType:PutMethod' :: Text
authorizationType = Text
a} :: PutMethod)

instance Core.AWSRequest PutMethod where
  type AWSResponse PutMethod = Method
  request :: (Service -> Service) -> PutMethod -> Request PutMethod
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutMethod
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutMethod)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)

instance Prelude.Hashable PutMethod where
  hashWithSalt :: Int -> PutMethod -> Int
hashWithSalt Int
_salt PutMethod' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
Text
authorizationType :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
requestValidatorId :: Maybe Text
requestParameters :: Maybe (HashMap Text Bool)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
authorizerId :: Maybe Text
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:authorizationType:PutMethod' :: PutMethod -> Text
$sel:httpMethod:PutMethod' :: PutMethod -> Text
$sel:resourceId:PutMethod' :: PutMethod -> Text
$sel:restApiId:PutMethod' :: PutMethod -> Text
$sel:requestValidatorId:PutMethod' :: PutMethod -> Maybe Text
$sel:requestParameters:PutMethod' :: PutMethod -> Maybe (HashMap Text Bool)
$sel:requestModels:PutMethod' :: PutMethod -> Maybe (HashMap Text Text)
$sel:operationName:PutMethod' :: PutMethod -> Maybe Text
$sel:authorizerId:PutMethod' :: PutMethod -> Maybe Text
$sel:authorizationScopes:PutMethod' :: PutMethod -> Maybe [Text]
$sel:apiKeyRequired:PutMethod' :: PutMethod -> 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
authorizerId
      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
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
restApiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
httpMethod
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
authorizationType

instance Prelude.NFData PutMethod where
  rnf :: PutMethod -> ()
rnf PutMethod' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
Text
authorizationType :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
requestValidatorId :: Maybe Text
requestParameters :: Maybe (HashMap Text Bool)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
authorizerId :: Maybe Text
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:authorizationType:PutMethod' :: PutMethod -> Text
$sel:httpMethod:PutMethod' :: PutMethod -> Text
$sel:resourceId:PutMethod' :: PutMethod -> Text
$sel:restApiId:PutMethod' :: PutMethod -> Text
$sel:requestValidatorId:PutMethod' :: PutMethod -> Maybe Text
$sel:requestParameters:PutMethod' :: PutMethod -> Maybe (HashMap Text Bool)
$sel:requestModels:PutMethod' :: PutMethod -> Maybe (HashMap Text Text)
$sel:operationName:PutMethod' :: PutMethod -> Maybe Text
$sel:authorizerId:PutMethod' :: PutMethod -> Maybe Text
$sel:authorizationScopes:PutMethod' :: PutMethod -> Maybe [Text]
$sel:apiKeyRequired:PutMethod' :: PutMethod -> 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
authorizerId
      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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
restApiId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
httpMethod
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
authorizationType

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

instance Data.ToJSON PutMethod where
  toJSON :: PutMethod -> Value
toJSON PutMethod' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
Text
authorizationType :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
requestValidatorId :: Maybe Text
requestParameters :: Maybe (HashMap Text Bool)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
authorizerId :: Maybe Text
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:authorizationType:PutMethod' :: PutMethod -> Text
$sel:httpMethod:PutMethod' :: PutMethod -> Text
$sel:resourceId:PutMethod' :: PutMethod -> Text
$sel:restApiId:PutMethod' :: PutMethod -> Text
$sel:requestValidatorId:PutMethod' :: PutMethod -> Maybe Text
$sel:requestParameters:PutMethod' :: PutMethod -> Maybe (HashMap Text Bool)
$sel:requestModels:PutMethod' :: PutMethod -> Maybe (HashMap Text Text)
$sel:operationName:PutMethod' :: PutMethod -> Maybe Text
$sel:authorizerId:PutMethod' :: PutMethod -> Maybe Text
$sel:authorizationScopes:PutMethod' :: PutMethod -> Maybe [Text]
$sel:apiKeyRequired:PutMethod' :: PutMethod -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"apiKeyRequired" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
apiKeyRequired,
            (Key
"authorizationScopes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
authorizationScopes,
            (Key
"authorizerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
authorizerId,
            (Key
"operationName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
operationName,
            (Key
"requestModels" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
requestModels,
            (Key
"requestParameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Bool)
requestParameters,
            (Key
"requestValidatorId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
requestValidatorId,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"authorizationType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
authorizationType)
          ]
      )

instance Data.ToPath PutMethod where
  toPath :: PutMethod -> ByteString
toPath PutMethod' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Bool)
Maybe (HashMap Text Text)
Text
authorizationType :: Text
httpMethod :: Text
resourceId :: Text
restApiId :: Text
requestValidatorId :: Maybe Text
requestParameters :: Maybe (HashMap Text Bool)
requestModels :: Maybe (HashMap Text Text)
operationName :: Maybe Text
authorizerId :: Maybe Text
authorizationScopes :: Maybe [Text]
apiKeyRequired :: Maybe Bool
$sel:authorizationType:PutMethod' :: PutMethod -> Text
$sel:httpMethod:PutMethod' :: PutMethod -> Text
$sel:resourceId:PutMethod' :: PutMethod -> Text
$sel:restApiId:PutMethod' :: PutMethod -> Text
$sel:requestValidatorId:PutMethod' :: PutMethod -> Maybe Text
$sel:requestParameters:PutMethod' :: PutMethod -> Maybe (HashMap Text Bool)
$sel:requestModels:PutMethod' :: PutMethod -> Maybe (HashMap Text Text)
$sel:operationName:PutMethod' :: PutMethod -> Maybe Text
$sel:authorizerId:PutMethod' :: PutMethod -> Maybe Text
$sel:authorizationScopes:PutMethod' :: PutMethod -> Maybe [Text]
$sel:apiKeyRequired:PutMethod' :: PutMethod -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/restapis/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
restApiId,
        ByteString
"/resources/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
resourceId,
        ByteString
"/methods/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
httpMethod
      ]

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