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

import Amazonka.AppFlow.Types.BasicAuthCredentials
import Amazonka.AppFlow.Types.OAuthCredentials
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The connector-specific profile credentials required when using SAPOData.
--
-- /See:/ 'newSAPODataConnectorProfileCredentials' smart constructor.
data SAPODataConnectorProfileCredentials = SAPODataConnectorProfileCredentials'
  { -- | The SAPOData OAuth type authentication credentials.
    SAPODataConnectorProfileCredentials -> Maybe OAuthCredentials
oAuthCredentials :: Prelude.Maybe OAuthCredentials,
    -- | The SAPOData basic authentication credentials.
    SAPODataConnectorProfileCredentials -> Maybe BasicAuthCredentials
basicAuthCredentials :: Prelude.Maybe BasicAuthCredentials
  }
  deriving (SAPODataConnectorProfileCredentials
-> SAPODataConnectorProfileCredentials -> Bool
(SAPODataConnectorProfileCredentials
 -> SAPODataConnectorProfileCredentials -> Bool)
-> (SAPODataConnectorProfileCredentials
    -> SAPODataConnectorProfileCredentials -> Bool)
-> Eq SAPODataConnectorProfileCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SAPODataConnectorProfileCredentials
-> SAPODataConnectorProfileCredentials -> Bool
$c/= :: SAPODataConnectorProfileCredentials
-> SAPODataConnectorProfileCredentials -> Bool
== :: SAPODataConnectorProfileCredentials
-> SAPODataConnectorProfileCredentials -> Bool
$c== :: SAPODataConnectorProfileCredentials
-> SAPODataConnectorProfileCredentials -> Bool
Prelude.Eq, Int -> SAPODataConnectorProfileCredentials -> ShowS
[SAPODataConnectorProfileCredentials] -> ShowS
SAPODataConnectorProfileCredentials -> String
(Int -> SAPODataConnectorProfileCredentials -> ShowS)
-> (SAPODataConnectorProfileCredentials -> String)
-> ([SAPODataConnectorProfileCredentials] -> ShowS)
-> Show SAPODataConnectorProfileCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SAPODataConnectorProfileCredentials] -> ShowS
$cshowList :: [SAPODataConnectorProfileCredentials] -> ShowS
show :: SAPODataConnectorProfileCredentials -> String
$cshow :: SAPODataConnectorProfileCredentials -> String
showsPrec :: Int -> SAPODataConnectorProfileCredentials -> ShowS
$cshowsPrec :: Int -> SAPODataConnectorProfileCredentials -> ShowS
Prelude.Show, (forall x.
 SAPODataConnectorProfileCredentials
 -> Rep SAPODataConnectorProfileCredentials x)
-> (forall x.
    Rep SAPODataConnectorProfileCredentials x
    -> SAPODataConnectorProfileCredentials)
-> Generic SAPODataConnectorProfileCredentials
forall x.
Rep SAPODataConnectorProfileCredentials x
-> SAPODataConnectorProfileCredentials
forall x.
SAPODataConnectorProfileCredentials
-> Rep SAPODataConnectorProfileCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SAPODataConnectorProfileCredentials x
-> SAPODataConnectorProfileCredentials
$cfrom :: forall x.
SAPODataConnectorProfileCredentials
-> Rep SAPODataConnectorProfileCredentials x
Prelude.Generic)

-- |
-- Create a value of 'SAPODataConnectorProfileCredentials' 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:
--
-- 'oAuthCredentials', 'sAPODataConnectorProfileCredentials_oAuthCredentials' - The SAPOData OAuth type authentication credentials.
--
-- 'basicAuthCredentials', 'sAPODataConnectorProfileCredentials_basicAuthCredentials' - The SAPOData basic authentication credentials.
newSAPODataConnectorProfileCredentials ::
  SAPODataConnectorProfileCredentials
newSAPODataConnectorProfileCredentials :: SAPODataConnectorProfileCredentials
newSAPODataConnectorProfileCredentials =
  SAPODataConnectorProfileCredentials' :: Maybe OAuthCredentials
-> Maybe BasicAuthCredentials
-> SAPODataConnectorProfileCredentials
SAPODataConnectorProfileCredentials'
    { $sel:oAuthCredentials:SAPODataConnectorProfileCredentials' :: Maybe OAuthCredentials
oAuthCredentials =
        Maybe OAuthCredentials
forall a. Maybe a
Prelude.Nothing,
      $sel:basicAuthCredentials:SAPODataConnectorProfileCredentials' :: Maybe BasicAuthCredentials
basicAuthCredentials = Maybe BasicAuthCredentials
forall a. Maybe a
Prelude.Nothing
    }

-- | The SAPOData OAuth type authentication credentials.
sAPODataConnectorProfileCredentials_oAuthCredentials :: Lens.Lens' SAPODataConnectorProfileCredentials (Prelude.Maybe OAuthCredentials)
sAPODataConnectorProfileCredentials_oAuthCredentials :: (Maybe OAuthCredentials -> f (Maybe OAuthCredentials))
-> SAPODataConnectorProfileCredentials
-> f SAPODataConnectorProfileCredentials
sAPODataConnectorProfileCredentials_oAuthCredentials = (SAPODataConnectorProfileCredentials -> Maybe OAuthCredentials)
-> (SAPODataConnectorProfileCredentials
    -> Maybe OAuthCredentials -> SAPODataConnectorProfileCredentials)
-> Lens
     SAPODataConnectorProfileCredentials
     SAPODataConnectorProfileCredentials
     (Maybe OAuthCredentials)
     (Maybe OAuthCredentials)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SAPODataConnectorProfileCredentials' {Maybe OAuthCredentials
oAuthCredentials :: Maybe OAuthCredentials
$sel:oAuthCredentials:SAPODataConnectorProfileCredentials' :: SAPODataConnectorProfileCredentials -> Maybe OAuthCredentials
oAuthCredentials} -> Maybe OAuthCredentials
oAuthCredentials) (\s :: SAPODataConnectorProfileCredentials
s@SAPODataConnectorProfileCredentials' {} Maybe OAuthCredentials
a -> SAPODataConnectorProfileCredentials
s {$sel:oAuthCredentials:SAPODataConnectorProfileCredentials' :: Maybe OAuthCredentials
oAuthCredentials = Maybe OAuthCredentials
a} :: SAPODataConnectorProfileCredentials)

-- | The SAPOData basic authentication credentials.
sAPODataConnectorProfileCredentials_basicAuthCredentials :: Lens.Lens' SAPODataConnectorProfileCredentials (Prelude.Maybe BasicAuthCredentials)
sAPODataConnectorProfileCredentials_basicAuthCredentials :: (Maybe BasicAuthCredentials -> f (Maybe BasicAuthCredentials))
-> SAPODataConnectorProfileCredentials
-> f SAPODataConnectorProfileCredentials
sAPODataConnectorProfileCredentials_basicAuthCredentials = (SAPODataConnectorProfileCredentials -> Maybe BasicAuthCredentials)
-> (SAPODataConnectorProfileCredentials
    -> Maybe BasicAuthCredentials
    -> SAPODataConnectorProfileCredentials)
-> Lens
     SAPODataConnectorProfileCredentials
     SAPODataConnectorProfileCredentials
     (Maybe BasicAuthCredentials)
     (Maybe BasicAuthCredentials)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SAPODataConnectorProfileCredentials' {Maybe BasicAuthCredentials
basicAuthCredentials :: Maybe BasicAuthCredentials
$sel:basicAuthCredentials:SAPODataConnectorProfileCredentials' :: SAPODataConnectorProfileCredentials -> Maybe BasicAuthCredentials
basicAuthCredentials} -> Maybe BasicAuthCredentials
basicAuthCredentials) (\s :: SAPODataConnectorProfileCredentials
s@SAPODataConnectorProfileCredentials' {} Maybe BasicAuthCredentials
a -> SAPODataConnectorProfileCredentials
s {$sel:basicAuthCredentials:SAPODataConnectorProfileCredentials' :: Maybe BasicAuthCredentials
basicAuthCredentials = Maybe BasicAuthCredentials
a} :: SAPODataConnectorProfileCredentials)

instance
  Prelude.Hashable
    SAPODataConnectorProfileCredentials

instance
  Prelude.NFData
    SAPODataConnectorProfileCredentials

instance
  Core.ToJSON
    SAPODataConnectorProfileCredentials
  where
  toJSON :: SAPODataConnectorProfileCredentials -> Value
toJSON SAPODataConnectorProfileCredentials' {Maybe BasicAuthCredentials
Maybe OAuthCredentials
basicAuthCredentials :: Maybe BasicAuthCredentials
oAuthCredentials :: Maybe OAuthCredentials
$sel:basicAuthCredentials:SAPODataConnectorProfileCredentials' :: SAPODataConnectorProfileCredentials -> Maybe BasicAuthCredentials
$sel:oAuthCredentials:SAPODataConnectorProfileCredentials' :: SAPODataConnectorProfileCredentials -> Maybe OAuthCredentials
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"oAuthCredentials" Text -> OAuthCredentials -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (OAuthCredentials -> Pair) -> Maybe OAuthCredentials -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OAuthCredentials
oAuthCredentials,
            (Text
"basicAuthCredentials" Text -> BasicAuthCredentials -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (BasicAuthCredentials -> Pair)
-> Maybe BasicAuthCredentials -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BasicAuthCredentials
basicAuthCredentials
          ]
      )