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

import Amazonka.AppFlow.Types.ConnectorOAuthRequest
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 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 (Data.Sensitive Prelude.Text),
    HoneycodeConnectorProfileCredentials -> Maybe ConnectorOAuthRequest
oAuthRequest :: Prelude.Maybe ConnectorOAuthRequest,
    -- | The credentials used to acquire new access tokens.
    HoneycodeConnectorProfileCredentials -> Maybe Text
refreshToken :: Prelude.Maybe Prelude.Text
  }
  deriving (HoneycodeConnectorProfileCredentials
-> HoneycodeConnectorProfileCredentials -> Bool
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
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.
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.
--
-- 'oAuthRequest', 'honeycodeConnectorProfileCredentials_oAuthRequest' - Undocumented member.
--
-- 'refreshToken', 'honeycodeConnectorProfileCredentials_refreshToken' - The credentials used to acquire new access tokens.
newHoneycodeConnectorProfileCredentials ::
  HoneycodeConnectorProfileCredentials
newHoneycodeConnectorProfileCredentials :: HoneycodeConnectorProfileCredentials
newHoneycodeConnectorProfileCredentials =
  HoneycodeConnectorProfileCredentials'
    { $sel:accessToken:HoneycodeConnectorProfileCredentials' :: Maybe (Sensitive Text)
accessToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:oAuthRequest:HoneycodeConnectorProfileCredentials' :: Maybe ConnectorOAuthRequest
oAuthRequest = forall a. Maybe a
Prelude.Nothing,
      $sel:refreshToken:HoneycodeConnectorProfileCredentials' :: Maybe Text
refreshToken = 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 :: Lens' HoneycodeConnectorProfileCredentials (Maybe Text)
honeycodeConnectorProfileCredentials_accessToken = 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) 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 a. Iso' (Sensitive a) a
Data._Sensitive

-- | Undocumented member.
honeycodeConnectorProfileCredentials_oAuthRequest :: Lens.Lens' HoneycodeConnectorProfileCredentials (Prelude.Maybe ConnectorOAuthRequest)
honeycodeConnectorProfileCredentials_oAuthRequest :: Lens'
  HoneycodeConnectorProfileCredentials (Maybe ConnectorOAuthRequest)
honeycodeConnectorProfileCredentials_oAuthRequest = 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)

-- | The credentials used to acquire new access tokens.
honeycodeConnectorProfileCredentials_refreshToken :: Lens.Lens' HoneycodeConnectorProfileCredentials (Prelude.Maybe Prelude.Text)
honeycodeConnectorProfileCredentials_refreshToken :: Lens' HoneycodeConnectorProfileCredentials (Maybe Text)
honeycodeConnectorProfileCredentials_refreshToken = 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)

instance
  Prelude.Hashable
    HoneycodeConnectorProfileCredentials
  where
  hashWithSalt :: Int -> HoneycodeConnectorProfileCredentials -> Int
hashWithSalt
    Int
_salt
    HoneycodeConnectorProfileCredentials' {Maybe Text
Maybe (Sensitive Text)
Maybe ConnectorOAuthRequest
refreshToken :: Maybe Text
oAuthRequest :: Maybe ConnectorOAuthRequest
accessToken :: Maybe (Sensitive Text)
$sel:refreshToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe Text
$sel:oAuthRequest:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe ConnectorOAuthRequest
$sel:accessToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe (Sensitive Text)
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
accessToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConnectorOAuthRequest
oAuthRequest
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
refreshToken

instance
  Prelude.NFData
    HoneycodeConnectorProfileCredentials
  where
  rnf :: HoneycodeConnectorProfileCredentials -> ()
rnf HoneycodeConnectorProfileCredentials' {Maybe Text
Maybe (Sensitive Text)
Maybe ConnectorOAuthRequest
refreshToken :: Maybe Text
oAuthRequest :: Maybe ConnectorOAuthRequest
accessToken :: Maybe (Sensitive Text)
$sel:refreshToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe Text
$sel:oAuthRequest:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe ConnectorOAuthRequest
$sel:accessToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe (Sensitive Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
accessToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConnectorOAuthRequest
oAuthRequest
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
refreshToken

instance
  Data.ToJSON
    HoneycodeConnectorProfileCredentials
  where
  toJSON :: HoneycodeConnectorProfileCredentials -> Value
toJSON HoneycodeConnectorProfileCredentials' {Maybe Text
Maybe (Sensitive Text)
Maybe ConnectorOAuthRequest
refreshToken :: Maybe Text
oAuthRequest :: Maybe ConnectorOAuthRequest
accessToken :: Maybe (Sensitive Text)
$sel:refreshToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe Text
$sel:oAuthRequest:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe ConnectorOAuthRequest
$sel:accessToken:HoneycodeConnectorProfileCredentials' :: HoneycodeConnectorProfileCredentials -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"accessToken" 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 (Sensitive Text)
accessToken,
            (Key
"oAuthRequest" 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 ConnectorOAuthRequest
oAuthRequest,
            (Key
"refreshToken" 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 Text
refreshToken
          ]
      )