{-# 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.MarketoSourceProperties
-- 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.MarketoSourceProperties 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 Marketo is being used as a source.
--
-- /See:/ 'newMarketoSourceProperties' smart constructor.
data MarketoSourceProperties = MarketoSourceProperties'
  { -- | The object specified in the Marketo flow source.
    MarketoSourceProperties -> Text
object' :: Prelude.Text
  }
  deriving (MarketoSourceProperties -> MarketoSourceProperties -> Bool
(MarketoSourceProperties -> MarketoSourceProperties -> Bool)
-> (MarketoSourceProperties -> MarketoSourceProperties -> Bool)
-> Eq MarketoSourceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MarketoSourceProperties -> MarketoSourceProperties -> Bool
$c/= :: MarketoSourceProperties -> MarketoSourceProperties -> Bool
== :: MarketoSourceProperties -> MarketoSourceProperties -> Bool
$c== :: MarketoSourceProperties -> MarketoSourceProperties -> Bool
Prelude.Eq, ReadPrec [MarketoSourceProperties]
ReadPrec MarketoSourceProperties
Int -> ReadS MarketoSourceProperties
ReadS [MarketoSourceProperties]
(Int -> ReadS MarketoSourceProperties)
-> ReadS [MarketoSourceProperties]
-> ReadPrec MarketoSourceProperties
-> ReadPrec [MarketoSourceProperties]
-> Read MarketoSourceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MarketoSourceProperties]
$creadListPrec :: ReadPrec [MarketoSourceProperties]
readPrec :: ReadPrec MarketoSourceProperties
$creadPrec :: ReadPrec MarketoSourceProperties
readList :: ReadS [MarketoSourceProperties]
$creadList :: ReadS [MarketoSourceProperties]
readsPrec :: Int -> ReadS MarketoSourceProperties
$creadsPrec :: Int -> ReadS MarketoSourceProperties
Prelude.Read, Int -> MarketoSourceProperties -> ShowS
[MarketoSourceProperties] -> ShowS
MarketoSourceProperties -> String
(Int -> MarketoSourceProperties -> ShowS)
-> (MarketoSourceProperties -> String)
-> ([MarketoSourceProperties] -> ShowS)
-> Show MarketoSourceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MarketoSourceProperties] -> ShowS
$cshowList :: [MarketoSourceProperties] -> ShowS
show :: MarketoSourceProperties -> String
$cshow :: MarketoSourceProperties -> String
showsPrec :: Int -> MarketoSourceProperties -> ShowS
$cshowsPrec :: Int -> MarketoSourceProperties -> ShowS
Prelude.Show, (forall x.
 MarketoSourceProperties -> Rep MarketoSourceProperties x)
-> (forall x.
    Rep MarketoSourceProperties x -> MarketoSourceProperties)
-> Generic MarketoSourceProperties
forall x. Rep MarketoSourceProperties x -> MarketoSourceProperties
forall x. MarketoSourceProperties -> Rep MarketoSourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MarketoSourceProperties x -> MarketoSourceProperties
$cfrom :: forall x. MarketoSourceProperties -> Rep MarketoSourceProperties x
Prelude.Generic)

-- |
-- Create a value of 'MarketoSourceProperties' 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'', 'marketoSourceProperties_object' - The object specified in the Marketo flow source.
newMarketoSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  MarketoSourceProperties
newMarketoSourceProperties :: Text -> MarketoSourceProperties
newMarketoSourceProperties Text
pObject_ =
  MarketoSourceProperties' :: Text -> MarketoSourceProperties
MarketoSourceProperties' {$sel:object':MarketoSourceProperties' :: Text
object' = Text
pObject_}

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

instance Core.FromJSON MarketoSourceProperties where
  parseJSON :: Value -> Parser MarketoSourceProperties
parseJSON =
    String
-> (Object -> Parser MarketoSourceProperties)
-> Value
-> Parser MarketoSourceProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MarketoSourceProperties"
      ( \Object
x ->
          Text -> MarketoSourceProperties
MarketoSourceProperties'
            (Text -> MarketoSourceProperties)
-> Parser Text -> Parser MarketoSourceProperties
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 MarketoSourceProperties

instance Prelude.NFData MarketoSourceProperties

instance Core.ToJSON MarketoSourceProperties where
  toJSON :: MarketoSourceProperties -> Value
toJSON MarketoSourceProperties' {Text
object' :: Text
$sel:object':MarketoSourceProperties' :: MarketoSourceProperties -> 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')]
      )