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

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

-- | Contains the default values required for OAuth 2.0 authentication.
--
-- /See:/ 'newOAuth2Defaults' smart constructor.
data OAuth2Defaults = OAuth2Defaults'
  { -- | Auth code URLs that can be used for OAuth 2.0 authentication.
    OAuth2Defaults -> Maybe [Text]
authCodeUrls :: Prelude.Maybe [Prelude.Text],
    -- | List of custom parameters required for OAuth 2.0 authentication.
    OAuth2Defaults -> Maybe [OAuth2CustomParameter]
oauth2CustomProperties :: Prelude.Maybe [OAuth2CustomParameter],
    -- | OAuth 2.0 grant types supported by the connector.
    OAuth2Defaults -> Maybe [OAuth2GrantType]
oauth2GrantTypesSupported :: Prelude.Maybe [OAuth2GrantType],
    -- | OAuth 2.0 scopes that the connector supports.
    OAuth2Defaults -> Maybe [Text]
oauthScopes :: Prelude.Maybe [Prelude.Text],
    -- | Token URLs that can be used for OAuth 2.0 authentication.
    OAuth2Defaults -> Maybe [Text]
tokenUrls :: Prelude.Maybe [Prelude.Text]
  }
  deriving (OAuth2Defaults -> OAuth2Defaults -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OAuth2Defaults -> OAuth2Defaults -> Bool
$c/= :: OAuth2Defaults -> OAuth2Defaults -> Bool
== :: OAuth2Defaults -> OAuth2Defaults -> Bool
$c== :: OAuth2Defaults -> OAuth2Defaults -> Bool
Prelude.Eq, ReadPrec [OAuth2Defaults]
ReadPrec OAuth2Defaults
Int -> ReadS OAuth2Defaults
ReadS [OAuth2Defaults]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OAuth2Defaults]
$creadListPrec :: ReadPrec [OAuth2Defaults]
readPrec :: ReadPrec OAuth2Defaults
$creadPrec :: ReadPrec OAuth2Defaults
readList :: ReadS [OAuth2Defaults]
$creadList :: ReadS [OAuth2Defaults]
readsPrec :: Int -> ReadS OAuth2Defaults
$creadsPrec :: Int -> ReadS OAuth2Defaults
Prelude.Read, Int -> OAuth2Defaults -> ShowS
[OAuth2Defaults] -> ShowS
OAuth2Defaults -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OAuth2Defaults] -> ShowS
$cshowList :: [OAuth2Defaults] -> ShowS
show :: OAuth2Defaults -> String
$cshow :: OAuth2Defaults -> String
showsPrec :: Int -> OAuth2Defaults -> ShowS
$cshowsPrec :: Int -> OAuth2Defaults -> ShowS
Prelude.Show, forall x. Rep OAuth2Defaults x -> OAuth2Defaults
forall x. OAuth2Defaults -> Rep OAuth2Defaults x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OAuth2Defaults x -> OAuth2Defaults
$cfrom :: forall x. OAuth2Defaults -> Rep OAuth2Defaults x
Prelude.Generic)

-- |
-- Create a value of 'OAuth2Defaults' 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:
--
-- 'authCodeUrls', 'oAuth2Defaults_authCodeUrls' - Auth code URLs that can be used for OAuth 2.0 authentication.
--
-- 'oauth2CustomProperties', 'oAuth2Defaults_oauth2CustomProperties' - List of custom parameters required for OAuth 2.0 authentication.
--
-- 'oauth2GrantTypesSupported', 'oAuth2Defaults_oauth2GrantTypesSupported' - OAuth 2.0 grant types supported by the connector.
--
-- 'oauthScopes', 'oAuth2Defaults_oauthScopes' - OAuth 2.0 scopes that the connector supports.
--
-- 'tokenUrls', 'oAuth2Defaults_tokenUrls' - Token URLs that can be used for OAuth 2.0 authentication.
newOAuth2Defaults ::
  OAuth2Defaults
newOAuth2Defaults :: OAuth2Defaults
newOAuth2Defaults =
  OAuth2Defaults'
    { $sel:authCodeUrls:OAuth2Defaults' :: Maybe [Text]
authCodeUrls = forall a. Maybe a
Prelude.Nothing,
      $sel:oauth2CustomProperties:OAuth2Defaults' :: Maybe [OAuth2CustomParameter]
oauth2CustomProperties = forall a. Maybe a
Prelude.Nothing,
      $sel:oauth2GrantTypesSupported:OAuth2Defaults' :: Maybe [OAuth2GrantType]
oauth2GrantTypesSupported = forall a. Maybe a
Prelude.Nothing,
      $sel:oauthScopes:OAuth2Defaults' :: Maybe [Text]
oauthScopes = forall a. Maybe a
Prelude.Nothing,
      $sel:tokenUrls:OAuth2Defaults' :: Maybe [Text]
tokenUrls = forall a. Maybe a
Prelude.Nothing
    }

-- | Auth code URLs that can be used for OAuth 2.0 authentication.
oAuth2Defaults_authCodeUrls :: Lens.Lens' OAuth2Defaults (Prelude.Maybe [Prelude.Text])
oAuth2Defaults_authCodeUrls :: Lens' OAuth2Defaults (Maybe [Text])
oAuth2Defaults_authCodeUrls = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2Defaults' {Maybe [Text]
authCodeUrls :: Maybe [Text]
$sel:authCodeUrls:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
authCodeUrls} -> Maybe [Text]
authCodeUrls) (\s :: OAuth2Defaults
s@OAuth2Defaults' {} Maybe [Text]
a -> OAuth2Defaults
s {$sel:authCodeUrls:OAuth2Defaults' :: Maybe [Text]
authCodeUrls = Maybe [Text]
a} :: OAuth2Defaults) 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

-- | List of custom parameters required for OAuth 2.0 authentication.
oAuth2Defaults_oauth2CustomProperties :: Lens.Lens' OAuth2Defaults (Prelude.Maybe [OAuth2CustomParameter])
oAuth2Defaults_oauth2CustomProperties :: Lens' OAuth2Defaults (Maybe [OAuth2CustomParameter])
oAuth2Defaults_oauth2CustomProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2Defaults' {Maybe [OAuth2CustomParameter]
oauth2CustomProperties :: Maybe [OAuth2CustomParameter]
$sel:oauth2CustomProperties:OAuth2Defaults' :: OAuth2Defaults -> Maybe [OAuth2CustomParameter]
oauth2CustomProperties} -> Maybe [OAuth2CustomParameter]
oauth2CustomProperties) (\s :: OAuth2Defaults
s@OAuth2Defaults' {} Maybe [OAuth2CustomParameter]
a -> OAuth2Defaults
s {$sel:oauth2CustomProperties:OAuth2Defaults' :: Maybe [OAuth2CustomParameter]
oauth2CustomProperties = Maybe [OAuth2CustomParameter]
a} :: OAuth2Defaults) 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

-- | OAuth 2.0 grant types supported by the connector.
oAuth2Defaults_oauth2GrantTypesSupported :: Lens.Lens' OAuth2Defaults (Prelude.Maybe [OAuth2GrantType])
oAuth2Defaults_oauth2GrantTypesSupported :: Lens' OAuth2Defaults (Maybe [OAuth2GrantType])
oAuth2Defaults_oauth2GrantTypesSupported = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2Defaults' {Maybe [OAuth2GrantType]
oauth2GrantTypesSupported :: Maybe [OAuth2GrantType]
$sel:oauth2GrantTypesSupported:OAuth2Defaults' :: OAuth2Defaults -> Maybe [OAuth2GrantType]
oauth2GrantTypesSupported} -> Maybe [OAuth2GrantType]
oauth2GrantTypesSupported) (\s :: OAuth2Defaults
s@OAuth2Defaults' {} Maybe [OAuth2GrantType]
a -> OAuth2Defaults
s {$sel:oauth2GrantTypesSupported:OAuth2Defaults' :: Maybe [OAuth2GrantType]
oauth2GrantTypesSupported = Maybe [OAuth2GrantType]
a} :: OAuth2Defaults) 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

-- | OAuth 2.0 scopes that the connector supports.
oAuth2Defaults_oauthScopes :: Lens.Lens' OAuth2Defaults (Prelude.Maybe [Prelude.Text])
oAuth2Defaults_oauthScopes :: Lens' OAuth2Defaults (Maybe [Text])
oAuth2Defaults_oauthScopes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2Defaults' {Maybe [Text]
oauthScopes :: Maybe [Text]
$sel:oauthScopes:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
oauthScopes} -> Maybe [Text]
oauthScopes) (\s :: OAuth2Defaults
s@OAuth2Defaults' {} Maybe [Text]
a -> OAuth2Defaults
s {$sel:oauthScopes:OAuth2Defaults' :: Maybe [Text]
oauthScopes = Maybe [Text]
a} :: OAuth2Defaults) 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

-- | Token URLs that can be used for OAuth 2.0 authentication.
oAuth2Defaults_tokenUrls :: Lens.Lens' OAuth2Defaults (Prelude.Maybe [Prelude.Text])
oAuth2Defaults_tokenUrls :: Lens' OAuth2Defaults (Maybe [Text])
oAuth2Defaults_tokenUrls = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OAuth2Defaults' {Maybe [Text]
tokenUrls :: Maybe [Text]
$sel:tokenUrls:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
tokenUrls} -> Maybe [Text]
tokenUrls) (\s :: OAuth2Defaults
s@OAuth2Defaults' {} Maybe [Text]
a -> OAuth2Defaults
s {$sel:tokenUrls:OAuth2Defaults' :: Maybe [Text]
tokenUrls = Maybe [Text]
a} :: OAuth2Defaults) 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 OAuth2Defaults where
  parseJSON :: Value -> Parser OAuth2Defaults
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OAuth2Defaults"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [OAuth2CustomParameter]
-> Maybe [OAuth2GrantType]
-> Maybe [Text]
-> Maybe [Text]
-> OAuth2Defaults
OAuth2Defaults'
            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
"authCodeUrls" 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
"oauth2CustomProperties"
                            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
"oauth2GrantTypesSupported"
                            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
"oauthScopes" 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
"tokenUrls" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable OAuth2Defaults where
  hashWithSalt :: Int -> OAuth2Defaults -> Int
hashWithSalt Int
_salt OAuth2Defaults' {Maybe [Text]
Maybe [OAuth2CustomParameter]
Maybe [OAuth2GrantType]
tokenUrls :: Maybe [Text]
oauthScopes :: Maybe [Text]
oauth2GrantTypesSupported :: Maybe [OAuth2GrantType]
oauth2CustomProperties :: Maybe [OAuth2CustomParameter]
authCodeUrls :: Maybe [Text]
$sel:tokenUrls:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
$sel:oauthScopes:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
$sel:oauth2GrantTypesSupported:OAuth2Defaults' :: OAuth2Defaults -> Maybe [OAuth2GrantType]
$sel:oauth2CustomProperties:OAuth2Defaults' :: OAuth2Defaults -> Maybe [OAuth2CustomParameter]
$sel:authCodeUrls:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
authCodeUrls
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OAuth2CustomParameter]
oauth2CustomProperties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OAuth2GrantType]
oauth2GrantTypesSupported
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
oauthScopes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
tokenUrls

instance Prelude.NFData OAuth2Defaults where
  rnf :: OAuth2Defaults -> ()
rnf OAuth2Defaults' {Maybe [Text]
Maybe [OAuth2CustomParameter]
Maybe [OAuth2GrantType]
tokenUrls :: Maybe [Text]
oauthScopes :: Maybe [Text]
oauth2GrantTypesSupported :: Maybe [OAuth2GrantType]
oauth2CustomProperties :: Maybe [OAuth2CustomParameter]
authCodeUrls :: Maybe [Text]
$sel:tokenUrls:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
$sel:oauthScopes:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
$sel:oauth2GrantTypesSupported:OAuth2Defaults' :: OAuth2Defaults -> Maybe [OAuth2GrantType]
$sel:oauth2CustomProperties:OAuth2Defaults' :: OAuth2Defaults -> Maybe [OAuth2CustomParameter]
$sel:authCodeUrls:OAuth2Defaults' :: OAuth2Defaults -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
authCodeUrls
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OAuth2CustomParameter]
oauth2CustomProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OAuth2GrantType]
oauth2GrantTypesSupported
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
oauthScopes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
tokenUrls