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

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

-- | Custom parameter required for OAuth 2.0 authentication.
--
-- /See:/ 'newOAuth2CustomParameter' smart constructor.
data OAuth2CustomParameter = OAuth2CustomParameter'
  { -- | Contains default values for this authentication parameter that are
    -- supplied by the connector.
    OAuth2CustomParameter -> Maybe [Text]
connectorSuppliedValues :: Prelude.Maybe [Prelude.Text],
    -- | A description about the custom parameter used for OAuth 2.0
    -- authentication.
    OAuth2CustomParameter -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the custom parameter for OAuth 2.0 authentication is
    -- required.
    OAuth2CustomParameter -> Maybe Bool
isRequired :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether this authentication custom parameter is a sensitive
    -- field.
    OAuth2CustomParameter -> Maybe Bool
isSensitiveField :: Prelude.Maybe Prelude.Bool,
    -- | The key of the custom parameter required for OAuth 2.0 authentication.
    OAuth2CustomParameter -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | The label of the custom parameter used for OAuth 2.0 authentication.
    OAuth2CustomParameter -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether custom parameter is used with TokenUrl or AuthUrl.
    OAuth2CustomParameter -> Maybe OAuth2CustomPropType
type' :: Prelude.Maybe OAuth2CustomPropType
  }
  deriving (OAuth2CustomParameter -> OAuth2CustomParameter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OAuth2CustomParameter -> OAuth2CustomParameter -> Bool
$c/= :: OAuth2CustomParameter -> OAuth2CustomParameter -> Bool
== :: OAuth2CustomParameter -> OAuth2CustomParameter -> Bool
$c== :: OAuth2CustomParameter -> OAuth2CustomParameter -> Bool
Prelude.Eq, ReadPrec [OAuth2CustomParameter]
ReadPrec OAuth2CustomParameter
Int -> ReadS OAuth2CustomParameter
ReadS [OAuth2CustomParameter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OAuth2CustomParameter]
$creadListPrec :: ReadPrec [OAuth2CustomParameter]
readPrec :: ReadPrec OAuth2CustomParameter
$creadPrec :: ReadPrec OAuth2CustomParameter
readList :: ReadS [OAuth2CustomParameter]
$creadList :: ReadS [OAuth2CustomParameter]
readsPrec :: Int -> ReadS OAuth2CustomParameter
$creadsPrec :: Int -> ReadS OAuth2CustomParameter
Prelude.Read, Int -> OAuth2CustomParameter -> ShowS
[OAuth2CustomParameter] -> ShowS
OAuth2CustomParameter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OAuth2CustomParameter] -> ShowS
$cshowList :: [OAuth2CustomParameter] -> ShowS
show :: OAuth2CustomParameter -> String
$cshow :: OAuth2CustomParameter -> String
showsPrec :: Int -> OAuth2CustomParameter -> ShowS
$cshowsPrec :: Int -> OAuth2CustomParameter -> ShowS
Prelude.Show, forall x. Rep OAuth2CustomParameter x -> OAuth2CustomParameter
forall x. OAuth2CustomParameter -> Rep OAuth2CustomParameter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OAuth2CustomParameter x -> OAuth2CustomParameter
$cfrom :: forall x. OAuth2CustomParameter -> Rep OAuth2CustomParameter x
Prelude.Generic)

-- |
-- Create a value of 'OAuth2CustomParameter' 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:
--
-- 'connectorSuppliedValues', 'oAuth2CustomParameter_connectorSuppliedValues' - Contains default values for this authentication parameter that are
-- supplied by the connector.
--
-- 'description', 'oAuth2CustomParameter_description' - A description about the custom parameter used for OAuth 2.0
-- authentication.
--
-- 'isRequired', 'oAuth2CustomParameter_isRequired' - Indicates whether the custom parameter for OAuth 2.0 authentication is
-- required.
--
-- 'isSensitiveField', 'oAuth2CustomParameter_isSensitiveField' - Indicates whether this authentication custom parameter is a sensitive
-- field.
--
-- 'key', 'oAuth2CustomParameter_key' - The key of the custom parameter required for OAuth 2.0 authentication.
--
-- 'label', 'oAuth2CustomParameter_label' - The label of the custom parameter used for OAuth 2.0 authentication.
--
-- 'type'', 'oAuth2CustomParameter_type' - Indicates whether custom parameter is used with TokenUrl or AuthUrl.
newOAuth2CustomParameter ::
  OAuth2CustomParameter
newOAuth2CustomParameter :: OAuth2CustomParameter
newOAuth2CustomParameter =
  OAuth2CustomParameter'
    { $sel:connectorSuppliedValues:OAuth2CustomParameter' :: Maybe [Text]
connectorSuppliedValues =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:OAuth2CustomParameter' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:isRequired:OAuth2CustomParameter' :: Maybe Bool
isRequired = forall a. Maybe a
Prelude.Nothing,
      $sel:isSensitiveField:OAuth2CustomParameter' :: Maybe Bool
isSensitiveField = forall a. Maybe a
Prelude.Nothing,
      $sel:key:OAuth2CustomParameter' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:label:OAuth2CustomParameter' :: Maybe Text
label = forall a. Maybe a
Prelude.Nothing,
      $sel:type':OAuth2CustomParameter' :: Maybe OAuth2CustomPropType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | Contains default values for this authentication parameter that are
-- supplied by the connector.
oAuth2CustomParameter_connectorSuppliedValues :: Lens.Lens' OAuth2CustomParameter (Prelude.Maybe [Prelude.Text])
oAuth2CustomParameter_connectorSuppliedValues :: Lens' OAuth2CustomParameter (Maybe [Text])
oAuth2CustomParameter_connectorSuppliedValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2CustomParameter' {Maybe [Text]
connectorSuppliedValues :: Maybe [Text]
$sel:connectorSuppliedValues:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe [Text]
connectorSuppliedValues} -> Maybe [Text]
connectorSuppliedValues) (\s :: OAuth2CustomParameter
s@OAuth2CustomParameter' {} Maybe [Text]
a -> OAuth2CustomParameter
s {$sel:connectorSuppliedValues:OAuth2CustomParameter' :: Maybe [Text]
connectorSuppliedValues = Maybe [Text]
a} :: OAuth2CustomParameter) 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

-- | A description about the custom parameter used for OAuth 2.0
-- authentication.
oAuth2CustomParameter_description :: Lens.Lens' OAuth2CustomParameter (Prelude.Maybe Prelude.Text)
oAuth2CustomParameter_description :: Lens' OAuth2CustomParameter (Maybe Text)
oAuth2CustomParameter_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2CustomParameter' {Maybe Text
description :: Maybe Text
$sel:description:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
description} -> Maybe Text
description) (\s :: OAuth2CustomParameter
s@OAuth2CustomParameter' {} Maybe Text
a -> OAuth2CustomParameter
s {$sel:description:OAuth2CustomParameter' :: Maybe Text
description = Maybe Text
a} :: OAuth2CustomParameter)

-- | Indicates whether the custom parameter for OAuth 2.0 authentication is
-- required.
oAuth2CustomParameter_isRequired :: Lens.Lens' OAuth2CustomParameter (Prelude.Maybe Prelude.Bool)
oAuth2CustomParameter_isRequired :: Lens' OAuth2CustomParameter (Maybe Bool)
oAuth2CustomParameter_isRequired = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2CustomParameter' {Maybe Bool
isRequired :: Maybe Bool
$sel:isRequired:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Bool
isRequired} -> Maybe Bool
isRequired) (\s :: OAuth2CustomParameter
s@OAuth2CustomParameter' {} Maybe Bool
a -> OAuth2CustomParameter
s {$sel:isRequired:OAuth2CustomParameter' :: Maybe Bool
isRequired = Maybe Bool
a} :: OAuth2CustomParameter)

-- | Indicates whether this authentication custom parameter is a sensitive
-- field.
oAuth2CustomParameter_isSensitiveField :: Lens.Lens' OAuth2CustomParameter (Prelude.Maybe Prelude.Bool)
oAuth2CustomParameter_isSensitiveField :: Lens' OAuth2CustomParameter (Maybe Bool)
oAuth2CustomParameter_isSensitiveField = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2CustomParameter' {Maybe Bool
isSensitiveField :: Maybe Bool
$sel:isSensitiveField:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Bool
isSensitiveField} -> Maybe Bool
isSensitiveField) (\s :: OAuth2CustomParameter
s@OAuth2CustomParameter' {} Maybe Bool
a -> OAuth2CustomParameter
s {$sel:isSensitiveField:OAuth2CustomParameter' :: Maybe Bool
isSensitiveField = Maybe Bool
a} :: OAuth2CustomParameter)

-- | The key of the custom parameter required for OAuth 2.0 authentication.
oAuth2CustomParameter_key :: Lens.Lens' OAuth2CustomParameter (Prelude.Maybe Prelude.Text)
oAuth2CustomParameter_key :: Lens' OAuth2CustomParameter (Maybe Text)
oAuth2CustomParameter_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2CustomParameter' {Maybe Text
key :: Maybe Text
$sel:key:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
key} -> Maybe Text
key) (\s :: OAuth2CustomParameter
s@OAuth2CustomParameter' {} Maybe Text
a -> OAuth2CustomParameter
s {$sel:key:OAuth2CustomParameter' :: Maybe Text
key = Maybe Text
a} :: OAuth2CustomParameter)

-- | The label of the custom parameter used for OAuth 2.0 authentication.
oAuth2CustomParameter_label :: Lens.Lens' OAuth2CustomParameter (Prelude.Maybe Prelude.Text)
oAuth2CustomParameter_label :: Lens' OAuth2CustomParameter (Maybe Text)
oAuth2CustomParameter_label = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2CustomParameter' {Maybe Text
label :: Maybe Text
$sel:label:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
label} -> Maybe Text
label) (\s :: OAuth2CustomParameter
s@OAuth2CustomParameter' {} Maybe Text
a -> OAuth2CustomParameter
s {$sel:label:OAuth2CustomParameter' :: Maybe Text
label = Maybe Text
a} :: OAuth2CustomParameter)

-- | Indicates whether custom parameter is used with TokenUrl or AuthUrl.
oAuth2CustomParameter_type :: Lens.Lens' OAuth2CustomParameter (Prelude.Maybe OAuth2CustomPropType)
oAuth2CustomParameter_type :: Lens' OAuth2CustomParameter (Maybe OAuth2CustomPropType)
oAuth2CustomParameter_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2CustomParameter' {Maybe OAuth2CustomPropType
type' :: Maybe OAuth2CustomPropType
$sel:type':OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe OAuth2CustomPropType
type'} -> Maybe OAuth2CustomPropType
type') (\s :: OAuth2CustomParameter
s@OAuth2CustomParameter' {} Maybe OAuth2CustomPropType
a -> OAuth2CustomParameter
s {$sel:type':OAuth2CustomParameter' :: Maybe OAuth2CustomPropType
type' = Maybe OAuth2CustomPropType
a} :: OAuth2CustomParameter)

instance Data.FromJSON OAuth2CustomParameter where
  parseJSON :: Value -> Parser OAuth2CustomParameter
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OAuth2CustomParameter"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe OAuth2CustomPropType
-> OAuth2CustomParameter
OAuth2CustomParameter'
            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
"connectorSuppliedValues"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"description")
            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
"isRequired")
            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
"isSensitiveField")
            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
"key")
            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
"label")
            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
"type")
      )

instance Prelude.Hashable OAuth2CustomParameter where
  hashWithSalt :: Int -> OAuth2CustomParameter -> Int
hashWithSalt Int
_salt OAuth2CustomParameter' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe OAuth2CustomPropType
type' :: Maybe OAuth2CustomPropType
label :: Maybe Text
key :: Maybe Text
isSensitiveField :: Maybe Bool
isRequired :: Maybe Bool
description :: Maybe Text
connectorSuppliedValues :: Maybe [Text]
$sel:type':OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe OAuth2CustomPropType
$sel:label:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
$sel:key:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
$sel:isSensitiveField:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Bool
$sel:isRequired:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Bool
$sel:description:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
$sel:connectorSuppliedValues:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
connectorSuppliedValues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isRequired
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isSensitiveField
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
label
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OAuth2CustomPropType
type'

instance Prelude.NFData OAuth2CustomParameter where
  rnf :: OAuth2CustomParameter -> ()
rnf OAuth2CustomParameter' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe OAuth2CustomPropType
type' :: Maybe OAuth2CustomPropType
label :: Maybe Text
key :: Maybe Text
isSensitiveField :: Maybe Bool
isRequired :: Maybe Bool
description :: Maybe Text
connectorSuppliedValues :: Maybe [Text]
$sel:type':OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe OAuth2CustomPropType
$sel:label:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
$sel:key:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
$sel:isSensitiveField:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Bool
$sel:isRequired:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Bool
$sel:description:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe Text
$sel:connectorSuppliedValues:OAuth2CustomParameter' :: OAuth2CustomParameter -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
connectorSuppliedValues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isRequired
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isSensitiveField
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
label
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OAuth2CustomPropType
type'