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

import Amazonka.AppFlow.Types.ConnectorOAuthRequest
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The connector-specific credentials required when using Amazon Honeycode.
--
-- /See:/ 'newHoneycodeConnectorProfileCredentials' smart constructor.
data HoneycodeConnectorProfileCredentials = HoneycodeConnectorProfileCredentials'
  { -- | The credentials used to access protected Amazon Honeycode resources.
    HoneycodeConnectorProfileCredentials -> Maybe (Sensitive Text)
accessToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The credentials used to acquire new access tokens.
    HoneycodeConnectorProfileCredentials -> Maybe Text
refreshToken :: Prelude.Maybe Prelude.Text,
    HoneycodeConnectorProfileCredentials -> Maybe ConnectorOAuthRequest
oAuthRequest :: Prelude.Maybe ConnectorOAuthRequest
  }
  deriving (HoneycodeConnectorProfileCredentials
-> HoneycodeConnectorProfileCredentials -> Bool
(HoneycodeConnectorProfileCredentials
 -> HoneycodeConnectorProfileCredentials -> Bool)
-> (HoneycodeConnectorProfileCredentials
    -> HoneycodeConnectorProfileCredentials -> Bool)
-> Eq HoneycodeConnectorProfileCredentials
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HoneycodeConnectorProfileCredentials
-> HoneycodeConnectorProfileCredentials -> Bool
$c/= :: HoneycodeConnectorProfileCredentials
-> HoneycodeConnectorProfileCredentials -> Bool
== :: HoneycodeConnectorProfileCredentials
-> HoneycodeConnectorProfileCredentials -> Bool
$c== :: HoneycodeConnectorProfileCredentials
-> HoneycodeConnectorProfileCredentials -> Bool
Prelude.Eq, Int -> HoneycodeConnectorProfileCredentials -> ShowS
[HoneycodeConnectorProfileCredentials] -> ShowS
HoneycodeConnectorProfileCredentials -> String
(Int -> HoneycodeConnectorProfileCredentials -> ShowS)
-> (HoneycodeConnectorProfileCredentials -> String)
-> ([HoneycodeConnectorProfileCredentials] -> ShowS)
-> Show HoneycodeConnectorProfileCredentials
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HoneycodeConnectorProfileCredentials] -> ShowS
$cshowList :: [HoneycodeConnectorProfileCredentials] -> ShowS
show :: HoneycodeConnectorProfileCredentials -> String
$cshow :: HoneycodeConnectorProfileCredentials -> String
showsPrec :: Int -> HoneycodeConnectorProfileCredentials -> ShowS
$cshowsPrec :: Int -> HoneycodeConnectorProfileCredentials -> ShowS
Prelude.Show, (forall x.
 HoneycodeConnectorProfileCredentials
 -> Rep HoneycodeConnectorProfileCredentials x)
-> (forall x.
    Rep HoneycodeConnectorProfileCredentials x
    -> HoneycodeConnectorProfileCredentials)
-> Generic HoneycodeConnectorProfileCredentials
forall x.
Rep HoneycodeConnectorProfileCredentials x
-> HoneycodeConnectorProfileCredentials
forall x.
HoneycodeConnectorProfileCredentials
-> Rep HoneycodeConnectorProfileCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HoneycodeConnectorProfileCredentials x
-> HoneycodeConnectorProfileCredentials
$cfrom :: forall x.
HoneycodeConnectorProfileCredentials
-> Rep HoneycodeConnectorProfileCredentials x
Prelude.Generic)

-- |
-- Create a value of 'HoneycodeConnectorProfileCredentials' 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:
--
-- 'accessToken', 'honeycodeConnectorProfileCredentials_accessToken' - The credentials used to access protected Amazon Honeycode resources.
--
-- 'refreshToken', 'honeycodeConnectorProfileCredentials_refreshToken' - The credentials used to acquire new access tokens.
--
-- 'oAuthRequest', 'honeycodeConnectorProfileCredentials_oAuthRequest' - Undocumented member.
newHoneycodeConnectorProfileCredentials ::
  HoneycodeConnectorProfileCredentials
newHoneycodeConnectorProfileCredentials :: HoneycodeConnectorProfileCredentials
newHoneycodeConnectorProfileCredentials =
  HoneycodeConnectorProfileCredentials' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe ConnectorOAuthRequest
-> HoneycodeConnectorProfileCredentials
HoneycodeConnectorProfileCredentials'
    { $sel:accessToken:HoneycodeConnectorProfileCredentials' :: Maybe (Sensitive Text)
accessToken =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:refreshToken:HoneycodeConnectorProfileCredentials' :: Maybe Text
refreshToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:oAuthRequest:HoneycodeConnectorProfileCredentials' :: Maybe ConnectorOAuthRequest
oAuthRequest = Maybe ConnectorOAuthRequest
forall a. Maybe a
Prelude.Nothing
    }

-- | The credentials used to access protected Amazon Honeycode resources.
honeycodeConnectorProfileCredentials_accessToken :: Lens.Lens' HoneycodeConnectorProfileCredentials (Prelude.Maybe Prelude.Text)
honeycodeConnectorProfileCredentials_accessToken :: (Maybe Text -> f (Maybe Text))
-> HoneycodeConnectorProfileCredentials
-> f HoneycodeConnectorProfileCredentials
honeycodeConnectorProfileCredentials_accessToken = (HoneycodeConnectorProfileCredentials -> Maybe (Sensitive Text))
-> (HoneycodeConnectorProfileCredentials
    -> Maybe (Sensitive Text) -> HoneycodeConnectorProfileCredentials)
-> Lens
     HoneycodeConnectorProfileCredentials
     HoneycodeConnectorProfileCredentials
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoneycodeConnectorProfileCredentials' {Maybe (Sensitive Text)
accessToken :: Maybe (Sensitive Text)
$sel:accessToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe (Sensitive Text)
accessToken} -> Maybe (Sensitive Text)
accessToken) (\s :: HoneycodeConnectorProfileCredentials
s@HoneycodeConnectorProfileCredentials' {} Maybe (Sensitive Text)
a -> HoneycodeConnectorProfileCredentials
s {$sel:accessToken:HoneycodeConnectorProfileCredentials' :: Maybe (Sensitive Text)
accessToken = Maybe (Sensitive Text)
a} :: HoneycodeConnectorProfileCredentials) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> HoneycodeConnectorProfileCredentials
 -> f HoneycodeConnectorProfileCredentials)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> HoneycodeConnectorProfileCredentials
-> f HoneycodeConnectorProfileCredentials
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The credentials used to acquire new access tokens.
honeycodeConnectorProfileCredentials_refreshToken :: Lens.Lens' HoneycodeConnectorProfileCredentials (Prelude.Maybe Prelude.Text)
honeycodeConnectorProfileCredentials_refreshToken :: (Maybe Text -> f (Maybe Text))
-> HoneycodeConnectorProfileCredentials
-> f HoneycodeConnectorProfileCredentials
honeycodeConnectorProfileCredentials_refreshToken = (HoneycodeConnectorProfileCredentials -> Maybe Text)
-> (HoneycodeConnectorProfileCredentials
    -> Maybe Text -> HoneycodeConnectorProfileCredentials)
-> Lens
     HoneycodeConnectorProfileCredentials
     HoneycodeConnectorProfileCredentials
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoneycodeConnectorProfileCredentials' {Maybe Text
refreshToken :: Maybe Text
$sel:refreshToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe Text
refreshToken} -> Maybe Text
refreshToken) (\s :: HoneycodeConnectorProfileCredentials
s@HoneycodeConnectorProfileCredentials' {} Maybe Text
a -> HoneycodeConnectorProfileCredentials
s {$sel:refreshToken:HoneycodeConnectorProfileCredentials' :: Maybe Text
refreshToken = Maybe Text
a} :: HoneycodeConnectorProfileCredentials)

-- | Undocumented member.
honeycodeConnectorProfileCredentials_oAuthRequest :: Lens.Lens' HoneycodeConnectorProfileCredentials (Prelude.Maybe ConnectorOAuthRequest)
honeycodeConnectorProfileCredentials_oAuthRequest :: (Maybe ConnectorOAuthRequest -> f (Maybe ConnectorOAuthRequest))
-> HoneycodeConnectorProfileCredentials
-> f HoneycodeConnectorProfileCredentials
honeycodeConnectorProfileCredentials_oAuthRequest = (HoneycodeConnectorProfileCredentials
 -> Maybe ConnectorOAuthRequest)
-> (HoneycodeConnectorProfileCredentials
    -> Maybe ConnectorOAuthRequest
    -> HoneycodeConnectorProfileCredentials)
-> Lens
     HoneycodeConnectorProfileCredentials
     HoneycodeConnectorProfileCredentials
     (Maybe ConnectorOAuthRequest)
     (Maybe ConnectorOAuthRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HoneycodeConnectorProfileCredentials' {Maybe ConnectorOAuthRequest
oAuthRequest :: Maybe ConnectorOAuthRequest
$sel:oAuthRequest:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe ConnectorOAuthRequest
oAuthRequest} -> Maybe ConnectorOAuthRequest
oAuthRequest) (\s :: HoneycodeConnectorProfileCredentials
s@HoneycodeConnectorProfileCredentials' {} Maybe ConnectorOAuthRequest
a -> HoneycodeConnectorProfileCredentials
s {$sel:oAuthRequest:HoneycodeConnectorProfileCredentials' :: Maybe ConnectorOAuthRequest
oAuthRequest = Maybe ConnectorOAuthRequest
a} :: HoneycodeConnectorProfileCredentials)

instance
  Prelude.Hashable
    HoneycodeConnectorProfileCredentials

instance
  Prelude.NFData
    HoneycodeConnectorProfileCredentials

instance
  Core.ToJSON
    HoneycodeConnectorProfileCredentials
  where
  toJSON :: HoneycodeConnectorProfileCredentials -> Value
toJSON HoneycodeConnectorProfileCredentials' {Maybe Text
Maybe (Sensitive Text)
Maybe ConnectorOAuthRequest
oAuthRequest :: Maybe ConnectorOAuthRequest
refreshToken :: Maybe Text
accessToken :: Maybe (Sensitive Text)
$sel:oAuthRequest:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe ConnectorOAuthRequest
$sel:refreshToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe Text
$sel:accessToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"accessToken" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
accessToken,
            (Text
"refreshToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
refreshToken,
            (Text
"oAuthRequest" Text -> ConnectorOAuthRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ConnectorOAuthRequest -> Pair)
-> Maybe ConnectorOAuthRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConnectorOAuthRequest
oAuthRequest
          ]
      )