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

import Amazonka.AppFlow.Types.ConnectorProfileCredentials
import Amazonka.AppFlow.Types.ConnectorProfileProperties
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

-- | Defines the connector-specific configuration and credentials for the
-- connector profile.
--
-- /See:/ 'newConnectorProfileConfig' smart constructor.
data ConnectorProfileConfig = ConnectorProfileConfig'
  { -- | The connector-specific credentials required by each connector.
    ConnectorProfileConfig -> Maybe ConnectorProfileCredentials
connectorProfileCredentials :: Prelude.Maybe ConnectorProfileCredentials,
    -- | The connector-specific properties of the profile configuration.
    ConnectorProfileConfig -> ConnectorProfileProperties
connectorProfileProperties :: ConnectorProfileProperties
  }
  deriving (ConnectorProfileConfig -> ConnectorProfileConfig -> Bool
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
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. 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:
--
-- 'connectorProfileCredentials', 'connectorProfileConfig_connectorProfileCredentials' - The connector-specific credentials required by each connector.
--
-- 'connectorProfileProperties', 'connectorProfileConfig_connectorProfileProperties' - The connector-specific properties of the profile configuration.
newConnectorProfileConfig ::
  -- | 'connectorProfileProperties'
  ConnectorProfileProperties ->
  ConnectorProfileConfig
newConnectorProfileConfig :: ConnectorProfileProperties -> ConnectorProfileConfig
newConnectorProfileConfig
  ConnectorProfileProperties
pConnectorProfileProperties_ =
    ConnectorProfileConfig'
      { $sel:connectorProfileCredentials:ConnectorProfileConfig' :: Maybe ConnectorProfileCredentials
connectorProfileCredentials =
          forall a. Maybe a
Prelude.Nothing,
        $sel:connectorProfileProperties:ConnectorProfileConfig' :: ConnectorProfileProperties
connectorProfileProperties =
          ConnectorProfileProperties
pConnectorProfileProperties_
      }

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

-- | The connector-specific properties of the profile configuration.
connectorProfileConfig_connectorProfileProperties :: Lens.Lens' ConnectorProfileConfig ConnectorProfileProperties
connectorProfileConfig_connectorProfileProperties :: Lens' ConnectorProfileConfig ConnectorProfileProperties
connectorProfileConfig_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)

instance Prelude.Hashable ConnectorProfileConfig where
  hashWithSalt :: Int -> ConnectorProfileConfig -> Int
hashWithSalt Int
_salt ConnectorProfileConfig' {Maybe ConnectorProfileCredentials
ConnectorProfileProperties
connectorProfileProperties :: ConnectorProfileProperties
connectorProfileCredentials :: Maybe ConnectorProfileCredentials
$sel:connectorProfileProperties:ConnectorProfileConfig' :: ConnectorProfileConfig -> ConnectorProfileProperties
$sel:connectorProfileCredentials:ConnectorProfileConfig' :: ConnectorProfileConfig -> Maybe ConnectorProfileCredentials
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectorProfileCredentials
connectorProfileCredentials
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ConnectorProfileProperties
connectorProfileProperties

instance Prelude.NFData ConnectorProfileConfig where
  rnf :: ConnectorProfileConfig -> ()
rnf ConnectorProfileConfig' {Maybe ConnectorProfileCredentials
ConnectorProfileProperties
connectorProfileProperties :: ConnectorProfileProperties
connectorProfileCredentials :: Maybe ConnectorProfileCredentials
$sel:connectorProfileProperties:ConnectorProfileConfig' :: ConnectorProfileConfig -> ConnectorProfileProperties
$sel:connectorProfileCredentials:ConnectorProfileConfig' :: ConnectorProfileConfig -> Maybe ConnectorProfileCredentials
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectorProfileCredentials
connectorProfileCredentials
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ConnectorProfileProperties
connectorProfileProperties

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