{-# 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.CustomerProfiles.Types.SalesforceSourceProperties
-- 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.CustomerProfiles.Types.SalesforceSourceProperties 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 Salesforce is being used as a
-- source.
--
-- /See:/ 'newSalesforceSourceProperties' smart constructor.
data SalesforceSourceProperties = SalesforceSourceProperties'
  { -- | The flag that enables dynamic fetching of new (recently added) fields in
    -- the Salesforce objects while running a flow.
    SalesforceSourceProperties -> Maybe Bool
enableDynamicFieldUpdate :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether Amazon AppFlow includes deleted files in the flow run.
    SalesforceSourceProperties -> Maybe Bool
includeDeletedRecords :: Prelude.Maybe Prelude.Bool,
    -- | The object specified in the Salesforce flow source.
    SalesforceSourceProperties -> Text
object' :: Prelude.Text
  }
  deriving (SalesforceSourceProperties -> SalesforceSourceProperties -> Bool
(SalesforceSourceProperties -> SalesforceSourceProperties -> Bool)
-> (SalesforceSourceProperties
    -> SalesforceSourceProperties -> Bool)
-> Eq SalesforceSourceProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SalesforceSourceProperties -> SalesforceSourceProperties -> Bool
$c/= :: SalesforceSourceProperties -> SalesforceSourceProperties -> Bool
== :: SalesforceSourceProperties -> SalesforceSourceProperties -> Bool
$c== :: SalesforceSourceProperties -> SalesforceSourceProperties -> Bool
Prelude.Eq, ReadPrec [SalesforceSourceProperties]
ReadPrec SalesforceSourceProperties
Int -> ReadS SalesforceSourceProperties
ReadS [SalesforceSourceProperties]
(Int -> ReadS SalesforceSourceProperties)
-> ReadS [SalesforceSourceProperties]
-> ReadPrec SalesforceSourceProperties
-> ReadPrec [SalesforceSourceProperties]
-> Read SalesforceSourceProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SalesforceSourceProperties]
$creadListPrec :: ReadPrec [SalesforceSourceProperties]
readPrec :: ReadPrec SalesforceSourceProperties
$creadPrec :: ReadPrec SalesforceSourceProperties
readList :: ReadS [SalesforceSourceProperties]
$creadList :: ReadS [SalesforceSourceProperties]
readsPrec :: Int -> ReadS SalesforceSourceProperties
$creadsPrec :: Int -> ReadS SalesforceSourceProperties
Prelude.Read, Int -> SalesforceSourceProperties -> ShowS
[SalesforceSourceProperties] -> ShowS
SalesforceSourceProperties -> String
(Int -> SalesforceSourceProperties -> ShowS)
-> (SalesforceSourceProperties -> String)
-> ([SalesforceSourceProperties] -> ShowS)
-> Show SalesforceSourceProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SalesforceSourceProperties] -> ShowS
$cshowList :: [SalesforceSourceProperties] -> ShowS
show :: SalesforceSourceProperties -> String
$cshow :: SalesforceSourceProperties -> String
showsPrec :: Int -> SalesforceSourceProperties -> ShowS
$cshowsPrec :: Int -> SalesforceSourceProperties -> ShowS
Prelude.Show, (forall x.
 SalesforceSourceProperties -> Rep SalesforceSourceProperties x)
-> (forall x.
    Rep SalesforceSourceProperties x -> SalesforceSourceProperties)
-> Generic SalesforceSourceProperties
forall x.
Rep SalesforceSourceProperties x -> SalesforceSourceProperties
forall x.
SalesforceSourceProperties -> Rep SalesforceSourceProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SalesforceSourceProperties x -> SalesforceSourceProperties
$cfrom :: forall x.
SalesforceSourceProperties -> Rep SalesforceSourceProperties x
Prelude.Generic)

-- |
-- Create a value of 'SalesforceSourceProperties' 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:
--
-- 'enableDynamicFieldUpdate', 'salesforceSourceProperties_enableDynamicFieldUpdate' - The flag that enables dynamic fetching of new (recently added) fields in
-- the Salesforce objects while running a flow.
--
-- 'includeDeletedRecords', 'salesforceSourceProperties_includeDeletedRecords' - Indicates whether Amazon AppFlow includes deleted files in the flow run.
--
-- 'object'', 'salesforceSourceProperties_object' - The object specified in the Salesforce flow source.
newSalesforceSourceProperties ::
  -- | 'object''
  Prelude.Text ->
  SalesforceSourceProperties
newSalesforceSourceProperties :: Text -> SalesforceSourceProperties
newSalesforceSourceProperties Text
pObject_ =
  SalesforceSourceProperties' :: Maybe Bool -> Maybe Bool -> Text -> SalesforceSourceProperties
SalesforceSourceProperties'
    { $sel:enableDynamicFieldUpdate:SalesforceSourceProperties' :: Maybe Bool
enableDynamicFieldUpdate =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:includeDeletedRecords:SalesforceSourceProperties' :: Maybe Bool
includeDeletedRecords = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:object':SalesforceSourceProperties' :: Text
object' = Text
pObject_
    }

-- | The flag that enables dynamic fetching of new (recently added) fields in
-- the Salesforce objects while running a flow.
salesforceSourceProperties_enableDynamicFieldUpdate :: Lens.Lens' SalesforceSourceProperties (Prelude.Maybe Prelude.Bool)
salesforceSourceProperties_enableDynamicFieldUpdate :: (Maybe Bool -> f (Maybe Bool))
-> SalesforceSourceProperties -> f SalesforceSourceProperties
salesforceSourceProperties_enableDynamicFieldUpdate = (SalesforceSourceProperties -> Maybe Bool)
-> (SalesforceSourceProperties
    -> Maybe Bool -> SalesforceSourceProperties)
-> Lens
     SalesforceSourceProperties
     SalesforceSourceProperties
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceSourceProperties' {Maybe Bool
enableDynamicFieldUpdate :: Maybe Bool
$sel:enableDynamicFieldUpdate:SalesforceSourceProperties' :: SalesforceSourceProperties -> Maybe Bool
enableDynamicFieldUpdate} -> Maybe Bool
enableDynamicFieldUpdate) (\s :: SalesforceSourceProperties
s@SalesforceSourceProperties' {} Maybe Bool
a -> SalesforceSourceProperties
s {$sel:enableDynamicFieldUpdate:SalesforceSourceProperties' :: Maybe Bool
enableDynamicFieldUpdate = Maybe Bool
a} :: SalesforceSourceProperties)

-- | Indicates whether Amazon AppFlow includes deleted files in the flow run.
salesforceSourceProperties_includeDeletedRecords :: Lens.Lens' SalesforceSourceProperties (Prelude.Maybe Prelude.Bool)
salesforceSourceProperties_includeDeletedRecords :: (Maybe Bool -> f (Maybe Bool))
-> SalesforceSourceProperties -> f SalesforceSourceProperties
salesforceSourceProperties_includeDeletedRecords = (SalesforceSourceProperties -> Maybe Bool)
-> (SalesforceSourceProperties
    -> Maybe Bool -> SalesforceSourceProperties)
-> Lens
     SalesforceSourceProperties
     SalesforceSourceProperties
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceSourceProperties' {Maybe Bool
includeDeletedRecords :: Maybe Bool
$sel:includeDeletedRecords:SalesforceSourceProperties' :: SalesforceSourceProperties -> Maybe Bool
includeDeletedRecords} -> Maybe Bool
includeDeletedRecords) (\s :: SalesforceSourceProperties
s@SalesforceSourceProperties' {} Maybe Bool
a -> SalesforceSourceProperties
s {$sel:includeDeletedRecords:SalesforceSourceProperties' :: Maybe Bool
includeDeletedRecords = Maybe Bool
a} :: SalesforceSourceProperties)

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

instance Prelude.Hashable SalesforceSourceProperties

instance Prelude.NFData SalesforceSourceProperties

instance Core.ToJSON SalesforceSourceProperties where
  toJSON :: SalesforceSourceProperties -> Value
toJSON SalesforceSourceProperties' {Maybe Bool
Text
object' :: Text
includeDeletedRecords :: Maybe Bool
enableDynamicFieldUpdate :: Maybe Bool
$sel:object':SalesforceSourceProperties' :: SalesforceSourceProperties -> Text
$sel:includeDeletedRecords:SalesforceSourceProperties' :: SalesforceSourceProperties -> Maybe Bool
$sel:enableDynamicFieldUpdate:SalesforceSourceProperties' :: SalesforceSourceProperties -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EnableDynamicFieldUpdate" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableDynamicFieldUpdate,
            (Text
"IncludeDeletedRecords" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
includeDeletedRecords,
            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')
          ]
      )