{-# 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.Lambda.PutFunctionEventInvokeConfig
-- 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)
--
-- Configures options for
-- <https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html asynchronous invocation>
-- on a function, version, or alias. If a configuration already exists for
-- a function, version, or alias, this operation overwrites it. If you
-- exclude any settings, they are removed. To set one option without
-- affecting existing settings for other options, use
-- UpdateFunctionEventInvokeConfig.
--
-- By default, Lambda retries an asynchronous invocation twice if the
-- function returns an error. It retains events in a queue for up to six
-- hours. When an event fails all processing attempts or stays in the
-- asynchronous invocation queue for too long, Lambda discards it. To
-- retain discarded events, configure a dead-letter queue with
-- UpdateFunctionConfiguration.
--
-- To send an invocation record to a queue, topic, function, or event bus,
-- specify a
-- <https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations destination>.
-- You can configure separate destinations for successful invocations
-- (on-success) and events that fail all processing attempts (on-failure).
-- You can configure destinations in addition to or instead of a
-- dead-letter queue.
module Amazonka.Lambda.PutFunctionEventInvokeConfig
  ( -- * Creating a Request
    PutFunctionEventInvokeConfig (..),
    newPutFunctionEventInvokeConfig,

    -- * Request Lenses
    putFunctionEventInvokeConfig_maximumEventAgeInSeconds,
    putFunctionEventInvokeConfig_maximumRetryAttempts,
    putFunctionEventInvokeConfig_qualifier,
    putFunctionEventInvokeConfig_destinationConfig,
    putFunctionEventInvokeConfig_functionName,

    -- * Destructuring the Response
    FunctionEventInvokeConfig (..),
    newFunctionEventInvokeConfig,

    -- * Response Lenses
    functionEventInvokeConfig_functionArn,
    functionEventInvokeConfig_maximumEventAgeInSeconds,
    functionEventInvokeConfig_maximumRetryAttempts,
    functionEventInvokeConfig_lastModified,
    functionEventInvokeConfig_destinationConfig,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Lambda.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutFunctionEventInvokeConfig' smart constructor.
data PutFunctionEventInvokeConfig = PutFunctionEventInvokeConfig'
  { -- | The maximum age of a request that Lambda sends to a function for
    -- processing.
    PutFunctionEventInvokeConfig -> Maybe Natural
maximumEventAgeInSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The maximum number of times to retry when the function returns an error.
    PutFunctionEventInvokeConfig -> Maybe Natural
maximumRetryAttempts :: Prelude.Maybe Prelude.Natural,
    -- | A version number or alias name.
    PutFunctionEventInvokeConfig -> Maybe Text
qualifier :: Prelude.Maybe Prelude.Text,
    -- | A destination for events after they have been sent to a function for
    -- processing.
    --
    -- __Destinations__
    --
    -- -   __Function__ - The Amazon Resource Name (ARN) of a Lambda function.
    --
    -- -   __Queue__ - The ARN of an SQS queue.
    --
    -- -   __Topic__ - The ARN of an SNS topic.
    --
    -- -   __Event Bus__ - The ARN of an Amazon EventBridge event bus.
    PutFunctionEventInvokeConfig -> Maybe DestinationConfig
destinationConfig :: Prelude.Maybe DestinationConfig,
    -- | The name of the Lambda function, version, or alias.
    --
    -- __Name formats__
    --
    -- -   __Function name__ - @my-function@ (name-only), @my-function:v1@
    --     (with alias).
    --
    -- -   __Function ARN__ -
    --     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
    --
    -- -   __Partial ARN__ - @123456789012:function:my-function@.
    --
    -- You can append a version number or alias to any of the formats. The
    -- length constraint applies only to the full ARN. If you specify only the
    -- function name, it is limited to 64 characters in length.
    PutFunctionEventInvokeConfig -> Text
functionName :: Prelude.Text
  }
  deriving (PutFunctionEventInvokeConfig
-> PutFunctionEventInvokeConfig -> Bool
(PutFunctionEventInvokeConfig
 -> PutFunctionEventInvokeConfig -> Bool)
-> (PutFunctionEventInvokeConfig
    -> PutFunctionEventInvokeConfig -> Bool)
-> Eq PutFunctionEventInvokeConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutFunctionEventInvokeConfig
-> PutFunctionEventInvokeConfig -> Bool
$c/= :: PutFunctionEventInvokeConfig
-> PutFunctionEventInvokeConfig -> Bool
== :: PutFunctionEventInvokeConfig
-> PutFunctionEventInvokeConfig -> Bool
$c== :: PutFunctionEventInvokeConfig
-> PutFunctionEventInvokeConfig -> Bool
Prelude.Eq, ReadPrec [PutFunctionEventInvokeConfig]
ReadPrec PutFunctionEventInvokeConfig
Int -> ReadS PutFunctionEventInvokeConfig
ReadS [PutFunctionEventInvokeConfig]
(Int -> ReadS PutFunctionEventInvokeConfig)
-> ReadS [PutFunctionEventInvokeConfig]
-> ReadPrec PutFunctionEventInvokeConfig
-> ReadPrec [PutFunctionEventInvokeConfig]
-> Read PutFunctionEventInvokeConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutFunctionEventInvokeConfig]
$creadListPrec :: ReadPrec [PutFunctionEventInvokeConfig]
readPrec :: ReadPrec PutFunctionEventInvokeConfig
$creadPrec :: ReadPrec PutFunctionEventInvokeConfig
readList :: ReadS [PutFunctionEventInvokeConfig]
$creadList :: ReadS [PutFunctionEventInvokeConfig]
readsPrec :: Int -> ReadS PutFunctionEventInvokeConfig
$creadsPrec :: Int -> ReadS PutFunctionEventInvokeConfig
Prelude.Read, Int -> PutFunctionEventInvokeConfig -> ShowS
[PutFunctionEventInvokeConfig] -> ShowS
PutFunctionEventInvokeConfig -> String
(Int -> PutFunctionEventInvokeConfig -> ShowS)
-> (PutFunctionEventInvokeConfig -> String)
-> ([PutFunctionEventInvokeConfig] -> ShowS)
-> Show PutFunctionEventInvokeConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutFunctionEventInvokeConfig] -> ShowS
$cshowList :: [PutFunctionEventInvokeConfig] -> ShowS
show :: PutFunctionEventInvokeConfig -> String
$cshow :: PutFunctionEventInvokeConfig -> String
showsPrec :: Int -> PutFunctionEventInvokeConfig -> ShowS
$cshowsPrec :: Int -> PutFunctionEventInvokeConfig -> ShowS
Prelude.Show, (forall x.
 PutFunctionEventInvokeConfig -> Rep PutFunctionEventInvokeConfig x)
-> (forall x.
    Rep PutFunctionEventInvokeConfig x -> PutFunctionEventInvokeConfig)
-> Generic PutFunctionEventInvokeConfig
forall x.
Rep PutFunctionEventInvokeConfig x -> PutFunctionEventInvokeConfig
forall x.
PutFunctionEventInvokeConfig -> Rep PutFunctionEventInvokeConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutFunctionEventInvokeConfig x -> PutFunctionEventInvokeConfig
$cfrom :: forall x.
PutFunctionEventInvokeConfig -> Rep PutFunctionEventInvokeConfig x
Prelude.Generic)

-- |
-- Create a value of 'PutFunctionEventInvokeConfig' 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:
--
-- 'maximumEventAgeInSeconds', 'putFunctionEventInvokeConfig_maximumEventAgeInSeconds' - The maximum age of a request that Lambda sends to a function for
-- processing.
--
-- 'maximumRetryAttempts', 'putFunctionEventInvokeConfig_maximumRetryAttempts' - The maximum number of times to retry when the function returns an error.
--
-- 'qualifier', 'putFunctionEventInvokeConfig_qualifier' - A version number or alias name.
--
-- 'destinationConfig', 'putFunctionEventInvokeConfig_destinationConfig' - A destination for events after they have been sent to a function for
-- processing.
--
-- __Destinations__
--
-- -   __Function__ - The Amazon Resource Name (ARN) of a Lambda function.
--
-- -   __Queue__ - The ARN of an SQS queue.
--
-- -   __Topic__ - The ARN of an SNS topic.
--
-- -   __Event Bus__ - The ARN of an Amazon EventBridge event bus.
--
-- 'functionName', 'putFunctionEventInvokeConfig_functionName' - The name of the Lambda function, version, or alias.
--
-- __Name formats__
--
-- -   __Function name__ - @my-function@ (name-only), @my-function:v1@
--     (with alias).
--
-- -   __Function ARN__ -
--     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
--
-- -   __Partial ARN__ - @123456789012:function:my-function@.
--
-- You can append a version number or alias to any of the formats. The
-- length constraint applies only to the full ARN. If you specify only the
-- function name, it is limited to 64 characters in length.
newPutFunctionEventInvokeConfig ::
  -- | 'functionName'
  Prelude.Text ->
  PutFunctionEventInvokeConfig
newPutFunctionEventInvokeConfig :: Text -> PutFunctionEventInvokeConfig
newPutFunctionEventInvokeConfig Text
pFunctionName_ =
  PutFunctionEventInvokeConfig' :: Maybe Natural
-> Maybe Natural
-> Maybe Text
-> Maybe DestinationConfig
-> Text
-> PutFunctionEventInvokeConfig
PutFunctionEventInvokeConfig'
    { $sel:maximumEventAgeInSeconds:PutFunctionEventInvokeConfig' :: Maybe Natural
maximumEventAgeInSeconds =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumRetryAttempts:PutFunctionEventInvokeConfig' :: Maybe Natural
maximumRetryAttempts = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:qualifier:PutFunctionEventInvokeConfig' :: Maybe Text
qualifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationConfig:PutFunctionEventInvokeConfig' :: Maybe DestinationConfig
destinationConfig = Maybe DestinationConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:functionName:PutFunctionEventInvokeConfig' :: Text
functionName = Text
pFunctionName_
    }

-- | The maximum age of a request that Lambda sends to a function for
-- processing.
putFunctionEventInvokeConfig_maximumEventAgeInSeconds :: Lens.Lens' PutFunctionEventInvokeConfig (Prelude.Maybe Prelude.Natural)
putFunctionEventInvokeConfig_maximumEventAgeInSeconds :: (Maybe Natural -> f (Maybe Natural))
-> PutFunctionEventInvokeConfig -> f PutFunctionEventInvokeConfig
putFunctionEventInvokeConfig_maximumEventAgeInSeconds = (PutFunctionEventInvokeConfig -> Maybe Natural)
-> (PutFunctionEventInvokeConfig
    -> Maybe Natural -> PutFunctionEventInvokeConfig)
-> Lens
     PutFunctionEventInvokeConfig
     PutFunctionEventInvokeConfig
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutFunctionEventInvokeConfig' {Maybe Natural
maximumEventAgeInSeconds :: Maybe Natural
$sel:maximumEventAgeInSeconds:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Natural
maximumEventAgeInSeconds} -> Maybe Natural
maximumEventAgeInSeconds) (\s :: PutFunctionEventInvokeConfig
s@PutFunctionEventInvokeConfig' {} Maybe Natural
a -> PutFunctionEventInvokeConfig
s {$sel:maximumEventAgeInSeconds:PutFunctionEventInvokeConfig' :: Maybe Natural
maximumEventAgeInSeconds = Maybe Natural
a} :: PutFunctionEventInvokeConfig)

-- | The maximum number of times to retry when the function returns an error.
putFunctionEventInvokeConfig_maximumRetryAttempts :: Lens.Lens' PutFunctionEventInvokeConfig (Prelude.Maybe Prelude.Natural)
putFunctionEventInvokeConfig_maximumRetryAttempts :: (Maybe Natural -> f (Maybe Natural))
-> PutFunctionEventInvokeConfig -> f PutFunctionEventInvokeConfig
putFunctionEventInvokeConfig_maximumRetryAttempts = (PutFunctionEventInvokeConfig -> Maybe Natural)
-> (PutFunctionEventInvokeConfig
    -> Maybe Natural -> PutFunctionEventInvokeConfig)
-> Lens
     PutFunctionEventInvokeConfig
     PutFunctionEventInvokeConfig
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutFunctionEventInvokeConfig' {Maybe Natural
maximumRetryAttempts :: Maybe Natural
$sel:maximumRetryAttempts:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Natural
maximumRetryAttempts} -> Maybe Natural
maximumRetryAttempts) (\s :: PutFunctionEventInvokeConfig
s@PutFunctionEventInvokeConfig' {} Maybe Natural
a -> PutFunctionEventInvokeConfig
s {$sel:maximumRetryAttempts:PutFunctionEventInvokeConfig' :: Maybe Natural
maximumRetryAttempts = Maybe Natural
a} :: PutFunctionEventInvokeConfig)

-- | A version number or alias name.
putFunctionEventInvokeConfig_qualifier :: Lens.Lens' PutFunctionEventInvokeConfig (Prelude.Maybe Prelude.Text)
putFunctionEventInvokeConfig_qualifier :: (Maybe Text -> f (Maybe Text))
-> PutFunctionEventInvokeConfig -> f PutFunctionEventInvokeConfig
putFunctionEventInvokeConfig_qualifier = (PutFunctionEventInvokeConfig -> Maybe Text)
-> (PutFunctionEventInvokeConfig
    -> Maybe Text -> PutFunctionEventInvokeConfig)
-> Lens
     PutFunctionEventInvokeConfig
     PutFunctionEventInvokeConfig
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutFunctionEventInvokeConfig' {Maybe Text
qualifier :: Maybe Text
$sel:qualifier:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Text
qualifier} -> Maybe Text
qualifier) (\s :: PutFunctionEventInvokeConfig
s@PutFunctionEventInvokeConfig' {} Maybe Text
a -> PutFunctionEventInvokeConfig
s {$sel:qualifier:PutFunctionEventInvokeConfig' :: Maybe Text
qualifier = Maybe Text
a} :: PutFunctionEventInvokeConfig)

-- | A destination for events after they have been sent to a function for
-- processing.
--
-- __Destinations__
--
-- -   __Function__ - The Amazon Resource Name (ARN) of a Lambda function.
--
-- -   __Queue__ - The ARN of an SQS queue.
--
-- -   __Topic__ - The ARN of an SNS topic.
--
-- -   __Event Bus__ - The ARN of an Amazon EventBridge event bus.
putFunctionEventInvokeConfig_destinationConfig :: Lens.Lens' PutFunctionEventInvokeConfig (Prelude.Maybe DestinationConfig)
putFunctionEventInvokeConfig_destinationConfig :: (Maybe DestinationConfig -> f (Maybe DestinationConfig))
-> PutFunctionEventInvokeConfig -> f PutFunctionEventInvokeConfig
putFunctionEventInvokeConfig_destinationConfig = (PutFunctionEventInvokeConfig -> Maybe DestinationConfig)
-> (PutFunctionEventInvokeConfig
    -> Maybe DestinationConfig -> PutFunctionEventInvokeConfig)
-> Lens
     PutFunctionEventInvokeConfig
     PutFunctionEventInvokeConfig
     (Maybe DestinationConfig)
     (Maybe DestinationConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutFunctionEventInvokeConfig' {Maybe DestinationConfig
destinationConfig :: Maybe DestinationConfig
$sel:destinationConfig:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe DestinationConfig
destinationConfig} -> Maybe DestinationConfig
destinationConfig) (\s :: PutFunctionEventInvokeConfig
s@PutFunctionEventInvokeConfig' {} Maybe DestinationConfig
a -> PutFunctionEventInvokeConfig
s {$sel:destinationConfig:PutFunctionEventInvokeConfig' :: Maybe DestinationConfig
destinationConfig = Maybe DestinationConfig
a} :: PutFunctionEventInvokeConfig)

-- | The name of the Lambda function, version, or alias.
--
-- __Name formats__
--
-- -   __Function name__ - @my-function@ (name-only), @my-function:v1@
--     (with alias).
--
-- -   __Function ARN__ -
--     @arn:aws:lambda:us-west-2:123456789012:function:my-function@.
--
-- -   __Partial ARN__ - @123456789012:function:my-function@.
--
-- You can append a version number or alias to any of the formats. The
-- length constraint applies only to the full ARN. If you specify only the
-- function name, it is limited to 64 characters in length.
putFunctionEventInvokeConfig_functionName :: Lens.Lens' PutFunctionEventInvokeConfig Prelude.Text
putFunctionEventInvokeConfig_functionName :: (Text -> f Text)
-> PutFunctionEventInvokeConfig -> f PutFunctionEventInvokeConfig
putFunctionEventInvokeConfig_functionName = (PutFunctionEventInvokeConfig -> Text)
-> (PutFunctionEventInvokeConfig
    -> Text -> PutFunctionEventInvokeConfig)
-> Lens
     PutFunctionEventInvokeConfig PutFunctionEventInvokeConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutFunctionEventInvokeConfig' {Text
functionName :: Text
$sel:functionName:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Text
functionName} -> Text
functionName) (\s :: PutFunctionEventInvokeConfig
s@PutFunctionEventInvokeConfig' {} Text
a -> PutFunctionEventInvokeConfig
s {$sel:functionName:PutFunctionEventInvokeConfig' :: Text
functionName = Text
a} :: PutFunctionEventInvokeConfig)

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

instance
  Prelude.Hashable
    PutFunctionEventInvokeConfig

instance Prelude.NFData PutFunctionEventInvokeConfig

instance Core.ToHeaders PutFunctionEventInvokeConfig where
  toHeaders :: PutFunctionEventInvokeConfig -> ResponseHeaders
toHeaders = ResponseHeaders -> PutFunctionEventInvokeConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON PutFunctionEventInvokeConfig where
  toJSON :: PutFunctionEventInvokeConfig -> Value
toJSON PutFunctionEventInvokeConfig' {Maybe Natural
Maybe Text
Maybe DestinationConfig
Text
functionName :: Text
destinationConfig :: Maybe DestinationConfig
qualifier :: Maybe Text
maximumRetryAttempts :: Maybe Natural
maximumEventAgeInSeconds :: Maybe Natural
$sel:functionName:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Text
$sel:destinationConfig:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe DestinationConfig
$sel:qualifier:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Text
$sel:maximumRetryAttempts:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Natural
$sel:maximumEventAgeInSeconds:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MaximumEventAgeInSeconds" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maximumEventAgeInSeconds,
            (Text
"MaximumRetryAttempts" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maximumRetryAttempts,
            (Text
"DestinationConfig" Text -> DestinationConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DestinationConfig -> Pair)
-> Maybe DestinationConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DestinationConfig
destinationConfig
          ]
      )

instance Core.ToPath PutFunctionEventInvokeConfig where
  toPath :: PutFunctionEventInvokeConfig -> ByteString
toPath PutFunctionEventInvokeConfig' {Maybe Natural
Maybe Text
Maybe DestinationConfig
Text
functionName :: Text
destinationConfig :: Maybe DestinationConfig
qualifier :: Maybe Text
maximumRetryAttempts :: Maybe Natural
maximumEventAgeInSeconds :: Maybe Natural
$sel:functionName:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Text
$sel:destinationConfig:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe DestinationConfig
$sel:qualifier:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Text
$sel:maximumRetryAttempts:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Natural
$sel:maximumEventAgeInSeconds:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Natural
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2019-09-25/functions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
functionName,
        ByteString
"/event-invoke-config"
      ]

instance Core.ToQuery PutFunctionEventInvokeConfig where
  toQuery :: PutFunctionEventInvokeConfig -> QueryString
toQuery PutFunctionEventInvokeConfig' {Maybe Natural
Maybe Text
Maybe DestinationConfig
Text
functionName :: Text
destinationConfig :: Maybe DestinationConfig
qualifier :: Maybe Text
maximumRetryAttempts :: Maybe Natural
maximumEventAgeInSeconds :: Maybe Natural
$sel:functionName:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Text
$sel:destinationConfig:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe DestinationConfig
$sel:qualifier:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Text
$sel:maximumRetryAttempts:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Natural
$sel:maximumEventAgeInSeconds:PutFunctionEventInvokeConfig' :: PutFunctionEventInvokeConfig -> Maybe Natural
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"Qualifier" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
qualifier]