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

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

-- | The profile properties required by the custom connector.
--
-- /See:/ 'newCustomConnectorProfileProperties' smart constructor.
data CustomConnectorProfileProperties = CustomConnectorProfileProperties'
  { CustomConnectorProfileProperties -> Maybe OAuth2Properties
oAuth2Properties :: Prelude.Maybe OAuth2Properties,
    -- | A map of properties that are required to create a profile for the custom
    -- connector.
    CustomConnectorProfileProperties -> Maybe (HashMap Text Text)
profileProperties :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (CustomConnectorProfileProperties
-> CustomConnectorProfileProperties -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomConnectorProfileProperties
-> CustomConnectorProfileProperties -> Bool
$c/= :: CustomConnectorProfileProperties
-> CustomConnectorProfileProperties -> Bool
== :: CustomConnectorProfileProperties
-> CustomConnectorProfileProperties -> Bool
$c== :: CustomConnectorProfileProperties
-> CustomConnectorProfileProperties -> Bool
Prelude.Eq, ReadPrec [CustomConnectorProfileProperties]
ReadPrec CustomConnectorProfileProperties
Int -> ReadS CustomConnectorProfileProperties
ReadS [CustomConnectorProfileProperties]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomConnectorProfileProperties]
$creadListPrec :: ReadPrec [CustomConnectorProfileProperties]
readPrec :: ReadPrec CustomConnectorProfileProperties
$creadPrec :: ReadPrec CustomConnectorProfileProperties
readList :: ReadS [CustomConnectorProfileProperties]
$creadList :: ReadS [CustomConnectorProfileProperties]
readsPrec :: Int -> ReadS CustomConnectorProfileProperties
$creadsPrec :: Int -> ReadS CustomConnectorProfileProperties
Prelude.Read, Int -> CustomConnectorProfileProperties -> ShowS
[CustomConnectorProfileProperties] -> ShowS
CustomConnectorProfileProperties -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomConnectorProfileProperties] -> ShowS
$cshowList :: [CustomConnectorProfileProperties] -> ShowS
show :: CustomConnectorProfileProperties -> String
$cshow :: CustomConnectorProfileProperties -> String
showsPrec :: Int -> CustomConnectorProfileProperties -> ShowS
$cshowsPrec :: Int -> CustomConnectorProfileProperties -> ShowS
Prelude.Show, forall x.
Rep CustomConnectorProfileProperties x
-> CustomConnectorProfileProperties
forall x.
CustomConnectorProfileProperties
-> Rep CustomConnectorProfileProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomConnectorProfileProperties x
-> CustomConnectorProfileProperties
$cfrom :: forall x.
CustomConnectorProfileProperties
-> Rep CustomConnectorProfileProperties x
Prelude.Generic)

-- |
-- Create a value of 'CustomConnectorProfileProperties' 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:
--
-- 'oAuth2Properties', 'customConnectorProfileProperties_oAuth2Properties' - Undocumented member.
--
-- 'profileProperties', 'customConnectorProfileProperties_profileProperties' - A map of properties that are required to create a profile for the custom
-- connector.
newCustomConnectorProfileProperties ::
  CustomConnectorProfileProperties
newCustomConnectorProfileProperties :: CustomConnectorProfileProperties
newCustomConnectorProfileProperties =
  CustomConnectorProfileProperties'
    { $sel:oAuth2Properties:CustomConnectorProfileProperties' :: Maybe OAuth2Properties
oAuth2Properties =
        forall a. Maybe a
Prelude.Nothing,
      $sel:profileProperties:CustomConnectorProfileProperties' :: Maybe (HashMap Text Text)
profileProperties = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
customConnectorProfileProperties_oAuth2Properties :: Lens.Lens' CustomConnectorProfileProperties (Prelude.Maybe OAuth2Properties)
customConnectorProfileProperties_oAuth2Properties :: Lens' CustomConnectorProfileProperties (Maybe OAuth2Properties)
customConnectorProfileProperties_oAuth2Properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomConnectorProfileProperties' {Maybe OAuth2Properties
oAuth2Properties :: Maybe OAuth2Properties
$sel:oAuth2Properties:CustomConnectorProfileProperties' :: CustomConnectorProfileProperties -> Maybe OAuth2Properties
oAuth2Properties} -> Maybe OAuth2Properties
oAuth2Properties) (\s :: CustomConnectorProfileProperties
s@CustomConnectorProfileProperties' {} Maybe OAuth2Properties
a -> CustomConnectorProfileProperties
s {$sel:oAuth2Properties:CustomConnectorProfileProperties' :: Maybe OAuth2Properties
oAuth2Properties = Maybe OAuth2Properties
a} :: CustomConnectorProfileProperties)

-- | A map of properties that are required to create a profile for the custom
-- connector.
customConnectorProfileProperties_profileProperties :: Lens.Lens' CustomConnectorProfileProperties (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
customConnectorProfileProperties_profileProperties :: Lens' CustomConnectorProfileProperties (Maybe (HashMap Text Text))
customConnectorProfileProperties_profileProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomConnectorProfileProperties' {Maybe (HashMap Text Text)
profileProperties :: Maybe (HashMap Text Text)
$sel:profileProperties:CustomConnectorProfileProperties' :: CustomConnectorProfileProperties -> Maybe (HashMap Text Text)
profileProperties} -> Maybe (HashMap Text Text)
profileProperties) (\s :: CustomConnectorProfileProperties
s@CustomConnectorProfileProperties' {} Maybe (HashMap Text Text)
a -> CustomConnectorProfileProperties
s {$sel:profileProperties:CustomConnectorProfileProperties' :: Maybe (HashMap Text Text)
profileProperties = Maybe (HashMap Text Text)
a} :: CustomConnectorProfileProperties) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Data.FromJSON
    CustomConnectorProfileProperties
  where
  parseJSON :: Value -> Parser CustomConnectorProfileProperties
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CustomConnectorProfileProperties"
      ( \Object
x ->
          Maybe OAuth2Properties
-> Maybe (HashMap Text Text) -> CustomConnectorProfileProperties
CustomConnectorProfileProperties'
            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
"oAuth2Properties")
            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
"profileProperties"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    CustomConnectorProfileProperties
  where
  hashWithSalt :: Int -> CustomConnectorProfileProperties -> Int
hashWithSalt
    Int
_salt
    CustomConnectorProfileProperties' {Maybe (HashMap Text Text)
Maybe OAuth2Properties
profileProperties :: Maybe (HashMap Text Text)
oAuth2Properties :: Maybe OAuth2Properties
$sel:profileProperties:CustomConnectorProfileProperties' :: CustomConnectorProfileProperties -> Maybe (HashMap Text Text)
$sel:oAuth2Properties:CustomConnectorProfileProperties' :: CustomConnectorProfileProperties -> Maybe OAuth2Properties
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OAuth2Properties
oAuth2Properties
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
profileProperties

instance
  Prelude.NFData
    CustomConnectorProfileProperties
  where
  rnf :: CustomConnectorProfileProperties -> ()
rnf CustomConnectorProfileProperties' {Maybe (HashMap Text Text)
Maybe OAuth2Properties
profileProperties :: Maybe (HashMap Text Text)
oAuth2Properties :: Maybe OAuth2Properties
$sel:profileProperties:CustomConnectorProfileProperties' :: CustomConnectorProfileProperties -> Maybe (HashMap Text Text)
$sel:oAuth2Properties:CustomConnectorProfileProperties' :: CustomConnectorProfileProperties -> Maybe OAuth2Properties
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe OAuth2Properties
oAuth2Properties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
profileProperties

instance Data.ToJSON CustomConnectorProfileProperties where
  toJSON :: CustomConnectorProfileProperties -> Value
toJSON CustomConnectorProfileProperties' {Maybe (HashMap Text Text)
Maybe OAuth2Properties
profileProperties :: Maybe (HashMap Text Text)
oAuth2Properties :: Maybe OAuth2Properties
$sel:profileProperties:CustomConnectorProfileProperties' :: CustomConnectorProfileProperties -> Maybe (HashMap Text Text)
$sel:oAuth2Properties:CustomConnectorProfileProperties' :: CustomConnectorProfileProperties -> Maybe OAuth2Properties
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"oAuth2Properties" 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 OAuth2Properties
oAuth2Properties,
            (Key
"profileProperties" 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 (HashMap Text Text)
profileProperties
          ]
      )