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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The connector metadata specific to Salesforce.
--
-- /See:/ 'newSalesforceMetadata' smart constructor.
data SalesforceMetadata = SalesforceMetadata'
  { -- | The desired authorization scope for the Salesforce account.
    SalesforceMetadata -> Maybe [Text]
oAuthScopes :: Prelude.Maybe [Prelude.Text]
  }
  deriving (SalesforceMetadata -> SalesforceMetadata -> Bool
(SalesforceMetadata -> SalesforceMetadata -> Bool)
-> (SalesforceMetadata -> SalesforceMetadata -> Bool)
-> Eq SalesforceMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SalesforceMetadata -> SalesforceMetadata -> Bool
$c/= :: SalesforceMetadata -> SalesforceMetadata -> Bool
== :: SalesforceMetadata -> SalesforceMetadata -> Bool
$c== :: SalesforceMetadata -> SalesforceMetadata -> Bool
Prelude.Eq, ReadPrec [SalesforceMetadata]
ReadPrec SalesforceMetadata
Int -> ReadS SalesforceMetadata
ReadS [SalesforceMetadata]
(Int -> ReadS SalesforceMetadata)
-> ReadS [SalesforceMetadata]
-> ReadPrec SalesforceMetadata
-> ReadPrec [SalesforceMetadata]
-> Read SalesforceMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SalesforceMetadata]
$creadListPrec :: ReadPrec [SalesforceMetadata]
readPrec :: ReadPrec SalesforceMetadata
$creadPrec :: ReadPrec SalesforceMetadata
readList :: ReadS [SalesforceMetadata]
$creadList :: ReadS [SalesforceMetadata]
readsPrec :: Int -> ReadS SalesforceMetadata
$creadsPrec :: Int -> ReadS SalesforceMetadata
Prelude.Read, Int -> SalesforceMetadata -> ShowS
[SalesforceMetadata] -> ShowS
SalesforceMetadata -> String
(Int -> SalesforceMetadata -> ShowS)
-> (SalesforceMetadata -> String)
-> ([SalesforceMetadata] -> ShowS)
-> Show SalesforceMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SalesforceMetadata] -> ShowS
$cshowList :: [SalesforceMetadata] -> ShowS
show :: SalesforceMetadata -> String
$cshow :: SalesforceMetadata -> String
showsPrec :: Int -> SalesforceMetadata -> ShowS
$cshowsPrec :: Int -> SalesforceMetadata -> ShowS
Prelude.Show, (forall x. SalesforceMetadata -> Rep SalesforceMetadata x)
-> (forall x. Rep SalesforceMetadata x -> SalesforceMetadata)
-> Generic SalesforceMetadata
forall x. Rep SalesforceMetadata x -> SalesforceMetadata
forall x. SalesforceMetadata -> Rep SalesforceMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SalesforceMetadata x -> SalesforceMetadata
$cfrom :: forall x. SalesforceMetadata -> Rep SalesforceMetadata x
Prelude.Generic)

-- |
-- Create a value of 'SalesforceMetadata' 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:
--
-- 'oAuthScopes', 'salesforceMetadata_oAuthScopes' - The desired authorization scope for the Salesforce account.
newSalesforceMetadata ::
  SalesforceMetadata
newSalesforceMetadata :: SalesforceMetadata
newSalesforceMetadata =
  SalesforceMetadata' :: Maybe [Text] -> SalesforceMetadata
SalesforceMetadata' {$sel:oAuthScopes:SalesforceMetadata' :: Maybe [Text]
oAuthScopes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing}

-- | The desired authorization scope for the Salesforce account.
salesforceMetadata_oAuthScopes :: Lens.Lens' SalesforceMetadata (Prelude.Maybe [Prelude.Text])
salesforceMetadata_oAuthScopes :: (Maybe [Text] -> f (Maybe [Text]))
-> SalesforceMetadata -> f SalesforceMetadata
salesforceMetadata_oAuthScopes = (SalesforceMetadata -> Maybe [Text])
-> (SalesforceMetadata -> Maybe [Text] -> SalesforceMetadata)
-> Lens
     SalesforceMetadata SalesforceMetadata (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SalesforceMetadata' {Maybe [Text]
oAuthScopes :: Maybe [Text]
$sel:oAuthScopes:SalesforceMetadata' :: SalesforceMetadata -> Maybe [Text]
oAuthScopes} -> Maybe [Text]
oAuthScopes) (\s :: SalesforceMetadata
s@SalesforceMetadata' {} Maybe [Text]
a -> SalesforceMetadata
s {$sel:oAuthScopes:SalesforceMetadata' :: Maybe [Text]
oAuthScopes = Maybe [Text]
a} :: SalesforceMetadata) ((Maybe [Text] -> f (Maybe [Text]))
 -> SalesforceMetadata -> f SalesforceMetadata)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SalesforceMetadata
-> f SalesforceMetadata
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON SalesforceMetadata where
  parseJSON :: Value -> Parser SalesforceMetadata
parseJSON =
    String
-> (Object -> Parser SalesforceMetadata)
-> Value
-> Parser SalesforceMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SalesforceMetadata"
      ( \Object
x ->
          Maybe [Text] -> SalesforceMetadata
SalesforceMetadata'
            (Maybe [Text] -> SalesforceMetadata)
-> Parser (Maybe [Text]) -> Parser SalesforceMetadata
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"oAuthScopes" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable SalesforceMetadata

instance Prelude.NFData SalesforceMetadata