{-# 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.Pipes.Types.PipeEnrichmentParameters
-- 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.Pipes.Types.PipeEnrichmentParameters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pipes.Types.PipeEnrichmentHttpParameters
import qualified Amazonka.Prelude as Prelude

-- | The parameters required to set up enrichment on your pipe.
--
-- /See:/ 'newPipeEnrichmentParameters' smart constructor.
data PipeEnrichmentParameters = PipeEnrichmentParameters'
  { -- | Contains the HTTP parameters to use when the target is a API Gateway
    -- REST endpoint or EventBridge ApiDestination.
    --
    -- If you specify an API Gateway REST API or EventBridge ApiDestination as
    -- a target, you can use this parameter to specify headers, path
    -- parameters, and query string keys\/values as part of your target
    -- invoking request. If you\'re using ApiDestinations, the corresponding
    -- Connection can also have these values configured. In case of any
    -- conflicting keys, values from the Connection take precedence.
    PipeEnrichmentParameters -> Maybe PipeEnrichmentHttpParameters
httpParameters :: Prelude.Maybe PipeEnrichmentHttpParameters,
    -- | Valid JSON text passed to the enrichment. In this case, nothing from the
    -- event itself is passed to the enrichment. For more information, see
    -- <http://www.rfc-editor.org/rfc/rfc7159.txt The JavaScript Object Notation (JSON) Data Interchange Format>.
    PipeEnrichmentParameters -> Maybe (Sensitive Text)
inputTemplate :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (PipeEnrichmentParameters -> PipeEnrichmentParameters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipeEnrichmentParameters -> PipeEnrichmentParameters -> Bool
$c/= :: PipeEnrichmentParameters -> PipeEnrichmentParameters -> Bool
== :: PipeEnrichmentParameters -> PipeEnrichmentParameters -> Bool
$c== :: PipeEnrichmentParameters -> PipeEnrichmentParameters -> Bool
Prelude.Eq, Int -> PipeEnrichmentParameters -> ShowS
[PipeEnrichmentParameters] -> ShowS
PipeEnrichmentParameters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipeEnrichmentParameters] -> ShowS
$cshowList :: [PipeEnrichmentParameters] -> ShowS
show :: PipeEnrichmentParameters -> String
$cshow :: PipeEnrichmentParameters -> String
showsPrec :: Int -> PipeEnrichmentParameters -> ShowS
$cshowsPrec :: Int -> PipeEnrichmentParameters -> ShowS
Prelude.Show, forall x.
Rep PipeEnrichmentParameters x -> PipeEnrichmentParameters
forall x.
PipeEnrichmentParameters -> Rep PipeEnrichmentParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PipeEnrichmentParameters x -> PipeEnrichmentParameters
$cfrom :: forall x.
PipeEnrichmentParameters -> Rep PipeEnrichmentParameters x
Prelude.Generic)

-- |
-- Create a value of 'PipeEnrichmentParameters' 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:
--
-- 'httpParameters', 'pipeEnrichmentParameters_httpParameters' - Contains the HTTP parameters to use when the target is a API Gateway
-- REST endpoint or EventBridge ApiDestination.
--
-- If you specify an API Gateway REST API or EventBridge ApiDestination as
-- a target, you can use this parameter to specify headers, path
-- parameters, and query string keys\/values as part of your target
-- invoking request. If you\'re using ApiDestinations, the corresponding
-- Connection can also have these values configured. In case of any
-- conflicting keys, values from the Connection take precedence.
--
-- 'inputTemplate', 'pipeEnrichmentParameters_inputTemplate' - Valid JSON text passed to the enrichment. In this case, nothing from the
-- event itself is passed to the enrichment. For more information, see
-- <http://www.rfc-editor.org/rfc/rfc7159.txt The JavaScript Object Notation (JSON) Data Interchange Format>.
newPipeEnrichmentParameters ::
  PipeEnrichmentParameters
newPipeEnrichmentParameters :: PipeEnrichmentParameters
newPipeEnrichmentParameters =
  PipeEnrichmentParameters'
    { $sel:httpParameters:PipeEnrichmentParameters' :: Maybe PipeEnrichmentHttpParameters
httpParameters =
        forall a. Maybe a
Prelude.Nothing,
      $sel:inputTemplate:PipeEnrichmentParameters' :: Maybe (Sensitive Text)
inputTemplate = forall a. Maybe a
Prelude.Nothing
    }

-- | Contains the HTTP parameters to use when the target is a API Gateway
-- REST endpoint or EventBridge ApiDestination.
--
-- If you specify an API Gateway REST API or EventBridge ApiDestination as
-- a target, you can use this parameter to specify headers, path
-- parameters, and query string keys\/values as part of your target
-- invoking request. If you\'re using ApiDestinations, the corresponding
-- Connection can also have these values configured. In case of any
-- conflicting keys, values from the Connection take precedence.
pipeEnrichmentParameters_httpParameters :: Lens.Lens' PipeEnrichmentParameters (Prelude.Maybe PipeEnrichmentHttpParameters)
pipeEnrichmentParameters_httpParameters :: Lens' PipeEnrichmentParameters (Maybe PipeEnrichmentHttpParameters)
pipeEnrichmentParameters_httpParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipeEnrichmentParameters' {Maybe PipeEnrichmentHttpParameters
httpParameters :: Maybe PipeEnrichmentHttpParameters
$sel:httpParameters:PipeEnrichmentParameters' :: PipeEnrichmentParameters -> Maybe PipeEnrichmentHttpParameters
httpParameters} -> Maybe PipeEnrichmentHttpParameters
httpParameters) (\s :: PipeEnrichmentParameters
s@PipeEnrichmentParameters' {} Maybe PipeEnrichmentHttpParameters
a -> PipeEnrichmentParameters
s {$sel:httpParameters:PipeEnrichmentParameters' :: Maybe PipeEnrichmentHttpParameters
httpParameters = Maybe PipeEnrichmentHttpParameters
a} :: PipeEnrichmentParameters)

-- | Valid JSON text passed to the enrichment. In this case, nothing from the
-- event itself is passed to the enrichment. For more information, see
-- <http://www.rfc-editor.org/rfc/rfc7159.txt The JavaScript Object Notation (JSON) Data Interchange Format>.
pipeEnrichmentParameters_inputTemplate :: Lens.Lens' PipeEnrichmentParameters (Prelude.Maybe Prelude.Text)
pipeEnrichmentParameters_inputTemplate :: Lens' PipeEnrichmentParameters (Maybe Text)
pipeEnrichmentParameters_inputTemplate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipeEnrichmentParameters' {Maybe (Sensitive Text)
inputTemplate :: Maybe (Sensitive Text)
$sel:inputTemplate:PipeEnrichmentParameters' :: PipeEnrichmentParameters -> Maybe (Sensitive Text)
inputTemplate} -> Maybe (Sensitive Text)
inputTemplate) (\s :: PipeEnrichmentParameters
s@PipeEnrichmentParameters' {} Maybe (Sensitive Text)
a -> PipeEnrichmentParameters
s {$sel:inputTemplate:PipeEnrichmentParameters' :: Maybe (Sensitive Text)
inputTemplate = Maybe (Sensitive Text)
a} :: PipeEnrichmentParameters) 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 a. Iso' (Sensitive a) a
Data._Sensitive

instance Data.FromJSON PipeEnrichmentParameters where
  parseJSON :: Value -> Parser PipeEnrichmentParameters
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PipeEnrichmentParameters"
      ( \Object
x ->
          Maybe PipeEnrichmentHttpParameters
-> Maybe (Sensitive Text) -> PipeEnrichmentParameters
PipeEnrichmentParameters'
            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
"HttpParameters")
            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
"InputTemplate")
      )

instance Prelude.Hashable PipeEnrichmentParameters where
  hashWithSalt :: Int -> PipeEnrichmentParameters -> Int
hashWithSalt Int
_salt PipeEnrichmentParameters' {Maybe (Sensitive Text)
Maybe PipeEnrichmentHttpParameters
inputTemplate :: Maybe (Sensitive Text)
httpParameters :: Maybe PipeEnrichmentHttpParameters
$sel:inputTemplate:PipeEnrichmentParameters' :: PipeEnrichmentParameters -> Maybe (Sensitive Text)
$sel:httpParameters:PipeEnrichmentParameters' :: PipeEnrichmentParameters -> Maybe PipeEnrichmentHttpParameters
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PipeEnrichmentHttpParameters
httpParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
inputTemplate

instance Prelude.NFData PipeEnrichmentParameters where
  rnf :: PipeEnrichmentParameters -> ()
rnf PipeEnrichmentParameters' {Maybe (Sensitive Text)
Maybe PipeEnrichmentHttpParameters
inputTemplate :: Maybe (Sensitive Text)
httpParameters :: Maybe PipeEnrichmentHttpParameters
$sel:inputTemplate:PipeEnrichmentParameters' :: PipeEnrichmentParameters -> Maybe (Sensitive Text)
$sel:httpParameters:PipeEnrichmentParameters' :: PipeEnrichmentParameters -> Maybe PipeEnrichmentHttpParameters
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PipeEnrichmentHttpParameters
httpParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
inputTemplate

instance Data.ToJSON PipeEnrichmentParameters where
  toJSON :: PipeEnrichmentParameters -> Value
toJSON PipeEnrichmentParameters' {Maybe (Sensitive Text)
Maybe PipeEnrichmentHttpParameters
inputTemplate :: Maybe (Sensitive Text)
httpParameters :: Maybe PipeEnrichmentHttpParameters
$sel:inputTemplate:PipeEnrichmentParameters' :: PipeEnrichmentParameters -> Maybe (Sensitive Text)
$sel:httpParameters:PipeEnrichmentParameters' :: PipeEnrichmentParameters -> Maybe PipeEnrichmentHttpParameters
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"HttpParameters" 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 PipeEnrichmentHttpParameters
httpParameters,
            (Key
"InputTemplate" 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 (Sensitive Text)
inputTemplate
          ]
      )