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

import Amazonka.AppFlow.Types.ConnectorProfileCredentials
import Amazonka.AppFlow.Types.ConnectorProfileProperties
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Defines the connector-specific configuration and credentials for the
-- connector profile.
--
-- /See:/ 'newConnectorProfileConfig' smart constructor.
data ConnectorProfileConfig = ConnectorProfileConfig'
  { -- | The connector-specific properties of the profile configuration.
    ConnectorProfileConfig -> ConnectorProfileProperties
connectorProfileProperties :: ConnectorProfileProperties,
    -- | The connector-specific credentials required by each connector.
    ConnectorProfileConfig -> ConnectorProfileCredentials
connectorProfileCredentials :: ConnectorProfileCredentials
  }
  deriving (ConnectorProfileConfig -> ConnectorProfileConfig -> Bool
(ConnectorProfileConfig -> ConnectorProfileConfig -> Bool)
-> (ConnectorProfileConfig -> ConnectorProfileConfig -> Bool)
-> Eq ConnectorProfileConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectorProfileConfig -> ConnectorProfileConfig -> Bool
$c/= :: ConnectorProfileConfig -> ConnectorProfileConfig -> Bool
== :: ConnectorProfileConfig -> ConnectorProfileConfig -> Bool
$c== :: ConnectorProfileConfig -> ConnectorProfileConfig -> Bool
Prelude.Eq, Int -> ConnectorProfileConfig -> ShowS
[ConnectorProfileConfig] -> ShowS
ConnectorProfileConfig -> String
(Int -> ConnectorProfileConfig -> ShowS)
-> (ConnectorProfileConfig -> String)
-> ([ConnectorProfileConfig] -> ShowS)
-> Show ConnectorProfileConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectorProfileConfig] -> ShowS
$cshowList :: [ConnectorProfileConfig] -> ShowS
show :: ConnectorProfileConfig -> String
$cshow :: ConnectorProfileConfig -> String
showsPrec :: Int -> ConnectorProfileConfig -> ShowS
$cshowsPrec :: Int -> ConnectorProfileConfig -> ShowS
Prelude.Show, (forall x. ConnectorProfileConfig -> Rep ConnectorProfileConfig x)
-> (forall x.
    Rep ConnectorProfileConfig x -> ConnectorProfileConfig)
-> Generic ConnectorProfileConfig
forall x. Rep ConnectorProfileConfig x -> ConnectorProfileConfig
forall x. ConnectorProfileConfig -> Rep ConnectorProfileConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectorProfileConfig x -> ConnectorProfileConfig
$cfrom :: forall x. ConnectorProfileConfig -> Rep ConnectorProfileConfig x
Prelude.Generic)

-- |
-- Create a value of 'ConnectorProfileConfig' 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:
--
-- 'connectorProfileProperties', 'connectorProfileConfig_connectorProfileProperties' - The connector-specific properties of the profile configuration.
--
-- 'connectorProfileCredentials', 'connectorProfileConfig_connectorProfileCredentials' - The connector-specific credentials required by each connector.
newConnectorProfileConfig ::
  -- | 'connectorProfileProperties'
  ConnectorProfileProperties ->
  -- | 'connectorProfileCredentials'
  ConnectorProfileCredentials ->
  ConnectorProfileConfig
newConnectorProfileConfig :: ConnectorProfileProperties
-> ConnectorProfileCredentials -> ConnectorProfileConfig
newConnectorProfileConfig
  ConnectorProfileProperties
pConnectorProfileProperties_
  ConnectorProfileCredentials
pConnectorProfileCredentials_ =
    ConnectorProfileConfig' :: ConnectorProfileProperties
-> ConnectorProfileCredentials -> ConnectorProfileConfig
ConnectorProfileConfig'
      { $sel:connectorProfileProperties:ConnectorProfileConfig' :: ConnectorProfileProperties
connectorProfileProperties =
          ConnectorProfileProperties
pConnectorProfileProperties_,
        $sel:connectorProfileCredentials:ConnectorProfileConfig' :: ConnectorProfileCredentials
connectorProfileCredentials =
          ConnectorProfileCredentials
pConnectorProfileCredentials_
      }

-- | The connector-specific properties of the profile configuration.
connectorProfileConfig_connectorProfileProperties :: Lens.Lens' ConnectorProfileConfig ConnectorProfileProperties
connectorProfileConfig_connectorProfileProperties :: (ConnectorProfileProperties -> f ConnectorProfileProperties)
-> ConnectorProfileConfig -> f ConnectorProfileConfig
connectorProfileConfig_connectorProfileProperties = (ConnectorProfileConfig -> ConnectorProfileProperties)
-> (ConnectorProfileConfig
    -> ConnectorProfileProperties -> ConnectorProfileConfig)
-> Lens
     ConnectorProfileConfig
     ConnectorProfileConfig
     ConnectorProfileProperties
     ConnectorProfileProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorProfileConfig' {ConnectorProfileProperties
connectorProfileProperties :: ConnectorProfileProperties
$sel:connectorProfileProperties:ConnectorProfileConfig' :: ConnectorProfileConfig -> ConnectorProfileProperties
connectorProfileProperties} -> ConnectorProfileProperties
connectorProfileProperties) (\s :: ConnectorProfileConfig
s@ConnectorProfileConfig' {} ConnectorProfileProperties
a -> ConnectorProfileConfig
s {$sel:connectorProfileProperties:ConnectorProfileConfig' :: ConnectorProfileProperties
connectorProfileProperties = ConnectorProfileProperties
a} :: ConnectorProfileConfig)

-- | The connector-specific credentials required by each connector.
connectorProfileConfig_connectorProfileCredentials :: Lens.Lens' ConnectorProfileConfig ConnectorProfileCredentials
connectorProfileConfig_connectorProfileCredentials :: (ConnectorProfileCredentials -> f ConnectorProfileCredentials)
-> ConnectorProfileConfig -> f ConnectorProfileConfig
connectorProfileConfig_connectorProfileCredentials = (ConnectorProfileConfig -> ConnectorProfileCredentials)
-> (ConnectorProfileConfig
    -> ConnectorProfileCredentials -> ConnectorProfileConfig)
-> Lens
     ConnectorProfileConfig
     ConnectorProfileConfig
     ConnectorProfileCredentials
     ConnectorProfileCredentials
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectorProfileConfig' {ConnectorProfileCredentials
connectorProfileCredentials :: ConnectorProfileCredentials
$sel:connectorProfileCredentials:ConnectorProfileConfig' :: ConnectorProfileConfig -> ConnectorProfileCredentials
connectorProfileCredentials} -> ConnectorProfileCredentials
connectorProfileCredentials) (\s :: ConnectorProfileConfig
s@ConnectorProfileConfig' {} ConnectorProfileCredentials
a -> ConnectorProfileConfig
s {$sel:connectorProfileCredentials:ConnectorProfileConfig' :: ConnectorProfileCredentials
connectorProfileCredentials = ConnectorProfileCredentials
a} :: ConnectorProfileConfig)

instance Prelude.Hashable ConnectorProfileConfig

instance Prelude.NFData ConnectorProfileConfig

instance Core.ToJSON ConnectorProfileConfig where
  toJSON :: ConnectorProfileConfig -> Value
toJSON ConnectorProfileConfig' {ConnectorProfileCredentials
ConnectorProfileProperties
connectorProfileCredentials :: ConnectorProfileCredentials
connectorProfileProperties :: ConnectorProfileProperties
$sel:connectorProfileCredentials:ConnectorProfileConfig' :: ConnectorProfileConfig -> ConnectorProfileCredentials
$sel:connectorProfileProperties:ConnectorProfileConfig' :: ConnectorProfileConfig -> ConnectorProfileProperties
..} =
    [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
"connectorProfileProperties"
                  Text -> ConnectorProfileProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ConnectorProfileProperties
connectorProfileProperties
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"connectorProfileCredentials"
                  Text -> ConnectorProfileCredentials -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ConnectorProfileCredentials
connectorProfileCredentials
              )
          ]
      )