{-# 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.SourceFlowConfig
-- 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.SourceFlowConfig where

import qualified Amazonka.Core as Core
import Amazonka.CustomerProfiles.Types.IncrementalPullConfig
import Amazonka.CustomerProfiles.Types.SourceConnectorProperties
import Amazonka.CustomerProfiles.Types.SourceConnectorType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the configuration of the source connector
-- used in the flow.
--
-- /See:/ 'newSourceFlowConfig' smart constructor.
data SourceFlowConfig = SourceFlowConfig'
  { -- | The name of the AppFlow connector profile. This name must be unique for
    -- each connector profile in the AWS account.
    SourceFlowConfig -> Maybe Text
connectorProfileName :: Prelude.Maybe Prelude.Text,
    -- | Defines the configuration for a scheduled incremental data pull. If a
    -- valid configuration is provided, the fields specified in the
    -- configuration are used when querying for the incremental data pull.
    SourceFlowConfig -> Maybe IncrementalPullConfig
incrementalPullConfig :: Prelude.Maybe IncrementalPullConfig,
    -- | The type of connector, such as Salesforce, Marketo, and so on.
    SourceFlowConfig -> SourceConnectorType
connectorType :: SourceConnectorType,
    -- | Specifies the information that is required to query a particular source
    -- connector.
    SourceFlowConfig -> SourceConnectorProperties
sourceConnectorProperties :: SourceConnectorProperties
  }
  deriving (SourceFlowConfig -> SourceFlowConfig -> Bool
(SourceFlowConfig -> SourceFlowConfig -> Bool)
-> (SourceFlowConfig -> SourceFlowConfig -> Bool)
-> Eq SourceFlowConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceFlowConfig -> SourceFlowConfig -> Bool
$c/= :: SourceFlowConfig -> SourceFlowConfig -> Bool
== :: SourceFlowConfig -> SourceFlowConfig -> Bool
$c== :: SourceFlowConfig -> SourceFlowConfig -> Bool
Prelude.Eq, ReadPrec [SourceFlowConfig]
ReadPrec SourceFlowConfig
Int -> ReadS SourceFlowConfig
ReadS [SourceFlowConfig]
(Int -> ReadS SourceFlowConfig)
-> ReadS [SourceFlowConfig]
-> ReadPrec SourceFlowConfig
-> ReadPrec [SourceFlowConfig]
-> Read SourceFlowConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceFlowConfig]
$creadListPrec :: ReadPrec [SourceFlowConfig]
readPrec :: ReadPrec SourceFlowConfig
$creadPrec :: ReadPrec SourceFlowConfig
readList :: ReadS [SourceFlowConfig]
$creadList :: ReadS [SourceFlowConfig]
readsPrec :: Int -> ReadS SourceFlowConfig
$creadsPrec :: Int -> ReadS SourceFlowConfig
Prelude.Read, Int -> SourceFlowConfig -> ShowS
[SourceFlowConfig] -> ShowS
SourceFlowConfig -> String
(Int -> SourceFlowConfig -> ShowS)
-> (SourceFlowConfig -> String)
-> ([SourceFlowConfig] -> ShowS)
-> Show SourceFlowConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceFlowConfig] -> ShowS
$cshowList :: [SourceFlowConfig] -> ShowS
show :: SourceFlowConfig -> String
$cshow :: SourceFlowConfig -> String
showsPrec :: Int -> SourceFlowConfig -> ShowS
$cshowsPrec :: Int -> SourceFlowConfig -> ShowS
Prelude.Show, (forall x. SourceFlowConfig -> Rep SourceFlowConfig x)
-> (forall x. Rep SourceFlowConfig x -> SourceFlowConfig)
-> Generic SourceFlowConfig
forall x. Rep SourceFlowConfig x -> SourceFlowConfig
forall x. SourceFlowConfig -> Rep SourceFlowConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceFlowConfig x -> SourceFlowConfig
$cfrom :: forall x. SourceFlowConfig -> Rep SourceFlowConfig x
Prelude.Generic)

-- |
-- Create a value of 'SourceFlowConfig' 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:
--
-- 'connectorProfileName', 'sourceFlowConfig_connectorProfileName' - The name of the AppFlow connector profile. This name must be unique for
-- each connector profile in the AWS account.
--
-- 'incrementalPullConfig', 'sourceFlowConfig_incrementalPullConfig' - Defines the configuration for a scheduled incremental data pull. If a
-- valid configuration is provided, the fields specified in the
-- configuration are used when querying for the incremental data pull.
--
-- 'connectorType', 'sourceFlowConfig_connectorType' - The type of connector, such as Salesforce, Marketo, and so on.
--
-- 'sourceConnectorProperties', 'sourceFlowConfig_sourceConnectorProperties' - Specifies the information that is required to query a particular source
-- connector.
newSourceFlowConfig ::
  -- | 'connectorType'
  SourceConnectorType ->
  -- | 'sourceConnectorProperties'
  SourceConnectorProperties ->
  SourceFlowConfig
newSourceFlowConfig :: SourceConnectorType
-> SourceConnectorProperties -> SourceFlowConfig
newSourceFlowConfig
  SourceConnectorType
pConnectorType_
  SourceConnectorProperties
pSourceConnectorProperties_ =
    SourceFlowConfig' :: Maybe Text
-> Maybe IncrementalPullConfig
-> SourceConnectorType
-> SourceConnectorProperties
-> SourceFlowConfig
SourceFlowConfig'
      { $sel:connectorProfileName:SourceFlowConfig' :: Maybe Text
connectorProfileName =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:incrementalPullConfig:SourceFlowConfig' :: Maybe IncrementalPullConfig
incrementalPullConfig = Maybe IncrementalPullConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:connectorType:SourceFlowConfig' :: SourceConnectorType
connectorType = SourceConnectorType
pConnectorType_,
        $sel:sourceConnectorProperties:SourceFlowConfig' :: SourceConnectorProperties
sourceConnectorProperties =
          SourceConnectorProperties
pSourceConnectorProperties_
      }

-- | The name of the AppFlow connector profile. This name must be unique for
-- each connector profile in the AWS account.
sourceFlowConfig_connectorProfileName :: Lens.Lens' SourceFlowConfig (Prelude.Maybe Prelude.Text)
sourceFlowConfig_connectorProfileName :: (Maybe Text -> f (Maybe Text))
-> SourceFlowConfig -> f SourceFlowConfig
sourceFlowConfig_connectorProfileName = (SourceFlowConfig -> Maybe Text)
-> (SourceFlowConfig -> Maybe Text -> SourceFlowConfig)
-> Lens SourceFlowConfig SourceFlowConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceFlowConfig' {Maybe Text
connectorProfileName :: Maybe Text
$sel:connectorProfileName:SourceFlowConfig' :: SourceFlowConfig -> Maybe Text
connectorProfileName} -> Maybe Text
connectorProfileName) (\s :: SourceFlowConfig
s@SourceFlowConfig' {} Maybe Text
a -> SourceFlowConfig
s {$sel:connectorProfileName:SourceFlowConfig' :: Maybe Text
connectorProfileName = Maybe Text
a} :: SourceFlowConfig)

-- | Defines the configuration for a scheduled incremental data pull. If a
-- valid configuration is provided, the fields specified in the
-- configuration are used when querying for the incremental data pull.
sourceFlowConfig_incrementalPullConfig :: Lens.Lens' SourceFlowConfig (Prelude.Maybe IncrementalPullConfig)
sourceFlowConfig_incrementalPullConfig :: (Maybe IncrementalPullConfig -> f (Maybe IncrementalPullConfig))
-> SourceFlowConfig -> f SourceFlowConfig
sourceFlowConfig_incrementalPullConfig = (SourceFlowConfig -> Maybe IncrementalPullConfig)
-> (SourceFlowConfig
    -> Maybe IncrementalPullConfig -> SourceFlowConfig)
-> Lens
     SourceFlowConfig
     SourceFlowConfig
     (Maybe IncrementalPullConfig)
     (Maybe IncrementalPullConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceFlowConfig' {Maybe IncrementalPullConfig
incrementalPullConfig :: Maybe IncrementalPullConfig
$sel:incrementalPullConfig:SourceFlowConfig' :: SourceFlowConfig -> Maybe IncrementalPullConfig
incrementalPullConfig} -> Maybe IncrementalPullConfig
incrementalPullConfig) (\s :: SourceFlowConfig
s@SourceFlowConfig' {} Maybe IncrementalPullConfig
a -> SourceFlowConfig
s {$sel:incrementalPullConfig:SourceFlowConfig' :: Maybe IncrementalPullConfig
incrementalPullConfig = Maybe IncrementalPullConfig
a} :: SourceFlowConfig)

-- | The type of connector, such as Salesforce, Marketo, and so on.
sourceFlowConfig_connectorType :: Lens.Lens' SourceFlowConfig SourceConnectorType
sourceFlowConfig_connectorType :: (SourceConnectorType -> f SourceConnectorType)
-> SourceFlowConfig -> f SourceFlowConfig
sourceFlowConfig_connectorType = (SourceFlowConfig -> SourceConnectorType)
-> (SourceFlowConfig -> SourceConnectorType -> SourceFlowConfig)
-> Lens
     SourceFlowConfig
     SourceFlowConfig
     SourceConnectorType
     SourceConnectorType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceFlowConfig' {SourceConnectorType
connectorType :: SourceConnectorType
$sel:connectorType:SourceFlowConfig' :: SourceFlowConfig -> SourceConnectorType
connectorType} -> SourceConnectorType
connectorType) (\s :: SourceFlowConfig
s@SourceFlowConfig' {} SourceConnectorType
a -> SourceFlowConfig
s {$sel:connectorType:SourceFlowConfig' :: SourceConnectorType
connectorType = SourceConnectorType
a} :: SourceFlowConfig)

-- | Specifies the information that is required to query a particular source
-- connector.
sourceFlowConfig_sourceConnectorProperties :: Lens.Lens' SourceFlowConfig SourceConnectorProperties
sourceFlowConfig_sourceConnectorProperties :: (SourceConnectorProperties -> f SourceConnectorProperties)
-> SourceFlowConfig -> f SourceFlowConfig
sourceFlowConfig_sourceConnectorProperties = (SourceFlowConfig -> SourceConnectorProperties)
-> (SourceFlowConfig
    -> SourceConnectorProperties -> SourceFlowConfig)
-> Lens
     SourceFlowConfig
     SourceFlowConfig
     SourceConnectorProperties
     SourceConnectorProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceFlowConfig' {SourceConnectorProperties
sourceConnectorProperties :: SourceConnectorProperties
$sel:sourceConnectorProperties:SourceFlowConfig' :: SourceFlowConfig -> SourceConnectorProperties
sourceConnectorProperties} -> SourceConnectorProperties
sourceConnectorProperties) (\s :: SourceFlowConfig
s@SourceFlowConfig' {} SourceConnectorProperties
a -> SourceFlowConfig
s {$sel:sourceConnectorProperties:SourceFlowConfig' :: SourceConnectorProperties
sourceConnectorProperties = SourceConnectorProperties
a} :: SourceFlowConfig)

instance Prelude.Hashable SourceFlowConfig

instance Prelude.NFData SourceFlowConfig

instance Core.ToJSON SourceFlowConfig where
  toJSON :: SourceFlowConfig -> Value
toJSON SourceFlowConfig' {Maybe Text
Maybe IncrementalPullConfig
SourceConnectorType
SourceConnectorProperties
sourceConnectorProperties :: SourceConnectorProperties
connectorType :: SourceConnectorType
incrementalPullConfig :: Maybe IncrementalPullConfig
connectorProfileName :: Maybe Text
$sel:sourceConnectorProperties:SourceFlowConfig' :: SourceFlowConfig -> SourceConnectorProperties
$sel:connectorType:SourceFlowConfig' :: SourceFlowConfig -> SourceConnectorType
$sel:incrementalPullConfig:SourceFlowConfig' :: SourceFlowConfig -> Maybe IncrementalPullConfig
$sel:connectorProfileName:SourceFlowConfig' :: SourceFlowConfig -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ConnectorProfileName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
connectorProfileName,
            (Text
"IncrementalPullConfig" Text -> IncrementalPullConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (IncrementalPullConfig -> Pair)
-> Maybe IncrementalPullConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IncrementalPullConfig
incrementalPullConfig,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ConnectorType" Text -> SourceConnectorType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SourceConnectorType
connectorType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"SourceConnectorProperties"
                  Text -> SourceConnectorProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SourceConnectorProperties
sourceConnectorProperties
              )
          ]
      )