{-# 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.AppFlow.Types.AmplitudeSourceProperties
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.AppFlow.Types.AmplitudeSourceProperties where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The properties that are applied when Amplitude is being used as a
-- source.
--
-- /See:/ 'newAmplitudeSourceProperties' smart constructor.
data AmplitudeSourceProperties = AmplitudeSourceProperties'
  { -- | The object specified in the Amplitude flow source.
    AmplitudeSourceProperties -> Text
object' :: Prelude.Text
  }
  deriving (AmplitudeSourceProperties -> AmplitudeSourceProperties -> Bool
(AmplitudeSourceProperties -> AmplitudeSourceProperties -> Bool)
-> (AmplitudeSourceProperties -> AmplitudeSourceProperties -> Bool)
-> Eq AmplitudeSourceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AmplitudeSourceProperties -> AmplitudeSourceProperties -> Bool
$c/= :: AmplitudeSourceProperties -> AmplitudeSourceProperties -> Bool
== :: AmplitudeSourceProperties -> AmplitudeSourceProperties -> Bool
$c== :: AmplitudeSourceProperties -> AmplitudeSourceProperties -> Bool
Prelude.Eq, ReadPrec [AmplitudeSourceProperties]
ReadPrec AmplitudeSourceProperties
Int -> ReadS AmplitudeSourceProperties
ReadS [AmplitudeSourceProperties]
(Int -> ReadS AmplitudeSourceProperties)
-> ReadS [AmplitudeSourceProperties]
-> ReadPrec AmplitudeSourceProperties
-> ReadPrec [AmplitudeSourceProperties]
-> Read AmplitudeSourceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AmplitudeSourceProperties]
$creadListPrec :: ReadPrec [AmplitudeSourceProperties]
readPrec :: ReadPrec AmplitudeSourceProperties
$creadPrec :: ReadPrec AmplitudeSourceProperties
readList :: ReadS [AmplitudeSourceProperties]
$creadList :: ReadS [AmplitudeSourceProperties]
readsPrec :: Int -> ReadS AmplitudeSourceProperties
$creadsPrec :: Int -> ReadS AmplitudeSourceProperties
Prelude.Read, Int -> AmplitudeSourceProperties -> ShowS
[AmplitudeSourceProperties] -> ShowS
AmplitudeSourceProperties -> String
(Int -> AmplitudeSourceProperties -> ShowS)
-> (AmplitudeSourceProperties -> String)
-> ([AmplitudeSourceProperties] -> ShowS)
-> Show AmplitudeSourceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AmplitudeSourceProperties] -> ShowS
$cshowList :: [AmplitudeSourceProperties] -> ShowS
show :: AmplitudeSourceProperties -> String
$cshow :: AmplitudeSourceProperties -> String
showsPrec :: Int -> AmplitudeSourceProperties -> ShowS
$cshowsPrec :: Int -> AmplitudeSourceProperties -> ShowS
Prelude.Show, (forall x.
 AmplitudeSourceProperties -> Rep AmplitudeSourceProperties x)
-> (forall x.
    Rep AmplitudeSourceProperties x -> AmplitudeSourceProperties)
-> Generic AmplitudeSourceProperties
forall x.
Rep AmplitudeSourceProperties x -> AmplitudeSourceProperties
forall x.
AmplitudeSourceProperties -> Rep AmplitudeSourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AmplitudeSourceProperties x -> AmplitudeSourceProperties
$cfrom :: forall x.
AmplitudeSourceProperties -> Rep AmplitudeSourceProperties x
Prelude.Generic)

-- |
-- Create a value of 'AmplitudeSourceProperties' 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:
--
-- 'object'', 'amplitudeSourceProperties_object' - The object specified in the Amplitude flow source.
newAmplitudeSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  AmplitudeSourceProperties
newAmplitudeSourceProperties :: Text -> AmplitudeSourceProperties
newAmplitudeSourceProperties Text
pObject_ =
  AmplitudeSourceProperties' :: Text -> AmplitudeSourceProperties
AmplitudeSourceProperties' {$sel:object':AmplitudeSourceProperties' :: Text
object' = Text
pObject_}

-- | The object specified in the Amplitude flow source.
amplitudeSourceProperties_object :: Lens.Lens' AmplitudeSourceProperties Prelude.Text
amplitudeSourceProperties_object :: (Text -> f Text)
-> AmplitudeSourceProperties -> f AmplitudeSourceProperties
amplitudeSourceProperties_object = (AmplitudeSourceProperties -> Text)
-> (AmplitudeSourceProperties -> Text -> AmplitudeSourceProperties)
-> Lens
     AmplitudeSourceProperties AmplitudeSourceProperties Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AmplitudeSourceProperties' {Text
object' :: Text
$sel:object':AmplitudeSourceProperties' :: AmplitudeSourceProperties -> Text
object'} -> Text
object') (\s :: AmplitudeSourceProperties
s@AmplitudeSourceProperties' {} Text
a -> AmplitudeSourceProperties
s {$sel:object':AmplitudeSourceProperties' :: Text
object' = Text
a} :: AmplitudeSourceProperties)

instance Core.FromJSON AmplitudeSourceProperties where
  parseJSON :: Value -> Parser AmplitudeSourceProperties
parseJSON =
    String
-> (Object -> Parser AmplitudeSourceProperties)
-> Value
-> Parser AmplitudeSourceProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AmplitudeSourceProperties"
      ( \Object
x ->
          Text -> AmplitudeSourceProperties
AmplitudeSourceProperties'
            (Text -> AmplitudeSourceProperties)
-> Parser Text -> Parser AmplitudeSourceProperties
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"object")
      )

instance Prelude.Hashable AmplitudeSourceProperties

instance Prelude.NFData AmplitudeSourceProperties

instance Core.ToJSON AmplitudeSourceProperties where
  toJSON :: AmplitudeSourceProperties -> Value
toJSON AmplitudeSourceProperties' {Text
object' :: Text
$sel:object':AmplitudeSourceProperties' :: AmplitudeSourceProperties -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"object" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
object')]
      )