{-# 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.DestinationFlowConfig
-- 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.AppFlow.Types.DestinationFlowConfig where

import Amazonka.AppFlow.Types.ConnectorType
import Amazonka.AppFlow.Types.DestinationConnectorProperties
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the configuration of destination connectors
-- present in the flow.
--
-- /See:/ 'newDestinationFlowConfig' smart constructor.
data DestinationFlowConfig = DestinationFlowConfig'
  { -- | The API version that the destination connector uses.
    DestinationFlowConfig -> Maybe Text
apiVersion :: Prelude.Maybe Prelude.Text,
    -- | The name of the connector profile. This name must be unique for each
    -- connector profile in the Amazon Web Services account.
    DestinationFlowConfig -> Maybe Text
connectorProfileName :: Prelude.Maybe Prelude.Text,
    -- | The type of connector, such as Salesforce, Amplitude, and so on.
    DestinationFlowConfig -> ConnectorType
connectorType :: ConnectorType,
    -- | This stores the information that is required to query a particular
    -- connector.
    DestinationFlowConfig -> DestinationConnectorProperties
destinationConnectorProperties :: DestinationConnectorProperties
  }
  deriving (DestinationFlowConfig -> DestinationFlowConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationFlowConfig -> DestinationFlowConfig -> Bool
$c/= :: DestinationFlowConfig -> DestinationFlowConfig -> Bool
== :: DestinationFlowConfig -> DestinationFlowConfig -> Bool
$c== :: DestinationFlowConfig -> DestinationFlowConfig -> Bool
Prelude.Eq, ReadPrec [DestinationFlowConfig]
ReadPrec DestinationFlowConfig
Int -> ReadS DestinationFlowConfig
ReadS [DestinationFlowConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationFlowConfig]
$creadListPrec :: ReadPrec [DestinationFlowConfig]
readPrec :: ReadPrec DestinationFlowConfig
$creadPrec :: ReadPrec DestinationFlowConfig
readList :: ReadS [DestinationFlowConfig]
$creadList :: ReadS [DestinationFlowConfig]
readsPrec :: Int -> ReadS DestinationFlowConfig
$creadsPrec :: Int -> ReadS DestinationFlowConfig
Prelude.Read, Int -> DestinationFlowConfig -> ShowS
[DestinationFlowConfig] -> ShowS
DestinationFlowConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationFlowConfig] -> ShowS
$cshowList :: [DestinationFlowConfig] -> ShowS
show :: DestinationFlowConfig -> String
$cshow :: DestinationFlowConfig -> String
showsPrec :: Int -> DestinationFlowConfig -> ShowS
$cshowsPrec :: Int -> DestinationFlowConfig -> ShowS
Prelude.Show, forall x. Rep DestinationFlowConfig x -> DestinationFlowConfig
forall x. DestinationFlowConfig -> Rep DestinationFlowConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DestinationFlowConfig x -> DestinationFlowConfig
$cfrom :: forall x. DestinationFlowConfig -> Rep DestinationFlowConfig x
Prelude.Generic)

-- |
-- Create a value of 'DestinationFlowConfig' 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:
--
-- 'apiVersion', 'destinationFlowConfig_apiVersion' - The API version that the destination connector uses.
--
-- 'connectorProfileName', 'destinationFlowConfig_connectorProfileName' - The name of the connector profile. This name must be unique for each
-- connector profile in the Amazon Web Services account.
--
-- 'connectorType', 'destinationFlowConfig_connectorType' - The type of connector, such as Salesforce, Amplitude, and so on.
--
-- 'destinationConnectorProperties', 'destinationFlowConfig_destinationConnectorProperties' - This stores the information that is required to query a particular
-- connector.
newDestinationFlowConfig ::
  -- | 'connectorType'
  ConnectorType ->
  -- | 'destinationConnectorProperties'
  DestinationConnectorProperties ->
  DestinationFlowConfig
newDestinationFlowConfig :: ConnectorType
-> DestinationConnectorProperties -> DestinationFlowConfig
newDestinationFlowConfig
  ConnectorType
pConnectorType_
  DestinationConnectorProperties
pDestinationConnectorProperties_ =
    DestinationFlowConfig'
      { $sel:apiVersion:DestinationFlowConfig' :: Maybe Text
apiVersion =
          forall a. Maybe a
Prelude.Nothing,
        $sel:connectorProfileName:DestinationFlowConfig' :: Maybe Text
connectorProfileName = forall a. Maybe a
Prelude.Nothing,
        $sel:connectorType:DestinationFlowConfig' :: ConnectorType
connectorType = ConnectorType
pConnectorType_,
        $sel:destinationConnectorProperties:DestinationFlowConfig' :: DestinationConnectorProperties
destinationConnectorProperties =
          DestinationConnectorProperties
pDestinationConnectorProperties_
      }

-- | The API version that the destination connector uses.
destinationFlowConfig_apiVersion :: Lens.Lens' DestinationFlowConfig (Prelude.Maybe Prelude.Text)
destinationFlowConfig_apiVersion :: Lens' DestinationFlowConfig (Maybe Text)
destinationFlowConfig_apiVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationFlowConfig' {Maybe Text
apiVersion :: Maybe Text
$sel:apiVersion:DestinationFlowConfig' :: DestinationFlowConfig -> Maybe Text
apiVersion} -> Maybe Text
apiVersion) (\s :: DestinationFlowConfig
s@DestinationFlowConfig' {} Maybe Text
a -> DestinationFlowConfig
s {$sel:apiVersion:DestinationFlowConfig' :: Maybe Text
apiVersion = Maybe Text
a} :: DestinationFlowConfig)

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

-- | The type of connector, such as Salesforce, Amplitude, and so on.
destinationFlowConfig_connectorType :: Lens.Lens' DestinationFlowConfig ConnectorType
destinationFlowConfig_connectorType :: Lens' DestinationFlowConfig ConnectorType
destinationFlowConfig_connectorType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationFlowConfig' {ConnectorType
connectorType :: ConnectorType
$sel:connectorType:DestinationFlowConfig' :: DestinationFlowConfig -> ConnectorType
connectorType} -> ConnectorType
connectorType) (\s :: DestinationFlowConfig
s@DestinationFlowConfig' {} ConnectorType
a -> DestinationFlowConfig
s {$sel:connectorType:DestinationFlowConfig' :: ConnectorType
connectorType = ConnectorType
a} :: DestinationFlowConfig)

-- | This stores the information that is required to query a particular
-- connector.
destinationFlowConfig_destinationConnectorProperties :: Lens.Lens' DestinationFlowConfig DestinationConnectorProperties
destinationFlowConfig_destinationConnectorProperties :: Lens' DestinationFlowConfig DestinationConnectorProperties
destinationFlowConfig_destinationConnectorProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationFlowConfig' {DestinationConnectorProperties
destinationConnectorProperties :: DestinationConnectorProperties
$sel:destinationConnectorProperties:DestinationFlowConfig' :: DestinationFlowConfig -> DestinationConnectorProperties
destinationConnectorProperties} -> DestinationConnectorProperties
destinationConnectorProperties) (\s :: DestinationFlowConfig
s@DestinationFlowConfig' {} DestinationConnectorProperties
a -> DestinationFlowConfig
s {$sel:destinationConnectorProperties:DestinationFlowConfig' :: DestinationConnectorProperties
destinationConnectorProperties = DestinationConnectorProperties
a} :: DestinationFlowConfig)

instance Data.FromJSON DestinationFlowConfig where
  parseJSON :: Value -> Parser DestinationFlowConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DestinationFlowConfig"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> ConnectorType
-> DestinationConnectorProperties
-> DestinationFlowConfig
DestinationFlowConfig'
            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
"apiVersion")
            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
"connectorProfileName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"connectorType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"destinationConnectorProperties")
      )

instance Prelude.Hashable DestinationFlowConfig where
  hashWithSalt :: Int -> DestinationFlowConfig -> Int
hashWithSalt Int
_salt DestinationFlowConfig' {Maybe Text
ConnectorType
DestinationConnectorProperties
destinationConnectorProperties :: DestinationConnectorProperties
connectorType :: ConnectorType
connectorProfileName :: Maybe Text
apiVersion :: Maybe Text
$sel:destinationConnectorProperties:DestinationFlowConfig' :: DestinationFlowConfig -> DestinationConnectorProperties
$sel:connectorType:DestinationFlowConfig' :: DestinationFlowConfig -> ConnectorType
$sel:connectorProfileName:DestinationFlowConfig' :: DestinationFlowConfig -> Maybe Text
$sel:apiVersion:DestinationFlowConfig' :: DestinationFlowConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
apiVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectorProfileName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ConnectorType
connectorType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DestinationConnectorProperties
destinationConnectorProperties

instance Prelude.NFData DestinationFlowConfig where
  rnf :: DestinationFlowConfig -> ()
rnf DestinationFlowConfig' {Maybe Text
ConnectorType
DestinationConnectorProperties
destinationConnectorProperties :: DestinationConnectorProperties
connectorType :: ConnectorType
connectorProfileName :: Maybe Text
apiVersion :: Maybe Text
$sel:destinationConnectorProperties:DestinationFlowConfig' :: DestinationFlowConfig -> DestinationConnectorProperties
$sel:connectorType:DestinationFlowConfig' :: DestinationFlowConfig -> ConnectorType
$sel:connectorProfileName:DestinationFlowConfig' :: DestinationFlowConfig -> Maybe Text
$sel:apiVersion:DestinationFlowConfig' :: DestinationFlowConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectorProfileName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ConnectorType
connectorType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DestinationConnectorProperties
destinationConnectorProperties

instance Data.ToJSON DestinationFlowConfig where
  toJSON :: DestinationFlowConfig -> Value
toJSON DestinationFlowConfig' {Maybe Text
ConnectorType
DestinationConnectorProperties
destinationConnectorProperties :: DestinationConnectorProperties
connectorType :: ConnectorType
connectorProfileName :: Maybe Text
apiVersion :: Maybe Text
$sel:destinationConnectorProperties:DestinationFlowConfig' :: DestinationFlowConfig -> DestinationConnectorProperties
$sel:connectorType:DestinationFlowConfig' :: DestinationFlowConfig -> ConnectorType
$sel:connectorProfileName:DestinationFlowConfig' :: DestinationFlowConfig -> Maybe Text
$sel:apiVersion:DestinationFlowConfig' :: DestinationFlowConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"apiVersion" 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 Text
apiVersion,
            (Key
"connectorProfileName" 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 Text
connectorProfileName,
            forall a. a -> Maybe a
Prelude.Just (Key
"connectorType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ConnectorType
connectorType),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"destinationConnectorProperties"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DestinationConnectorProperties
destinationConnectorProperties
              )
          ]
      )